public void morphologicalAnalysisIsPortmanteau()
        {
            TxtDictionary dictionary = fsm.GetDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                var word = (TxtWord)dictionary.GetWord(i);
                if (word.IsNominal() && word.IsPortmanteau() && !word.IsPlural() &&
                    !word.IsPortmanteauFacedVowelEllipsis())
                {
                    var    transitionState = new State("CompoundNounRoot", true, false);
                    var    startState = new State("CompoundNounRoot", true, false);
                    var    transition = new Transition(transitionState, "lArH", "A3PL+P3PL");
                    string rootForm, surfaceForm, exceptLast2, exceptLast;
                    exceptLast2 = word.GetName().Substring(0, word.GetName().Length - 2);
                    exceptLast  = word.GetName().Substring(0, word.GetName().Length - 1);
                    if (word.IsPortmanteauFacedSoftening())
                    {
                        switch (word.GetName()[word.GetName().Length - 2])
                        {
                        case 'b':
                            rootForm = exceptLast2 + 'p';
                            break;

                        case 'c':
                            rootForm = exceptLast2 + 'ç';
                            break;

                        case 'd':
                            rootForm = exceptLast2 + 't';
                            break;

                        case 'ğ':
                            rootForm = exceptLast2 + 'k';
                            break;

                        default:
                            rootForm = exceptLast;
                            break;
                        }
                    }
                    else
                    {
                        if (word.IsPortmanteauEndingWithSI())
                        {
                            rootForm = exceptLast2;
                        }
                        else
                        {
                            rootForm = exceptLast;
                        }
                    }

                    surfaceForm = transition.MakeTransition(word, rootForm, startState);
                    Assert.True(fsm.MorphologicalAnalysis(surfaceForm).Size() != 0);
                }
            }
        }
        public void morphologicalAnalysisProperNoun()
        {
            TxtDictionary dictionary = fsm.GetDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                var word = (TxtWord)dictionary.GetWord(i);
                if (word.IsProperNoun())
                {
                    Assert.True(fsm.MorphologicalAnalysis(word.GetName().ToUpper(new CultureInfo("tr"))).Size() != 0);
                }
            }
        }
        public void morphologicalAnalysisVowelAChangesToIDuringYSuffixation()
        {
            TxtDictionary dictionary = fsm.GetDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                var word = (TxtWord)dictionary.GetWord(i);
                if (word.IsVerb() && word.VowelAChangesToIDuringYSuffixation())
                {
                    var    transitionState = new State("VerbalStem", false, false);
                    var    startState      = new State("VerbalRoot", true, false);
                    var    transition      = new Transition(transitionState, "Hyor", "PROG1");
                    string surfaceForm     = transition.MakeTransition(word, word.GetName(), startState);
                    Assert.True(fsm.MorphologicalAnalysis(surfaceForm).Size() != 0);
                }
            }
        }
        public void morphologicalAnalysisNounSoftenDuringSuffixation()
        {
            TxtDictionary dictionary = fsm.GetDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                var word = (TxtWord)dictionary.GetWord(i);
                if (word.IsNominal() && word.NounSoftenDuringSuffixation())
                {
                    var    transitionState = new State("Possessive", false, false);
                    var    startState      = new State("NominalRoot", true, false);
                    var    transition      = new Transition(transitionState, "yH", "ACC");
                    string surfaceForm     = transition.MakeTransition(word, word.GetName(), startState);
                    Assert.True(fsm.MorphologicalAnalysis(surfaceForm).Size() != 0);
                }
            }
        }
        public void morphologicalAnalysisLastIdropsDuringPassiveSuffixation()
        {
            TxtDictionary dictionary = fsm.GetDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                var word = (TxtWord)dictionary.GetWord(i);
                if (word.IsVerb() && word.LastIdropsDuringPassiveSuffixation())
                {
                    var    transitionState = new State("VerbalStem", false, false);
                    var    startState      = new State("VerbalRoot", true, false);
                    var    transition      = new Transition(transitionState, "Hl", "^DB+VERB+PASS");
                    string surfaceForm     = transition.MakeTransition(word, word.GetName(), startState);
                    Assert.True(fsm.MorphologicalAnalysis(surfaceForm).Size() != 0);
                }
            }
        }
        public void Setup()
        {
            simpleTrie = new Trie();
            simpleTrie.AddWord("azı", new Word("azı"));
            simpleTrie.AddWord("az", new Word("az"));
            simpleTrie.AddWord("ad", new Word("ad"));
            simpleTrie.AddWord("adi", new Word("adi"));
            simpleTrie.AddWord("adil", new Word("adil"));
            simpleTrie.AddWord("a", new Word("a"));
            simpleTrie.AddWord("adilane", new Word("adilane"));
            simpleTrie.AddWord("ısı", new Word("ısı"));
            simpleTrie.AddWord("ısıtıcı", new Word("ısıtıcı"));
            simpleTrie.AddWord("ölü", new Word("ölü"));
            simpleTrie.AddWord("ölüm", new Word("ölüm"));
            simpleTrie.AddWord("ören", new Word("ören"));
            simpleTrie.AddWord("örgü", new Word("örgü"));
            complexTrie = new Trie();
            var dictionary = new TxtDictionary();

            for (var i = 0; i < dictionary.Size(); i++)
            {
                complexTrie.AddWord(dictionary.GetWord(i).GetName(), dictionary.GetWord(i));
            }
        }
 public TurkishNNTranslator(ParseNodeDrawable parseNode, List <string> parentList, List <string> englishWordList,
                            string prefix, string lastWordForm, TxtWord lastWord, TxtDictionary txtDictionary) : base(parseNode,
                                                                                                                      parentList, englishWordList, prefix, lastWordForm, lastWord, txtDictionary)
 {
 }
Example #8
0
 public void SetUp()
 {
     dictionary = new TxtDictionary();
 }
 public void SetUp()
 {
     dictionary          = new TxtDictionary();
     lowerCaseDictionary = new TxtDictionary("../../../lowercase.txt", new TurkishWordComparator());
     mixedCaseDictionary = new TxtDictionary("../../../mixedcase.txt", new TurkishIgnoreCaseWordComparator());
 }
Example #10
0
 public TurkishCDTranslator(ParseNodeDrawable parseNode, List <string> parentList, List <string> englishWordList,
                            string prefix, string lastWordForm, TxtWord lastWord, bool withDigits, TxtDictionary txtDictionary) : base(
         parseNode, parentList, englishWordList, prefix, lastWordForm, lastWord, txtDictionary)
 {
     this.withDigits = withDigits;
 }