Exemple #1
0
 private static void SaveMyStemWords()
 {
     var vocabulary = new Vocabulary(Program.QuestionsFileName, Program.AnswersFileName);
     var stemToWord = new Dictionary<string, List<string>>();
     foreach (var stemInfo in vocabulary.GetWordInfos())
     {
         if (stemToWord.ContainsKey(stemInfo.Value.Stem))
         {
             stemToWord[stemInfo.Value.Stem].Add(stemInfo.Key);
         }
         else
         {
             stemToWord.Add(stemInfo.Value.Stem, new List<string>());
         }
     }
     File.WriteAllText("MyStem.txt", String.Join("\n", stemToWord.Select(kv => String.Join(" ", kv.Value))));
 }
Exemple #2
0
 public MyStemmer(params string[] fileNames)
 {
     vocabulary = new Vocabulary(fileNames);
 }
Exemple #3
0
 public MyStemmer(string uniqueSampleName, IEnumerable<string> words)
 {
     File.WriteAllLines(uniqueSampleName, words, Encoding.GetEncoding(1251));
     vocabulary = new Vocabulary(uniqueSampleName);
 }
Exemple #4
0
 public Symptoms(Vocabulary vocabulary, IEnumerable<string> mainWords, string neededPartOfSpeech, int radius = 2)
 {
     this.vocabulary = vocabulary;
     this.neededPartOfSpeech = neededPartOfSpeech;
     this.radius = radius;
     this.mainWords = new HashSet<string>(mainWords);
 }