org.apache.lucene.wordnet |
WordNet Lucene Synonyms Integration
This package uses synonyms defined by WordNet to build a
Lucene index storing them, which in turn can be used for query expansion.
You normally run {@link org.apache.lucene.wordnet.Syns2Index} once to build the query index/"database", and then call
{@link org.apache.lucene.wordnet.SynExpand#expand SynExpand.expand(...)} to expand a query.
Instructions
- Download the WordNet prolog database , gunzip, untar etc.
- Invoke Syn2Index as appropriate to build a synonym index.
It'll take 2 arguments, the path to wn_s.pl from that WordNet downlaod, and the index name.
- Update your UI so that as appropriate you call SynExpand.expand(...) to expand user queries with synonyms.
|
Java Source File Name | Type | Comment |
SynExpand.java | Class | Expand a query by looking up synonyms for every term. |
SynLookup.java | Class | Test program to look up synonyms. |
Syns2Index.java | Class | Convert the prolog file wn_s.pl from the WordNet prolog download
into a Lucene index suitable for looking up synonyms and performing query expansion (
SynExpand.expand SynExpand.expand(...) ).
This has been tested with WordNet 2.0.
The index has fields named "word" (
Syns2Index.F_WORD )
and "syn" (
Syns2Index.F_SYN ).
The source word (such as 'big') can be looked up in the
"word" field, and if present there will be fields named "syn"
for every synonym. |