G
G
GK5662017-09-15 12:32:37
PHP
GK566, 2017-09-15 12:32:37

How to implement search for a string in a string with different endings in PHP?

Good afternoon!
Please, tell me how to implement the search for one string in another using PHP5? Moreover, the endings of the words are different. The order must be maintained. The register is independent. Only Russian language.
Example:
You want to extract the string "City incinerator " from the string "City incinerator recycling facility " .

Answer the question

In order to leave comments, you need to log in

4 answer(s)
X
xmoonlight, 2017-09-15
@GK566

stumper.ru - for complex searches (if necessary)
And for simple ones, like this one - simple code .

S
Stanislav B, 2017-09-15
@S_Borchev

sphinx, and if the task is quite simple, you can handle it rustically with a stemmer, or take phpMorphy (but it’s very sad)

B
Boris Korobkov, 2017-09-15
@BorisKorobkov

sphinxsearch.com
lucene.apache.org
etc.

I
Ilya Gerasimov, 2017-09-15
@Omashu

Well, it’s better to look in the direction of morph libraries, not to write a regular expression for each phrase
Мусоросжигательн(ый)?.*?\sзавод.*?\sгорода

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question