19 using System.Collections.Generic;
21 using System.Collections;
23 using Lucene.Net.Analysis;
25 using Lucene.Net.Support.Compatibility;
27 namespace Lucene.Net.Analysis.AR
55 public static string DEFAULT_STOPWORD_FILE =
"ArabicStopWords.txt";
60 private readonly ISet<string> stoptable;
65 [Obsolete(
"Use WordListLoader.GetWordSet(FileInfo, string) directly")]
66 public static string STOPWORDS_COMMENT =
"#";
72 public static ISet<string> GetDefaultStopSet()
74 return DefaultSetHolder.DEFAULT_STOP_SET;
77 private static class DefaultSetHolder
79 internal static ISet<string> DEFAULT_STOP_SET;
81 static DefaultSetHolder()
85 DEFAULT_STOP_SET = LoadDefaultStopWordSet();
87 catch (System.IO.IOException)
91 throw new Exception(
"Unable to load default stopword set");
95 internal static ISet<string> LoadDefaultStopWordSet()
97 using (StreamReader reader =
new StreamReader(System.Reflection.Assembly.GetAssembly(typeof(ArabicAnalyzer)).GetManifestResourceStream(
"Lucene.Net.Analysis.AR." + DEFAULT_STOPWORD_FILE)))
110 : this(matchVersion, DefaultSetHolder.DEFAULT_STOP_SET)
122 this.matchVersion = matchVersion;
128 [Obsolete(
"Use ArabicAnalyzer(Version, Set) instead")]
130 : this(matchVersion,
StopFilter.MakeStopSet(stopwords))
137 [Obsolete(
"Use ArabicAnalyzer(Version, Set) instead")]
139 : this(matchVersion, stopwords.Keys.ToArray())
147 : this(matchVersion,
WordlistLoader.GetWordSet(stopwords, STOPWORDS_COMMENT))
171 private class SavedStreams
185 public override TokenStream ReusableTokenStream(
string fieldName, TextReader reader)
187 SavedStreams streams = (SavedStreams)PreviousTokenStream;
190 streams =
new SavedStreams();
195 streams.Result, stoptable);
198 PreviousTokenStream = streams;
202 streams.Source.Reset(reader);
204 return streams.Result;