WordNet integrated with ElasticSearch - how to add new synonyms

I am working with ElasticSearch version 1.2.3

I integrated WordNet 3.0 as a Synonym database for the ElasticSearch synonym analyzer. (Full installation of WordNet: setup, creation, installation)

I added the following code to the ElasticSearch index settings (index name local_es )

curl -XPUT 'localhost:9200/local_es/_settings' -d '{ "settings" : { "analysis" : { "analyzer" : { "synonym" : { "tokenizer" : "lowercase", "filter" : ["synonym"] } }, "filter" : { "synonym" : { "type" : "synonym", "format": "wordnet", "synonyms_path": "analysis/wn_s.pl" } } } } }' 

I also updated the display with the following code:

 enter code here curl -XPUT 'localhost:9200/local_es/shadowpage/_mapping' -d '{ "shadowpage" : { "shadowPageName" : { "enabled" : true, "analyzer" : "synonym" }, "properties" : { "name" : { "type" : "string", "index" : "analyzed", "analyzer" : "synonym" } } } }' 

Everything works as expected.

As you can see, ElasticSearch takes its data from the path to the file analysis / wn_s.pl

The wn_s.pl file is a WordNet prolog containing all database synonyms.

How to add new synonyms to the database? Can I add it directly to a WordNet database? Or in the wn_s.pl file?

+7
elasticsearch wordnet synonym
source share
1 answer

If you are going to actively modify your synonym database, you just need to convert the synsets in the wordnet database to a comma-delimited main file in this format

  "british,english", "queen,monarch" 

Then use and edit this file as a synonym resource.

+1
source share

All Articles