Good way to do multi-word synonym search

蹲街弑〆低调 提交于 2019-12-13 06:59:26

问题


All:

I want to do a multi-word synonym search, to get search to work like:

"small dog" means puppy 
"cute small cat" may refer to kitten

[1] I do not know how to define those multi-word phrase in synonyms.txt to make it work. Could anyone ell me how to define those phrase in synonyms.txt

[2] Another thing is: Once the synonym can work, how can I match both "small dog" and "little dog" which have similar meaning with puppy? Like:

"a small dog" also means "small dog" means puppy 
"cute cat" may refer to "cute small cat" may refer to kitten

( I mean if there is any way we can collapse the phrase which has similar meaning and words into the synonym phrase which is in the synonym list)

Thanks


回答1:


It could be done very easily.

In synonyms file you need to write something like this:

small dog => puppy

According to second question:

a small dog => puppy
little dog => puppy

=> in Solr synonyms file means 1-way synonym, if you want to to have 2-way synonyms, you need to list them with comma as a delimeter.

For more info about synonyms in Solr - https://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory



来源:https://stackoverflow.com/questions/28158870/good-way-to-do-multi-word-synonym-search

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!