Пример #1
0
        public void testAsciiCozumle1()
        {
            string[] actual   = zemberek.asciidenTurkceye("dugumsuzlukmus");
            string   expected = "düðümsüzlükmüþ";

            Assert.AreEqual(1, actual.Length);
            Assert.AreEqual(expected, actual[0]);
        }
Пример #2
0
        private string filtering(string Astr)
        {
            string   filtered    = "";
            string   checkedword = "";
            Zemberek filter      = new Zemberek(new TurkiyeTurkcesi());

            Astr = Normalize(Astr);
            foreach (string word in Astr.Split(' '))
            {
                if (filter.kelimeDenetle(word))
                {
                    checkedword = word;
                }
                else
                {
                    String[] suggestions = filter.asciidenTurkceye(word);
                    if (suggestions.Length > 0)
                    {
                        checkedword = suggestions[0];
                    }
                    else
                    {
                        try
                        {
                            suggestions = filter.oner(word);
                        }
                        catch (System.NullReferenceException ex)
                        {
                            adderrorlog(ex.Message);
                        }

                        if (suggestions.Length > 0)
                        {
                            checkedword = suggestions[0];
                        }
                        else
                        {
                            fresidue += word + " ";
                        }
                    }
                }
                Kelime[] solutions = filter.kelimeCozumle(checkedword);
                foreach (Kelime solution in solutions)
                {
                    if (!filtered.Contains(solution.kok().icerik()))
                    {
                        filtered += solution.kok().icerik() + " ";
                    }
                }
            }
            return(filtered);
        }