Exemple #1
0
 /// <summary> Builds an analyzer which removes words in ENGLISH_STOP_WORDS.</summary>
 public StopAnalyzer(Version matchVersion)
 {
     stopWords = ENGLISH_STOP_WORDS_SET;
     useDefaultStopPositionIncrement = false;
     enablePositionIncrements        = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
 }
Exemple #2
0
 /// <summary>Builds an analyzer with the stop words from the given reader. </summary>
 /// <seealso cref="WordlistLoader.GetWordSet(Reader)">
 /// </seealso>
 /// <param name="matchVersion">See <a href="#Version">above</a>
 /// </param>
 /// <param name="stopwords">Reader to load stop words from
 /// </param>
 public StopAnalyzer(Version matchVersion, System.IO.TextReader stopwords)
 {
     stopWords = WordlistLoader.GetWordSet(stopwords);
     this.enablePositionIncrements   = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
     useDefaultStopPositionIncrement = false;
 }
Exemple #3
0
 /// <summary>Builds an analyzer with the stop words from the given set.</summary>
 public StopAnalyzer(Version matchVersion, System.Collections.Hashtable stopWords)
 {
     this.stopWords = stopWords;
     useDefaultStopPositionIncrement = false;
     enablePositionIncrements        = StopFilter.GetEnablePositionIncrementsVersionDefault(matchVersion);
 }
Exemple #4
0
 public StopAnalyzer(System.String[] stopWords, bool enablePositionIncrements)
 {
     this.stopWords = StopFilter.MakeStopSet(stopWords);
     this.enablePositionIncrements   = enablePositionIncrements;
     useDefaultStopPositionIncrement = false;
 }
Exemple #5
0
		/// <summary>Constructs a {@link StandardTokenizer} filtered by a {@link
		/// StandardFilter}, a {@link LowerCaseFilter} and a {@link StopFilter}. 
		/// </summary>
		public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
		{
			StandardTokenizer tokenStream = new StandardTokenizer(reader, replaceInvalidAcronym);
			tokenStream.SetMaxTokenLength(maxTokenLength);
			TokenStream result = new StandardFilter(tokenStream);
			result = new LowerCaseFilter(result);
			if (useDefaultStopPositionIncrements)
			{
				result = new StopFilter(result, stopSet);
			}
			else
			{
				result = new StopFilter(enableStopPositionIncrements, result, stopSet);
			}
			return result;
		}