private void AddSuffix(SuffixDictionaryLine entry, Dictionary <string, Suffix> suffixesById, MorphemeSurfaceDictionary <Suffix> suffixes) { string id = entry.Id; string lex = entry.Lex; MorphemeType morphemeType; if (!Enum.TryParse(entry.Type, out morphemeType)) { morphemeType = MorphemeType.O; Console.WriteLine("Invalid Morpheme Type: " + entry.Type); } string[] flags = entry.Flags.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); string[] rulesToken = entry.Rules.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); Debug.Assert(entry.Surfaces != null, "entry.Surfaces != null"); var surfaces = new List <string>(entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)); List <OrthographyRule> rules = _orthography.GetRules(rulesToken); var suffix = new Suffix(id, lex, morphemeType, LabelSet.ConvertLabelNamesToIndexes(flags), rules); suffixesById.Add(id, suffix); foreach (string surface in surfaces) { suffixes.Add(surface, suffix); } }
private void AddRoots(RootLine entry, MorphemeSurfaceDictionary <Root> roots) { string item = entry.Root; string[] surfaces = entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); string lex = entry.Lex; string[] flags = entry.Flags.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); string type = entry.Id; string[] rules = entry.Rules.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries); if (string.IsNullOrEmpty(entry.Lex)) { lex = item; } Root root; if (type == "KISALTMA" || type == "ALINTI" || type == "KISALTMA_NOKTALI" || type == "HARF") { root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules), item); } else { root = new Root(type, lex, LabelSet.ConvertLabelNamesToIndexes(flags), _orthography.GetRules(rules)); } roots.Add(item, root); // kelimeyi asıl yüzeyi ile ekliyoruz //eğer fazladan yüzeyi var ise onunla da ekliyoruz. foreach (string lexicalForm in surfaces) { roots.Add(lexicalForm, root); } }