Search in sources :

Example 6 with DecimalDigitFilter

use of org.apache.lucene.analysis.core.DecimalDigitFilter in project lucene-solr by apache.

the class PersianAnalyzer method normalize.

@Override
protected TokenStream normalize(String fieldName, TokenStream in) {
    TokenStream result = new StandardFilter(in);
    result = new LowerCaseFilter(result);
    result = new DecimalDigitFilter(result);
    result = new ArabicNormalizationFilter(result);
    /* additional persian-specific normalization */
    result = new PersianNormalizationFilter(result);
    return result;
}
Also used : DecimalDigitFilter(org.apache.lucene.analysis.core.DecimalDigitFilter) ArabicNormalizationFilter(org.apache.lucene.analysis.ar.ArabicNormalizationFilter) TokenStream(org.apache.lucene.analysis.TokenStream) StandardFilter(org.apache.lucene.analysis.standard.StandardFilter) LowerCaseFilter(org.apache.lucene.analysis.LowerCaseFilter)

Example 7 with DecimalDigitFilter

use of org.apache.lucene.analysis.core.DecimalDigitFilter in project lucene-solr by apache.

the class SoraniAnalyzer method createComponents.

/**
   * Creates a
   * {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   * which tokenizes all the text in the provided {@link Reader}.
   * 
   * @return A
   *         {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   *         built from an {@link StandardTokenizer} filtered with
   *         {@link StandardFilter}, {@link SoraniNormalizationFilter}, 
   *         {@link LowerCaseFilter}, {@link DecimalDigitFilter}, {@link StopFilter}
   *         , {@link SetKeywordMarkerFilter} if a stem exclusion set is
   *         provided and {@link SoraniStemFilter}.
   */
@Override
protected TokenStreamComponents createComponents(String fieldName) {
    final Tokenizer source = new StandardTokenizer();
    TokenStream result = new StandardFilter(source);
    result = new SoraniNormalizationFilter(result);
    result = new LowerCaseFilter(result);
    result = new DecimalDigitFilter(result);
    result = new StopFilter(result, stopwords);
    if (!stemExclusionSet.isEmpty())
        result = new SetKeywordMarkerFilter(result, stemExclusionSet);
    result = new SoraniStemFilter(result);
    return new TokenStreamComponents(source, result);
}
Also used : DecimalDigitFilter(org.apache.lucene.analysis.core.DecimalDigitFilter) TokenStream(org.apache.lucene.analysis.TokenStream) StandardTokenizer(org.apache.lucene.analysis.standard.StandardTokenizer) StopFilter(org.apache.lucene.analysis.StopFilter) SetKeywordMarkerFilter(org.apache.lucene.analysis.miscellaneous.SetKeywordMarkerFilter) StandardFilter(org.apache.lucene.analysis.standard.StandardFilter) Tokenizer(org.apache.lucene.analysis.Tokenizer) StandardTokenizer(org.apache.lucene.analysis.standard.StandardTokenizer) LowerCaseFilter(org.apache.lucene.analysis.LowerCaseFilter)

Example 8 with DecimalDigitFilter

use of org.apache.lucene.analysis.core.DecimalDigitFilter in project lucene-solr by apache.

the class SoraniAnalyzer method normalize.

@Override
protected TokenStream normalize(String fieldName, TokenStream in) {
    TokenStream result = new StandardFilter(in);
    result = new SoraniNormalizationFilter(result);
    result = new LowerCaseFilter(result);
    result = new DecimalDigitFilter(result);
    return result;
}
Also used : DecimalDigitFilter(org.apache.lucene.analysis.core.DecimalDigitFilter) TokenStream(org.apache.lucene.analysis.TokenStream) StandardFilter(org.apache.lucene.analysis.standard.StandardFilter) LowerCaseFilter(org.apache.lucene.analysis.LowerCaseFilter)

Example 9 with DecimalDigitFilter

