private static IDictionary <string, string> CreateStemMapFile() { var words = File.ReadAllLines(WordListPath, Encoding.UTF8); var map = Stems.Stem(words); var list = map.Select(x => x.Key + "\t" + x.Value); File.WriteAllLines(StemMapPath, list, Encoding.UTF8); return(map); }
private static void Process( bool addNewWords = false, bool createStemMapFile = false, bool generateDictionary = false, bool runTests = false) { var sw = new Stopwatch(); sw.Start(); if (addNewWords) { if (AddNewWordsToWordList()) { Console.WriteLine(@"New Word List Constructed: " + sw.Elapsed); } else { Console.WriteLine(@"undefined words in word list. Aborting..."); return; } } //Analyze and stem all the words from start or just use the created stems var wordStemMap = createStemMapFile ? CreateStemMapFile() : Stems.FromDictionary(StemMapPath); Console.WriteLine(@"Stem Map Constructed: " + sw.Elapsed); if (generateDictionary) { DictionaryGenerator.Generate(wordStemMap, DictDirectoryPath + "tr-TR", langCode: "tr-TR"); Console.WriteLine(@"Dictionary Generated: " + sw.Elapsed); } if (runTests) { HunspellHelper.RunTests(); } }
private static void GenerateTestDictionary() { var map = Stems.FromDictionary(DataDir + "stemMapTest.txt"); DictionaryGenerator.Generate(map, DictDirectoryPath + @"test", "test"); }