Ejemplo n.º 1
0
        public bool TryAdd(RootEntry entry)
        {
            if (Roots.ById.ContainsKey(entry.Id))
            {
                return false;
            }

            Add(entry);

            return true;
        }
Ejemplo n.º 2
0
        public bool TryAdd(RootEntry entry)
        {
            if (Roots.ById.ContainsKey(entry.Id))
            {
                return(false);
            }

            Add(entry);

            return(true);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
        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);
            }
        }
Ejemplo n.º 5
0
        public void Test()
        {
            var tr = LanguageFactory.Create(LanguageType.Turkish);
            var newTr = MutableLanguage.CopyFrom(tr);

            var entry = new RootEntry(
                lex: "başa gel",
                pos: "FIIL",
                surfaces: new[] {"başa gel"},
                labels: new[] {"cverb"},
                rules: Enumerable.Empty<string>());

            Assert.True(newTr.TryAdd(entry));

            var solutions = tr.Analyze("başa gelen");

            Assert.AreEqual(0, solutions.Count);

            var solutionsExtendedTr = newTr.Analyze("başa gelen");

            Assert.AreEqual(1, solutionsExtendedTr.Count);

            Assert.AreEqual("başa gel/FIIL FIILIMSI_SIFAT_(y)An", solutionsExtendedTr[0].Analysis);
        }