Sphinx and word forms

How can I make the Sphinx recognize “auto” and “car” as similar words?

Let me have three database entries

Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.

Here are sample queries and results ...

query: car
result: Mary don't like to drive car.
-------------------------------------
query: auto
result: Andy likes to drive auto.
-------------------------------------
query: automobile
Bob is going to buy automobile.

.. but I want the sphinx to return ...

query: car
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.
-------------------------------------
query: auto
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.
-------------------------------------
query: automobile
result:
Andy likes to drive auto.
Mary don't like to drive car.
Bob is going to buy automobile.

I know that Sphinx has stowords, but what should I put in a dictionary with long words to make Sphinx think so?

Thank.

+3
source share
2 answers

all you have to do is provide sphinx with a correctly formatted text wordforms file in your .conf file.

documentation found here: http://www.sphinxsearch.com/docs/manual-0.9.9.html#conf-wordforms

auto > car
automobile > car
four-wheeled-vehicle-intended-for-public-roads > car
cars > car
+4
source

"" "", ( - " " ).

wordforms.txt :

gear > gear
geared > gear
gearing > gear
gears > gear
……
leverage > leverage
leveraged > leverage
leverages > leverage
leveraging > leverage

, . , "wordforms.txt" :

gear > leverage
geared > leverage
gearing > leverage
gears > leverage
……
leveraged > leverage
leverages > leverage
leveraging > leverage

( ). "wordforms.txt" , .

, "" "", .

0

Source: https://habr.com/ru/post/1733261/


All Articles