R
R
ruslanbm292021-07-05 20:04:38
PHP
ruslanbm29, 2021-07-05 20:04:38

PHP text reproduction - is there a ready-made script that will return the result by key?

Hello! I have already found in the open spaces ready-made solutions for PHP - a text randomizer. The problem is that they always give different results.
For example, we have some kind of template:

.{{Рандомизатор|Рандомайзер} {|текста} - {|это}
|{Рандомизатором|Рандомайзером} {|текста} называется
}
{{|спамерский|оптимизаторский|SEO|сео|сеошный|рерайтерский}
 {инструмент|скрипт|софт}
 {|, предназначенный|, который {предназначен|нужен|используется}}
|{|спамерская|оптимизаторская|SEO|сео|сеошная|рерайтерская}
 {программа|прога|софтина|утилита}
 {|, предназначенная|, которая предназначена|, которая нужна}
} для
{{|промышленного|индустриального|поточного|массового}
 {{рерайтинга|рерайта}
  {
  |{|псевдоуникальных|уникальных|новых|рандомных} {статей|публикаций|текстов}
  |{|псевдоуникального|уникального|нового|рандомного} контента
  }
 |{переписывания|производства|создания|клепания|размножения|написания}
  {{|псевдоуникальных|уникальных|новых|рандомных} {статей|публикаций|текстов}
  |{|псевдоуникального|уникального|нового|рандомного} контента
  }
 }
|{|промышленной|индустриальной|поточной|массовой}
 {уникализации|псевдоуникализации|рандомизации}
 {статей|контента|публикаций|текстов}
}
{
|в целях
 {{|поискового} спама
 |{|поисковой|SEO|сео|сеошной} оптимизации {|контента|сайта}
 |{|поискового|SEO|сео|сеошного} продвижения {|сайта}
 |продвижения {|сайта} в {поисковой выдаче|выдаче поисковиков}
 }
|для нужд
 {{|поисковой|SEO|сео|сеошной} оптимизации {|контента|сайта}
 |{|поискового|SEO|сео|сеошного} продвижения {|сайта}
 |продвижения {|сайта} в {поисковой выдаче|выдаче поисковиков}
 |{|SEO|сео|сеошных|поисковых} {оптимизаторов|продвиженцев}
 }
}.

It has 576 text options. And I need to always get some kind of 1 option by key.
Suppose the key "80" is sent to the randomizer - it will always return the same version of the text that corresponds to the number 80, - the key "100" already corresponds to a slightly different version of the text.
I hope I explained clearly. If there are ready-made solutions, send me - I have already searched the entire Github and the Internet.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2021-07-05
@rpsv

Of course, the task is not clear, but what's the problem with taking a randomizer, generating all the options and writing them into a hash table with keys? Then you will not refer to the generator, but to the hash, and the result for a specific key will always be the same.
And actually writing a randomizer with input data like yours (generating by mask) is also not very difficult.
PS, how amusing is the fact that very often people write their bikes for fairly large tasks, when it’s better / easier to take a ready-made solution (the tower is when I “write my own framework”), but when you can quickly add a bike that will solve the problem, everyone runs to look ready solution.

A
Alex Wells, 2021-07-05
@Alex_Wells

Well, come up with an algorithm that always generates the same text for the specified key. For example - random with seed. As long as the algorithm is unchanged, each seed will always produce the same sequence of random numbers, and therefore the text will be the same. This will NOT give you a guarantee that there will be no duplicates or that all possible options are used. If one is needed, then this is no longer random, and you can simply choose the options one by one (the main thing is that the order of the options does not change) depending on the number from 0 to the number of combinations

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question