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); } }
private void Add(RootEntry entry) { var rules = Orthography.GetRules(entry.Rules); var root = new Root(entry.Pos, entry.Lex, entry.Surfaces, entry.Labels, rules); Roots.ById.Add(entry.Id, root); foreach (string surface in entry.Surfaces) { Roots.BySurface.Add(surface, root); } }
private void AddRoots(RootLine entry, Dictionary<string, Root> rootsById, MorphemeSurfaceDictionary<Root> rootsBySurface) { var mainSurface = entry.Root; var surfaces = new List<string> {mainSurface}; surfaces.AddRange(entry.Surfaces.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries)); var lex = entry.Lex; var labels = entry.Labels.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries); var pos = entry.Pos; var rules = entry.Rules.Split(new[] {',', ' '}, StringSplitOptions.RemoveEmptyEntries).ToList(); if (Regex.IsMatch(lex, @"\p{L}[2-9]")) { rules.Add("DROP_ID_DIGIT"); } if (string.IsNullOrEmpty(entry.Lex)) { lex = mainSurface; } var root = new Root(pos, lex, new ImmutableSortedSet<string>(surfaces), new ImmutableHashSet<string>(labels), _orthography.GetRules(rules)); var id = lex + "/" + pos; if (!rootsById.ContainsKey(id)) { rootsById.Add(id, root); } else { Trace.TraceEvent(TraceEventType.Warning, 0, $"Duplicate root: {id}"); } foreach (var lexicalForm in surfaces) { rootsBySurface.Add(lexicalForm, root); } }
public string Conjugate(Root verbRoot, bool negative, bool question) { var copy = Word.CopyOf(verb); copy.Root = verbRoot; if (negative) { copy.AddSuffixAfterRoot(Negative); } if (question) { } return copy.GetSurface(); }
public string Conjugate(Root verbRoot) { var copy = Word.CopyOf(verb); copy.Root = verbRoot; return copy.GetSurface(); }
public string Conjugate(Root verbRoot) { var copy = new Word(verb) {Root = verbRoot}; return copy.GetSurface(); }