protected internal virtual void copy_from(SpanishStemmer other) { I_p2 = other.I_p2; I_p1 = other.I_p1; I_pV = other.I_pV; base.copy_from(other); }
private void copy_from(SpanishStemmer other) { I_p2 = other.I_p2; I_p1 = other.I_p1; I_pV = other.I_pV; base.CopyFrom(other); }
public void Spanish_BaseTest() { var stemmer = new SpanishStemmer(); Assert.AreEqual("acerqu", stemmer.Stem("acerquen")); Assert.AreEqual("Vision", stemmer.Stem("Visionado")); Assert.AreEqual("algu", stemmer.Stem("algue")); }
private TokenStream SpanishSteammer(TokenStream tokenStream) { //Obtener en una cadena cada token y aplicar el lematizador a cada término string term = string.Empty; IStemmer stemmer = new SpanishStemmer(); TokenStream tokenStreamtemp; var termAttr = tokenStream.GetAttribute <ITermAttribute>(); while (tokenStream.IncrementToken()) { term = term + " " + stemmer.Stem(termAttr.Term); } tokenStreamtemp = new StandardTokenizer(Version.LUCENE_30, new System.IO.StringReader(term)); return(tokenStreamtemp); // }
public TokenStream SpanishSteammer(TokenStream tokenStream) { //Obtener en una cadena cada token y aplicar el lematizador a cada término string term = string.Empty; IStemmer stemmer = new SpanishStemmer(); TokenStream tokenStreamtemp; //var termAttr = tokenStream.GetAttribute<ITermAttribute>(); string cadena = ""; string[] token; Lucene.Net.Analysis.Token current; while ((current = tokenStream.Next()) != null) { cadena = current.ToString(); token = cadena.Split(','); cadena = cadena.Substring(1, token[0].Length - 1); term = term + " " + stemmer.Stem(cadena); } tokenStreamtemp = new StandardTokenizer(new System.IO.StringReader(term)); return(tokenStreamtemp); // }
private void copy_from(SpanishStemmer other) { I_p2 = other.I_p2; I_p1 = other.I_p1; I_pV = other.I_pV; base.copy_from(other); }
/// <summary> /// 获取词干对象(线程不安全) /// </summary> /// <param name="language"></param> /// <returns></returns> //public static SnowballProgram GetSnowball(string language) //{ // if (_dictSnowball.ContainsKey(language)) // return _dictSnowball[language]; // return null; //} /// <summary> /// 获取词干对象(线程安全) /// </summary> /// <param name="language"></param> /// <returns></returns> public static SnowballProgram GetSnowball(string language) { SnowballProgram result = null; switch (language) { case "DA": result = new DanishStemmer(); break; //丹麦语 case "NL": result = new DutchStemmer(); break; //荷兰语 case "EN": result = new EnglishStemmer(); break; //英语 case "FI": result = new FinnishStemmer(); break; //芬兰语 case "FR": result = new FrenchStemmer(); break; //法语 case "DE2": result = new German2Stemmer(); break; //德语2 case "DE": result = new GermanStemmer(); break; //德语 case "HU": result = new HungarianStemmer(); break; case "IT": result = new ItalianStemmer(); break; case "文斯语": result = new LovinsStemmer(); break; case "NO": result = new NorwegianStemmer(); break; case "波特语": result = new PorterStemmer(); break; //英语的 case "PT": result = new PortugueseStemmer(); break; //葡萄牙语 case "RO": result = new RomanianStemmer(); break; case "RU": result = new RussianStemmer(); break; //俄语 case "ES": result = new SpanishStemmer(); break; //西班牙语 case "SV": result = new SwedishStemmer(); break; case "TR": result = new TurkishStemmer(); break; //土耳其语 } return(result); }
} // End of the GetCurrentDomain method /// <summary> /// Get the stemmer based on the language /// </summary> /// <param name="language">A reference to the language</param> /// <returns>A reference to a Stemmer</returns> public static Stemmer GetStemmer(Language language) { // Create a default stemmer Stemmer stemmer = new DefaultStemmer(); // Get the language code in lower case string language_code = language.language_code.ToLower(); // Get a stemmer depending on the language if (language_code == "da") { stemmer = new DanishStemmer(); } else if (language_code == "nl") { stemmer = new DutchStemmer(); } else if (language_code == "en") { stemmer = new EnglishStemmer(); } else if (language_code == "fi") { stemmer = new FinnishStemmer(); } else if (language_code == "fr") { stemmer = new FrenchStemmer(); } else if (language_code == "de") { stemmer = new GermanStemmer(); } else if (language_code == "it") { stemmer = new ItalianStemmer(); } else if (language_code == "no") { stemmer = new NorwegianStemmer(); } else if (language_code == "pt") { stemmer = new PortugueseStemmer(); } else if (language_code == "ro") { stemmer = new RomanianStemmer(); } else if (language_code == "es") { stemmer = new SpanishStemmer(); } else if (language_code == "sv") { stemmer = new SwedishStemmer(); } // Return the stemmer return stemmer; } // End of the GetStemmer method