Example usage for org.apache.lucene.analysis.hunspell HunspellStemFilter HunspellStemFilter

List of usage examples for org.apache.lucene.analysis.hunspell HunspellStemFilter HunspellStemFilter

Introduction

In this page you can find the example usage for org.apache.lucene.analysis.hunspell HunspellStemFilter HunspellStemFilter.

Prototype

public HunspellStemFilter(TokenStream input, Dictionary dictionary) 

Source Link

Document

Create a HunspellStemFilter outputting all possible stems.

Usage

From source file:org.apache.solr.analysis.HunspellStemFilterFactory.java

License:Apache License

/**
 * Creates an instance of {@link org.apache.lucene.analysis.hunspell.HunspellStemFilter} that will filter the given
 * TokenStream/*w  w w. ja  va2s  .  c  o m*/
 *
 * @param tokenStream TokenStream that will be filtered
 * @return HunspellStemFilter that filters the TokenStream 
 */
public TokenStream create(TokenStream tokenStream) {
    return new HunspellStemFilter(tokenStream, dictionary);
}

From source file:org.elasticsearch.analysis.hunspell.cs.CzechHunspellAnalyzer.java

License:Apache License

@Override
protected TokenStreamComponents createComponents(String field) {
    final Tokenizer source = new StandardTokenizer();
    TokenStream result = new StopFilter(source, stopwords);
    if (!this.stemExclusionTable.isEmpty()) {
        result = new SetKeywordMarkerFilter(result, stemExclusionTable);
    }//from w  ww. ja  v  a2s.  c  o m
    result = new HunspellStemFilter(result, dictionary);
    result = new LowerCaseFilter(result);
    return new TokenStreamComponents(source, result);
}

From source file:org.elasticsearch.analysis.hunspell.fr.FrenchHunspellAnalyzer.java

License:Apache License

@Override
protected TokenStreamComponents createComponents(String field) {
    final Tokenizer source = new StandardTokenizer();
    TokenStream result = new ElisionFilter(source, FrenchAnalyzer.DEFAULT_ARTICLES);
    result = new StopFilter(result, stopwords);
    if (!this.stemExclusionTable.isEmpty()) {
        result = new SetKeywordMarkerFilter(result, stemExclusionTable);
    }/*from  w  w w. j a  v  a 2 s .  c om*/
    result = new HunspellStemFilter(result, dictionary);
    result = new LowerCaseFilter(result);
    return new TokenStreamComponents(source, result);
}

From source file:org.omegat.tokenizer.HunspellTokenizer.java

License:Open Source License

@Override
protected TokenStream getTokenStream(final String strOrig, final boolean stemsAllowed,
        final boolean stopWordsAllowed) {
    if (stemsAllowed) {
        HunspellDictionary dictionary = getDict();
        if (dictionary == null) {
            return new StandardTokenizer(getBehavior(), new StringReader(strOrig));
        }//from   w w  w .  ja v a 2 s. c o  m

        return new HunspellStemFilter(new StandardTokenizer(getBehavior(), new StringReader(strOrig)),
                dictionary);

        /// TODO: implement stop words checks
    } else {
        return new StandardTokenizer(getBehavior(), new StringReader(strOrig));
    }
}