use of org.apache.lucene.analysis.core.DecimalDigitFilter in project lucene-solr by apache.

the class PersianAnalyzer method createComponents.

/**
   * Creates
   * {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   * used to tokenize all the text in the provided {@link Reader}.
   * 
   * @return {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   *         built from a {@link StandardTokenizer} filtered with
   *         {@link LowerCaseFilter}, {@link DecimalDigitFilter}, {@link ArabicNormalizationFilter},
   *         {@link PersianNormalizationFilter} and Persian Stop words
   */
@Override
protected TokenStreamComponents createComponents(String fieldName) {
    final Tokenizer source = new StandardTokenizer();
    TokenStream result = new LowerCaseFilter(source);
    result = new DecimalDigitFilter(result);
    result = new ArabicNormalizationFilter(result);
    /* additional persian-specific normalization */
    result = new PersianNormalizationFilter(result);
    /*
     * the order here is important: the stopword list is normalized with the
     * above!
     */
    return new TokenStreamComponents(source, new StopFilter(result, stopwords));
}
Also used : DecimalDigitFilter(org.apache.lucene.analysis.core.DecimalDigitFilter) ArabicNormalizationFilter(org.apache.lucene.analysis.ar.ArabicNormalizationFilter) TokenStream(org.apache.lucene.analysis.TokenStream) StandardTokenizer(org.apache.lucene.analysis.standard.StandardTokenizer) StopFilter(org.apache.lucene.analysis.StopFilter) Tokenizer(org.apache.lucene.analysis.Tokenizer) StandardTokenizer(org.apache.lucene.analysis.standard.StandardTokenizer) LowerCaseFilter(org.apache.lucene.analysis.LowerCaseFilter)

Example 10 with DecimalDigitFilter

use of org.apache.lucene.analysis.core.DecimalDigitFilter in project lucene-solr by apache.

the class ThaiAnalyzer method createComponents.

/**
   * Creates
   * {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   * used to tokenize all the text in the provided {@link Reader}.
   * 
   * @return {@link org.apache.lucene.analysis.Analyzer.TokenStreamComponents}
   *         built from a {@link ThaiTokenizer} filtered with
   *         {@link LowerCaseFilter}, {@link DecimalDigitFilter} and {@link StopFilter}
   */
@Override
protected TokenStreamComponents createComponents(String fieldName) {
    final Tokenizer source = new ThaiTokenizer();
    TokenStream result = new LowerCaseFilter(source);
    result = new DecimalDigitFilter(result);
    result = new StopFilter(result, stopwords);
    return new TokenStreamComponents(source, result);
}
Also used : DecimalDigitFilter(org.apache.lucene.analysis.core.DecimalDigitFilter) TokenStream(org.apache.lucene.analysis.TokenStream) StopFilter(org.apache.lucene.analysis.StopFilter) Tokenizer(org.apache.lucene.analysis.Tokenizer) LowerCaseFilter(org.apache.lucene.analysis.LowerCaseFilter)

Aggregations

LowerCaseFilter (org.apache.lucene.analysis.LowerCaseFilter)10 TokenStream (org.apache.lucene.analysis.TokenStream)10 DecimalDigitFilter (org.apache.lucene.analysis.core.DecimalDigitFilter)10 StopFilter (org.apache.lucene.analysis.StopFilter)5 Tokenizer (org.apache.lucene.analysis.Tokenizer)5 StandardFilter (org.apache.lucene.analysis.standard.StandardFilter)4 StandardTokenizer (org.apache.lucene.analysis.standard.StandardTokenizer)4 SetKeywordMarkerFilter (org.apache.lucene.analysis.miscellaneous.SetKeywordMarkerFilter)3 ArabicNormalizationFilter (org.apache.lucene.analysis.ar.ArabicNormalizationFilter)2 IndicNormalizationFilter (org.apache.lucene.analysis.in.IndicNormalizationFilter)2