/// <summary> /// Construct the named stemming filter. /// /// Available stemmers are listed in <seealso cref="org.tartarus.snowball.ext"/>. /// The name of a stemmer is the part of the class name before "Stemmer", /// e.g., the stemmer in <seealso cref="org.tartarus.snowball.ext.EnglishStemmer"/> is named "English". /// </summary> /// <param name="in"> the input tokens to stem </param> /// <param name="name"> the name of a stemmer </param> public SnowballFilter(TokenStream @in, string name) : base(@in) { //Class.forName is frowned upon in place of the ResourceLoader but in this case, // the factory will use the other constructor so that the program is already loaded. try { Type stemClass = Type.GetType("org.tartarus.snowball.ext." + name + "Stemmer").asSubclass(typeof(SnowballProgram)); stemmer = stemClass.newInstance(); } catch (Exception e) { throw new System.ArgumentException("Invalid stemmer class specified: " + name, e); } }
public SnowballPorterFilter(TokenStream source, SnowballProgram stemmer, CharArraySet protWords) : base(source) { this.protWords = protWords; this.stemmer = stemmer; this.termAtt = (TermAttribute)addAttribute(typeof(TermAttribute)); }
public SnowballFilter(TokenStream input, SnowballProgram stemmer) : base(input) { this.stemmer = stemmer; }