Exemple #1
0
			internal CharArraySetIterator(CharArraySet enclosingInstance)
			{
				InitBlock(enclosingInstance);
				GoNext();
			}
Exemple #2
0
		/// <summary> Returns an unmodifiable {@link CharArraySet}. This allows to provide
		/// unmodifiable views of internal sets for "read-only" use.
		/// 
		/// </summary>
		/// <param name="set">a set for which the unmodifiable set is returned.
		/// </param>
		/// <returns> an new unmodifiable {@link CharArraySet}.
		/// </returns>
		/// <throws>  NullPointerException </throws>
		/// <summary>           if the given set is <code>null</code>.
		/// </summary>
		public static CharArraySet UnmodifiableSet(CharArraySet set_Renamed)
		{
			if (set_Renamed == null)
				throw new System.NullReferenceException("Given set is null");
			/*
			* Instead of delegating calls to the given set copy the low-level values to
			* the unmodifiable Subclass
			*/
			return new UnmodifiableCharArraySet(set_Renamed.entries, set_Renamed.ignoreCase, set_Renamed.count);
		}
Exemple #3
0
			private void  InitBlock(CharArraySet enclosingInstance)
			{
				this.enclosingInstance = enclosingInstance;
			}
Exemple #4
0
		public StopFilter(bool enablePositionIncrements, TokenStream in_Renamed, System.String[] stopWords, bool ignoreCase):base(in_Renamed)
		{
			this.stopWords = (CharArraySet) MakeStopSet(stopWords, ignoreCase);
			this.enablePositionIncrements = enablePositionIncrements;
			Init();
		}
Exemple #5
0
		/// <summary> </summary>
		/// <param name="stopWords">A List of Strings representing the stopwords
		/// </param>
		/// <param name="ignoreCase">if true, all words are lower cased first
		/// </param>
		/// <returns> A Set containing the words
		/// </returns>
		public static System.Collections.Hashtable MakeStopSet(System.Collections.IList stopWords, bool ignoreCase)
		{
			CharArraySet stopSet = new CharArraySet(stopWords.Count, ignoreCase);
			stopSet.AddAll(stopWords);
			return stopSet;
		}
Exemple #6
0
		/// <summary> </summary>
		/// <param name="stopWords">An array of stopwords
		/// </param>
		/// <param name="ignoreCase">If true, all words are lower cased first.  
		/// </param>
		/// <returns> a Set containing the words
		/// </returns>
		public static System.Collections.Hashtable MakeStopSet(System.String[] stopWords, bool ignoreCase)
		{
			CharArraySet stopSet = new CharArraySet(stopWords.Length, ignoreCase);
			stopSet.AddAll(new System.Collections.ArrayList(stopWords));
			return stopSet;
		}
Exemple #7
0
		/// <summary> Construct a token stream filtering the given input.
		/// If <code>stopWords</code> is an instance of {@link CharArraySet} (true if
		/// <code>makeStopSet()</code> was used to construct the set) it will be directly used
		/// and <code>ignoreCase</code> will be ignored since <code>CharArraySet</code>
		/// directly controls case sensitivity.
		/// <p/>
		/// If <code>stopWords</code> is not an instance of {@link CharArraySet},
		/// a new CharArraySet will be constructed and <code>ignoreCase</code> will be
		/// used to specify the case sensitivity of that set.
		/// 
		/// </summary>
		/// <param name="enablePositionIncrements">true if token positions should record the removed stop words
		/// </param>
		/// <param name="input">Input TokenStream
		/// </param>
		/// <param name="stopWords">The set of Stop Words.
		/// </param>
		/// <param name="ignoreCase">-Ignore case when stopping.
		/// </param>
		public StopFilter(bool enablePositionIncrements, TokenStream input, System.Collections.Hashtable stopWords, bool ignoreCase):base(input)
		{
			if (stopWords is CharArraySet)
			{
				this.stopWords = (CharArraySet) stopWords;
			}
			else
			{
				this.stopWords = new CharArraySet(stopWords.Count, ignoreCase);
				this.stopWords.Add(stopWords);
			}
			this.enablePositionIncrements = enablePositionIncrements;
			Init();
		}
Exemple #8
0
		static StopAnalyzer()
		{
			{
				System.String[] stopWords = new System.String[]{"a", "an", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"};
				CharArraySet stopSet = new CharArraySet(stopWords.Length, false);
				stopSet.AddAll(new System.Collections.ArrayList(stopWords));
				ENGLISH_STOP_WORDS_SET = CharArraySet.UnmodifiableSet(stopSet);
			}
		}