public static void ExportUsedWords() { foreach (var courseLang in crsLangs) { var fn = string.Format(@"d:\LMCom\rew\Web4\RwDicts\UsedWords\CourseWordsFlat_{0}.txt", courseLang); File.WriteAllLines(fn, LingeaDictionary.wordsForCourse(XmlUtils.FileToObject <schools.DictCrsWords>(string.Format(@"d:\LMCom\rew\Web4\RwDicts\UsedWords\CourseWords_{0}.xml", courseLang))).Select(w => w.word.ToLower().Trim()).OrderBy(w => w).Distinct() ); } }
public static void RunStemming() { using (var imp = new Impersonator("pavel", "LANGMaster", "zvahov88_")) RunStemming <List <string> >( crsLangs, lng => LingeaDictionary.wordsForCourse(XmlUtils.FileToObject <schools.DictCrsWords>(string.Format(@"d:\LMCom\rew\Web4\RwDicts\UsedWords\CourseWords_{0}.xml", lng))).Select(w => w.word.ToLower().Trim()).Distinct().ToArray(), lng => new List <string>(), (lng, word, row, res) => res.Add(row.AgregateSB((sb, i) => { sb.Append("|"); sb.Append(i); })), (lng, res) => File.WriteAllLines(string.Format(@"d:\LMCom\rew\Web4\RwDicts\UsedWords\CourseWordsStems_{0}.txt", lng), res), imp ); }
public static void exportWordTypes() { //KDict var items = DictK.Lib.readDict().SelectMany(en => en.dictEntries).SelectMany(de => de.descendants()); File.WriteAllLines(@"d:\temp\kdict.txt", items.OfType <DictK.MPartOfSpeech>().Select(p => p.content).Distinct().OrderBy(w => w)); //UltraLingua var ulDicts = DictLib.allDicts(@"d:\LMCom\rew\Web4\RwDicts\Sources\Ultralingua.back\", "dict_").Select(d => Ultralingua.Lib.readDict(d)); File.WriteAllLines(@"d:\temp\UltraLingua.txt", ulDicts.SelectMany(dict => dict.Entries.SelectMany(en => en.Body.DescendantsAttr("class", "partofspeech").Select(e => e.Value))).Distinct().OrderBy(w => w)); //Lingea var lingDicts = DictLib.allDicts(@"d:\LMCom\rew\Web4\RwDicts\Sources\LingeaOld\").Select(d => LingeaDictionary.readDict(d)); File.WriteAllLines(@"d:\temp\lingea.txt", lingDicts.SelectMany(dict => dict.entries.SelectMany(en => en.entry.DescendantsAttr("class", "morf").Select(e => e.Value))).Distinct().OrderBy(w => w)); //Wiki var wikiDicts = DictLib.allDicts(@"d:\LMCom\rew\Web4\RwDicts\Sources\Wiktionary\", "dict_").Select(d => Wikdionary.Lib.readDict(d)); File.WriteAllLines(@"d:\temp\wiki.txt", wikiDicts.SelectMany(dict => dict.entries.SelectMany(en => en.entry.DescendantsAttr("class", "morf").Select(e => e.Value))).Distinct().OrderBy(w => w)); //RJ var rjDicts = DictLib.allDicts(@"d:\LMCom\rew\Web4\RwDicts\Sources\RJ\").Select(d => DictLib.readDict(@"d:\LMCom\rew\Web4\RwDicts\Sources\RJ\", d)); File.WriteAllLines(@"d:\temp\rj.txt", rjDicts.SelectMany(dict => dict.entries.SelectMany(en => en.entry.DescendantsAttr("class", "morf").Select(e => e.Value))).Distinct().OrderBy(w => w)); }