All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.lucene.wordnet.package.html Maven / Gradle / Ivy




    
WordNet Lucene Synonyms Integration



    This package uses synonyms defined by WordNet.
    There are two methods: query expansion and analysis.
    
    Both methods first require you to download the WordNet prolog database
    Inside this archive is a file named wn_s.pl, which contains the WordNet synonyms. 
    
    

Query Expansion Method

This method creates Lucene index storing the synonyms, 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

  1. Invoke Syn2Index as appropriate to build a synonym index. It'll take 2 arguments, the path to wn_s.pl from the WordNet download, and the index name.
  2. Update your UI so that as appropriate you call SynExpand.expand(...) to expand user queries with synonyms.

Analysis Method

This method injects additional synonym tokens for tokens from a child {@link org.apache.lucene.analysis.TokenStream}.

Instructions

  1. Create a {@link org.apache.lucene.wordnet.SynonymMap}, passing in the path to wn_s.pl
  2. Add a {@link org.apache.lucene.wordnet.SynonymTokenFilter} to your analyzer. Note: SynonymTokenFilter should be after LowerCaseFilter, because it expects terms to already be in lowercase.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy