/// <summary> /// Creates /// <see cref="TokenStreamComponents"/> /// used to tokenize all the text in the provided <see cref="TextReader"/>. /// </summary> /// <returns> <see cref="TokenStreamComponents"/> /// built from a <see cref="StandardTokenizer"/> filtered with /// <see cref="StandardFilter"/>, <see cref="LowerCaseFilter"/>, <see cref="ThaiWordFilter"/>, and /// <see cref="StopFilter"/> </returns> protected internal override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { if (m_matchVersion.OnOrAfter(LuceneVersion.LUCENE_48)) { Tokenizer source = new ThaiTokenizer(reader); TokenStream result = new LowerCaseFilter(m_matchVersion, source); result = new StopFilter(m_matchVersion, result, m_stopwords); return(new TokenStreamComponents(source, result)); } else { Tokenizer source = new StandardTokenizer(m_matchVersion, reader); TokenStream result = new StandardFilter(m_matchVersion, source); #pragma warning disable 612, 618 if (m_matchVersion.OnOrAfter(LuceneVersion.LUCENE_31)) #pragma warning restore 612, 618 { result = new LowerCaseFilter(m_matchVersion, result); } #pragma warning disable 612, 618 result = new ThaiWordFilter(m_matchVersion, result); #pragma warning restore 612, 618 return(new TokenStreamComponents(source, new StopFilter(m_matchVersion, result, m_stopwords))); } }
public override TokenStream TokenStream(String fieldName, TextReader reader) { TokenStream ts = new StandardTokenizer(matchVersion, reader); ts = new StandardFilter(ts); ts = new ThaiWordFilter(ts); ts = new StopFilter(StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion), ts, StopAnalyzer.ENGLISH_STOP_WORDS_SET); return ts; }
public override TokenStream TokenStream(String fieldName, TextReader reader) { TokenStream ts = new StandardTokenizer(matchVersion, reader); ts = new StandardFilter(ts); ts = new ThaiWordFilter(ts); ts = new StopFilter(StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion), ts, StopAnalyzer.ENGLISH_STOP_WORDS_SET); return(ts); }
/// <summary> /// Creates /// <seealso cref="org.apache.lucene.analysis.Analyzer.TokenStreamComponents"/> /// used to tokenize all the text in the provided <seealso cref="Reader"/>. /// </summary> /// <returns> <seealso cref="org.apache.lucene.analysis.Analyzer.TokenStreamComponents"/> /// built from a <seealso cref="StandardTokenizer"/> filtered with /// <seealso cref="StandardFilter"/>, <seealso cref="LowerCaseFilter"/>, <seealso cref="ThaiWordFilter"/>, and /// <seealso cref="StopFilter"/> </returns> public override TokenStreamComponents CreateComponents(string fieldName, TextReader reader) { if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_48)) { Tokenizer source = new ThaiTokenizer(reader); TokenStream result = new LowerCaseFilter(matchVersion, source); result = new StopFilter(matchVersion, result, stopwords); return(new TokenStreamComponents(source, result)); } else { Tokenizer source = new StandardTokenizer(matchVersion, reader); TokenStream result = new StandardFilter(matchVersion, source); if (matchVersion.OnOrAfter(LuceneVersion.LUCENE_31)) { result = new LowerCaseFilter(matchVersion, result); } result = new ThaiWordFilter(matchVersion, result); return(new TokenStreamComponents(source, new StopFilter(matchVersion, result, stopwords))); } }