コード例 #1
0
    def softenDuringSuffixation(self, root: TxtWord) -> bool:
        """
        The startWithVowelorConsonantDrops method checks for some cases. If the first character of with variable is
        "nsy", and with variable does not equal to one of the Strings; "ylA, ysA, ymHs, yDH, yken", it returns true. If

        Or, if the first character of with variable is 'A, H: or any other vowels, it returns true.

        RETURNS
        -------
        bool
            True if it starts with vowel or consonant drops, false otherwise.
        """
        if (root.isNominal() or root.isAdjective()) and root.nounSoftenDuringSuffixation() and \
                (self.__with == "Hm" or self.__with == "nDAn" or self.__with == "ncA" or self.__with == "nDA"
                 or self.__with == "yA" or self.__with == "yHm" or self.__with == "yHz" or self.__with == "yH"
                 or self.__with == "nH" or self.__with == "nA" or self.__with == "nHn" or self.__with == "H"
                 or self.__with == "sH" or self.__with == "Hn" or self.__with == "HnHz" or self.__with == "HmHz"):
            return True
        if root.isVerb() and root.verbSoftenDuringSuffixation() and \
                (self.__with.startswith("Hyor") or self.__with == "yHs" or self.__with == "yAn" or self.__with == "yA"
                 or self.__with == "yAcAk" or self.__with == "yAsH" or self.__with == "yHncA" or self.__with == "yHp"
                 or self.__with == "yAlH" or self.__with == "yArAk" or self.__with == "yAdur" or self.__with == "yHver"
                 or self.__with == "yAgel" or self.__with == "yAgor" or self.__with == "yAbil" or self.__with == "yAyaz"
                 or self.__with == "yAkal" or self.__with == "yAkoy" or self.__with == "yAmA" or self.__with == "yHcH"
                 or self.__with == "yHs" or self.__with == "HCH" or self.__with == "Hr" or self.__with == "Hs"
                 or self.__with == "Hn" or self.__with == "yHn" or self.__with == "yHnHz" or self.__with == "Ar"
                 or self.__with == "Hl"):
            return True
        return False
コード例 #2
0
 def makeTransitionNoStartState(self, root: TxtWord, stem: str) -> str:
     if root.isVerb():
         return self.makeTransition(root, stem,
                                    State("VerbalRoot", True, False))
     else:
         return self.makeTransition(root, stem,
                                    State("NominalRoot", True, False))
コード例 #3
0
    def addWithFlag(self, name: str, flag: str) -> bool:
        """
        The addWithFlag method takes a String name and a flag as inputs. First it creates a TxtWord word, then if
        given name is not in words list it creates new TxtWord with given name and assigns it to
        the word and adds given flag to the word, it also add newly created word to the words list's index
        found by performing a binary search and return true at the end. If given name is in words list,
        it adds it the given flag to the word.

        PARAMETERS
        ----------
        name : str
            String input.
        flag : str
            String flag.

        RETURNS
        -------
        bool
            true if given name is in words list, false otherwise.
        """
        if self.getWord(name.lower()) is None:
            word = TxtWord(name.lower())
            word.addFlag(flag)
            middle = bisect_left(self.words, word)
            self.words.insert(middle, word)
            return True
        else:
            word = self.getWord(name.lower())
            if isinstance(word, TxtWord) and not word.containsFlag(flag):
                word.addFlag(flag)
        return False
コード例 #4
0
 def softenDuringSuffixation(self, root: TxtWord) -> bool:
     if (root.isNominal() or root.isAdjective()) and root.nounSoftenDuringSuffixation() and \
             (self.__with == "Hm" or self.__with == "nDAn" or self.__with == "ncA" or self.__with == "nDA"
              or self.__with == "yA" or self.__with == "yHm" or self.__with == "yHz" or self.__with == "yH"
              or self.__with == "nH" or self.__with == "nA" or self.__with == "nHn" or self.__with == "H"
              or self.__with == "sH" or self.__with == "Hn" or self.__with == "HnHz" or self.__with == "HmHz"):
         return True
     if root.isVerb() and root.verbSoftenDuringSuffixation() and \
             (self.__with.startswith("Hyor") or self.__with == "yHs" or self.__with == "yAn" or self.__with == "yA"
              or self.__with == "yAcAk" or self.__with == "yAsH" or self.__with == "yHncA" or self.__with == "yHp"
              or self.__with == "yAlH" or self.__with == "yArAk" or self.__with == "yAdur" or self.__with == "yHver"
              or self.__with == "yAgel" or self.__with == "yAgor" or self.__with == "yAbil" or self.__with == "yAyaz"
              or self.__with == "yAkal" or self.__with == "yAkoy" or self.__with == "yAmA" or self.__with == "yHcH"
              or self.__with == "yHs" or self.__with == "HCH" or self.__with == "Hr" or self.__with == "Hs"
              or self.__with == "Hn" or self.__with == "yHn" or self.__with == "yHnHz" or self.__with == "Ar"
              or self.__with == "Hl"):
         return True
     return False
コード例 #5
0
 def test_GetWord(self):
     self.assertEqual(TxtWord("a"), self.lowerCaseDictionary.getWordWithIndex(0))
     self.assertEqual(TxtWord("ç"), self.lowerCaseDictionary.getWordWithIndex(3))
     self.assertEqual(TxtWord("ğ"), self.lowerCaseDictionary.getWordWithIndex(8))
     self.assertEqual(TxtWord("ı"), self.lowerCaseDictionary.getWordWithIndex(10))
     self.assertEqual(TxtWord("ö"), self.lowerCaseDictionary.getWordWithIndex(18))
     self.assertEqual(TxtWord("ş"), self.lowerCaseDictionary.getWordWithIndex(22))
     self.assertEqual(TxtWord("ü"), self.lowerCaseDictionary.getWordWithIndex(25))
     self.assertEqual(TxtWord("z"), self.lowerCaseDictionary.getWordWithIndex(28))
     for i in range(self.dictionary.size()):
         self.assertIsNotNone(self.dictionary.getWordWithIndex(i))
コード例 #6
0
 def __resolveD(self, root: TxtWord, formation: str) -> str:
     if root.isAbbreviation():
         return formation + 'd'
     if "0" <= self.__lastPhoneme(self.__formationToCheck) <= "9":
         if self.__lastPhoneme(self.__formationToCheck) == "3" or self.__lastPhoneme(self.__formationToCheck) == "4"\
                 or self.__lastPhoneme(self.__formationToCheck) == "5":
             return formation + 't'
         elif self.__lastPhoneme(self.__formationToCheck) == "0":
             if root.getName().endswith("40") or root.getName().endswith("60") or root.getName().endswith("70"):
                 return formation + 't'
             else:
                 return formation + 'd'
         else:
             return formation + 'd'
     else:
         if TurkishLanguage.isSertSessiz(self.__lastPhoneme(self.__formationToCheck)):
             return formation + 't'
         else:
             return formation + 'd'
コード例 #7
0
    def __loadFromText(self, fileName: str):
        """
        The loadFromText method takes a String filename as an input. It reads given file line by line and splits
        according to space and assigns each word to the String array. Then, adds these word with their flags to the
        words list. At the end it sorts the words list.

        PARAMETERS
        ----------
        fileName : str
            File name input.
        """
        inputFile = open(fileName, "r", encoding="utf8")
        lines = inputFile.readlines()
        for line in lines:
            wordList = line.split()
            if len(wordList) > 0:
                currentWord = TxtWord(wordList[0])
                for i in range(1, len(wordList)):
                    currentWord.addFlag(wordList[i])
                self.words.append(currentWord)
        self.words.sort()
コード例 #8
0
    def makeTransitionNoStartState(self, root: TxtWord, stem: str) -> str:
        """
        The makeTransition method takes a TxtWord root and s str stem as inputs. If given root is a verb,
        it makes transition with given root and stem with the verbal root state. If given root is not verb, it makes
        transition with given root and stem and the nominal root state.

        PARAMETERS
        ----------
        root : TxtWord
            TxtWord input.
        stem : str
            String input.

        RETURNS
        -------
        str
            String type output that has the transition.
        """
        if root.isVerb():
            return self.makeTransition(root, stem, State("VerbalRoot", True, False))
        else:
            return self.makeTransition(root, stem, State("NominalRoot", True, False))
コード例 #9
0
 def __init__(self, root, startState=None):
     if isinstance(root, Word):
         self.root = root
     elif isinstance(root, int):
         self.root = TxtWord(str(root))
         self.root.addFlag("IS_SAYI")
     elif isinstance(root, float):
         self.root = TxtWord(str(root))
         self.root.addFlag("IS_SAYI")
     elif isinstance(root, str):
         self.root = TxtWord(root)
     if startState is not None:
         self.__form = self.root.getName()
         self.__pos = startState.getPos()
         self.__initialPos = startState.getPos()
         self.__suffixList = []
         self.__suffixList.append(startState)
         self.__formList = []
         self.__formList.append(self.__form)
         self.__transitionList = []
         self.__withList = []
コード例 #10
0
    def __init__(self, root, startState=None):
        """
        Another constructor of FsmParse class which takes a TxtWord root and a State as inputs.
        First, initializes root variable with this TxtWord. It also initializes form with root's name, pos and
        initialPos with given State's POS, creates 4 new list suffixList, formList, transitionList
        and withList and adds given State to suffixList, form to formList.

        PARAMETERS
        ----------
        root : TxtWord
            TxtWord input.
        startState : State
            State input.
        """
        if isinstance(root, Word):
            self.root = root
        elif isinstance(root, int):
            self.root = TxtWord(str(root))
            self.root.addFlag("IS_SAYI")
        elif isinstance(root, float):
            self.root = TxtWord(str(root))
            self.root.addFlag("IS_SAYI")
        elif isinstance(root, str):
            self.root = TxtWord(root)
        if startState is not None:
            self.__form = self.root.getName()
            self.__pos = startState.getPos()
            self.__initialPos = startState.getPos()
            self.__suffixList = []
            self.__suffixList.append(startState)
            self.__formList = []
            self.__formList.append(self.__form)
            self.__transitionList = []
            self.__withList = []
        self.__verbAgreement = None
        self.__possesiveAgreement = None
コード例 #11
0
 def __resolveH(self, root: TxtWord, formation: str, beginningOfSuffix: bool, specialCaseTenseSuffix: bool,
                rootWord: bool):
     if root.isAbbreviation():
         return formation + 'i'
     if beginningOfSuffix and TurkishLanguage.isVowel(self.__lastPhoneme(self.__formationToCheck)) and \
             not specialCaseTenseSuffix:
         return formation
     if specialCaseTenseSuffix:
         if rootWord:
             if root.vowelAChangesToIDuringYSuffixation():
                 if TurkishLanguage.isFrontRoundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                     return formation[:len(formation) - 1] + 'ü'
                 if TurkishLanguage.isFrontUnroundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                     return formation[:len(formation) - 1] + 'i'
                 if TurkishLanguage.isBackRoundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                     return formation[:len(formation) - 1] + 'u'
                 if TurkishLanguage.isBackUnroundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                     return formation[:len(formation) - 1] + 'ı'
         if TurkishLanguage.isVowel(self.__lastPhoneme(self.__formationToCheck)):
             if TurkishLanguage.isFrontRoundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                 return formation[:len(formation) - 1] + 'ü'
             if TurkishLanguage.isFrontUnroundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                 return formation[:len(formation) - 1] + 'i'
             if TurkishLanguage.isBackRoundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                 return formation[:len(formation) - 1] + 'u'
             if TurkishLanguage.isBackUnroundedVowel(self.__beforeLastVowel(self.__formationToCheck)):
                 return formation[:len(formation) - 1] + 'ı'
     if TurkishLanguage.isFrontRoundedVowel(self.__lastVowel(self.__formationToCheck)) or \
             (TurkishLanguage.isBackRoundedVowel(self.__lastVowel(self.__formationToCheck))
              and root.notObeysVowelHarmonyDuringAgglutination()):
         return formation + 'ü'
     if TurkishLanguage.isFrontUnroundedVowel(self.__lastVowel(self.__formationToCheck)) or \
             (self.__lastVowel(self.__formationToCheck) == 'a' and root.notObeysVowelHarmonyDuringAgglutination()):
         return formation + 'i'
     if TurkishLanguage.isBackRoundedVowel(self.__lastVowel(self.__formationToCheck)):
         return formation + 'u'
     if TurkishLanguage.isBackUnroundedVowel(self.__lastVowel(self.__formationToCheck)):
         return formation + 'ı'
     if root.isNumeral() or root.isFraction() or root.isReal():
         if root.getName().endswith("6") or root.getName().endswith("40") or root.getName().endswith("60") \
                 or root.getName().endswith("90"):
             return formation + 'ı'
         else:
             if root.getName().endswith("3") or root.getName().endswith("4") or root.getName().endswith("00"):
                 return formation + 'ü'
             else:
                 if root.getName().endswith("9") or root.getName().endswith("10") or root.getName().endswith("30"):
                     return formation + 'u'
                 else:
                     return formation + 'i'
     return formation
コード例 #12
0
 def __resolveA(self, root: TxtWord, formation: str, rootWord: bool):
     if root.isAbbreviation():
         return formation + 'e'
     if "0" <= self.__lastVowel(self.__formationToCheck) <= "9":
         if self.__lastVowel(self.__formationToCheck) == "6" or self.__lastVowel(self.__formationToCheck) == 9:
             return formation + 'a'
         elif self.__lastVowel(self.__formationToCheck) == "0":
             if root.getName().endswith("10") or root.getName().endswith("30") or root.getName().endswith("40") \
                     or root.getName().endswith("60") or root.getName().endswith("90"):
                 return formation + 'a'
             else:
                 return formation + 'e'
         else:
             return formation + 'e'
     if TurkishLanguage.isBackVowel(self.__lastVowel(self.__formationToCheck)):
         if root.notObeysVowelHarmonyDuringAgglutination() and rootWord:
             return formation + 'e'
         else:
             return formation + 'a'
     if TurkishLanguage.isFrontVowel(self.__lastVowel(self.__formationToCheck)):
         if root.notObeysVowelHarmonyDuringAgglutination() and rootWord:
             return formation + 'a'
         else:
             return formation + 'e'
     if root.isNumeral() or root.isFraction() or root.isReal():
         if root.getName().endswith("6") or root.getName().endswith("9") or root.getName().endswith("10") or \
                 root.getName().endswith("30") or root.getName().endswith("40") or root.getName().endswith("60") \
                 or root.getName().endswith("90"):
             return formation + 'a'
         else:
             return formation + 'e'
     return formation
コード例 #13
0
 def makeTransition(self, root: TxtWord, stem: str, startState: State) -> str:
     rootWord = root.getName() == stem or (root.getName() + "'") == stem
     formation = stem
     i = 0
     if self.__with == "0":
         return stem
     if (stem == "bu" or stem == "şu" or stem == "o") and rootWord and self.__with == "ylA":
         return stem + "nunla"
     if self.__with == "yA":
         if stem == "ben":
             return "bana"
     self.__formationToCheck = stem
     if rootWord and self.__withFirstChar() == "y" and root.vowelEChangesToIDuringYSuffixation() \
             and self.__with[1] != "H":
         formation = stem[:len(stem) - 1] + "i"
         self.__formationToCheck = formation
     else:
         if rootWord and (self.__with == "Hl" or self.__with == "Hn") and root.lastIdropsDuringPassiveSuffixation():
             formation = stem[:len(stem) - 2] + stem[len(stem) - 1]
             self.__formationToCheck = stem
         else:
             if rootWord and root.showsSuRegularities() and self.__startWithVowelorConsonantDrops() and \
                     not self.__with.startswith("y"):
                 formation = stem + 'y'
                 self.__formationToCheck = formation
             else:
                 if rootWord and root.duplicatesDuringSuffixation() and TurkishLanguage.isConsonantDrop(
                         self.__with[0]):
                     if self.softenDuringSuffixation(root):
                         if self.__lastPhoneme(stem) == "p":
                             formation = stem[:len(stem) - 1] + "bb"
                         elif self.__lastPhoneme(stem) == "t":
                             formation = stem[:len(stem) - 1] + "dd"
                     else:
                         formation = stem + stem[len(stem) - 1]
                     self.__formationToCheck = formation
                 else:
                     if rootWord and root.lastIdropsDuringSuffixation() and \
                             not startState.getName().startswith(
                                 "VerbalRoot") and not startState.getName().startswith("ProperRoot") \
                             and self.__startWithVowelorConsonantDrops():
                         if self.softenDuringSuffixation(root):
                             if self.__lastPhoneme(stem) == "p":
                                 formation = stem[:len(stem) - 2] + 'b'
                             elif self.__lastPhoneme(stem) == "t":
                                 formation = stem[:len(stem) - 2] + 'd'
                             elif self.__lastPhoneme(stem) == "ç":
                                 formation = stem[:len(stem) - 2] + 'c'
                         else:
                             formation = stem[:len(stem) - 2] + stem[len(stem) - 1]
                         self.__formationToCheck = stem
                     else:
                         if self.__lastPhoneme(stem) == "p":
                             if self.__startWithVowelorConsonantDrops() and rootWord and \
                                     self.softenDuringSuffixation(root):
                                 formation = stem[:len(stem) - 1] + 'b'
                         elif self.__lastPhoneme(stem) == "t":
                             if self.__startWithVowelorConsonantDrops() and rootWord and \
                                     self.softenDuringSuffixation(root):
                                 formation = stem[:len(stem) - 1] + 'd'
                         elif self.__lastPhoneme(stem) == "ç":
                             if self.__startWithVowelorConsonantDrops() and rootWord and \
                                     self.softenDuringSuffixation(root):
                                 formation = stem[:len(stem) - 1] + 'c'
                         elif self.__lastPhoneme(stem) == "g":
                             if self.__startWithVowelorConsonantDrops() and rootWord and \
                                     self.softenDuringSuffixation(root):
                                 formation = stem[:len(stem) - 1] + 'ğ'
                         elif self.__lastPhoneme(stem) == "k":
                             if self.__startWithVowelorConsonantDrops() and rootWord and root.endingKChangesIntoG() \
                                     and not root.isProperNoun():
                                 formation = stem[:len(stem) - 1] + 'g'
                             else:
                                 if self.__startWithVowelorConsonantDrops() and (not rootWord or (
                                         self.softenDuringSuffixation(root) and (
                                         not root.isProperNoun() or startState.__str__() != "ProperRoot"))):
                                     formation = stem[:len(stem) - 1] + 'ğ'
                         self.__formationToCheck = formation
     if TurkishLanguage.isConsonantDrop(self.__withFirstChar()) and not TurkishLanguage.isVowel(stem[len(stem) - 1])\
             and (root.isNumeral() or root.isReal() or root.isFraction() or root.isTime() or root.isDate()
                  or root.isPercent() or root.isRange()) \
             and (root.getName().endswith("1") or root.getName().endswith("3") or root.getName().endswith("4")
                  or root.getName().endswith("5") or root.getName().endswith("8") or root.getName().endswith("9")
                  or root.getName().endswith("10") or root.getName().endswith("30") or root.getName().endswith("40")
                  or root.getName().endswith("60") or root.getName().endswith("70") or root.getName().endswith("80")
                  or root.getName().endswith("90") or root.getName().endswith("00")):
         if self.__with[0] == "'":
             formation = formation + "'"
             i = 2
         else:
             i = 1
     else:
         if (TurkishLanguage.isConsonantDrop(self.__withFirstChar()) and TurkishLanguage.isConsonant(
                 self.__lastPhoneme(stem))) or (rootWord and root.consonantSMayInsertedDuringPossesiveSuffixation()):
             if self.__with[0] == "'":
                 formation = formation + "'"
                 if root.isAbbreviation():
                     i = 1
                 else:
                     i = 2
             else:
                 i = 1
     while i < len(self.__with):
         if self.__with[i] == "D":
             formation = self.__resolveD(root, formation)
         elif self.__with[i] == "A":
             formation = self.__resolveA(root, formation, rootWord)
         elif self.__with[i] == "H":
             if self.__with[0] != "'":
                 formation = self.__resolveH(root, formation, i == 0, self.__with.startswith("Hyor"), rootWord)
             else:
                 formation = self.__resolveH(root, formation, i == 1, False, rootWord)
         elif self.__with[i] == "C":
             formation = self.__resolveC(formation)
         elif self.__with[i] == "S":
             formation = self.__resolveS(formation)
         elif self.__with[i] == "Ş":
             formation = self.__resolveSh(formation)
         else:
             if i == len(self.__with) - 1 and self.__with[i] == "s":
                 formation += "ş"
             else:
                 formation += self.__with[i]
         self.__formationToCheck = formation
         i = i + 1
     return formation
コード例 #14
0
 def transitionPossibleForWord(self, root: TxtWord, fromState: State) -> bool:
     if root.isAdjective() and ((root.isNominal() and not root.isExceptional()) or root.isPronoun()) \
             and self.__toState.getName() == "NominalRoot(ADJ)" and self.__with == "0":
         return False
     if root.isAdjective() and root.isNominal() and self.__with == "^DB+VERB+ZERO+PRES+A3PL" \
             and fromState.getName() == "AdjectiveRoot":
         return False
     if root.isAdjective() and root.isNominal() and self.__with == "SH" and fromState.getName() == "AdjectiveRoot":
         return False
     if self.__with == "ki":
         return root.takesRelativeSuffixKi()
     if self.__with == "kü":
         return root.takesRelativeSuffixKu()
     if self.__with == "dHr":
         if self.__toState.getName() == "Adverb":
             return True
         else:
             return root.takesSuffixDIRAsFactitive()
     if self.__with == "Hr" and (
             self.__toState.getName() == "AdjectiveRoot(VERB)" or self.__toState.getName() == "OtherTense" or
             self.__toState.getName() == "OtherTense2"):
         return root.takesSuffixIRAsAorist()
     return True
コード例 #15
0
class FsmParse(MorphologicalParse):
    __suffixList: list
    __formList: list
    __transitionList: list
    __withList: list
    __initialPos: str
    __pos: str
    __form: str
    __verbAgreement: str
    __possesiveAgreement: str

    def __init__(self, root, startState=None):
        """
        Another constructor of FsmParse class which takes a TxtWord root and a State as inputs.
        First, initializes root variable with this TxtWord. It also initializes form with root's name, pos and
        initialPos with given State's POS, creates 4 new list suffixList, formList, transitionList
        and withList and adds given State to suffixList, form to formList.

        PARAMETERS
        ----------
        root : TxtWord
            TxtWord input.
        startState : State
            State input.
        """
        if isinstance(root, Word):
            self.root = root
        elif isinstance(root, int):
            self.root = TxtWord(str(root))
            self.root.addFlag("IS_SAYI")
        elif isinstance(root, float):
            self.root = TxtWord(str(root))
            self.root.addFlag("IS_SAYI")
        elif isinstance(root, str):
            self.root = TxtWord(root)
        if startState is not None:
            self.__form = self.root.getName()
            self.__pos = startState.getPos()
            self.__initialPos = startState.getPos()
            self.__suffixList = []
            self.__suffixList.append(startState)
            self.__formList = []
            self.__formList.append(self.__form)
            self.__transitionList = []
            self.__withList = []
        self.__verbAgreement = None
        self.__possesiveAgreement = None

    def __eq__(self, other):
        return self.transitionList() == other.transitionList()

    def __lt__(self, other):
        return self.transitionList() < other.transitionList()

    def __gt__(self, other):
        return self.transitionList() > other.transitionList()

    def constructInflectionalGroups(self):
        """
        The constructInflectionalGroups method initially calls the transitionList method and assigns the resulting str
        to the parse variable and creates a new list as iGs. If parse str contains a derivational boundary
        it adds the substring starting from the 0 to the index of derivational boundary to the iGs. If it does not
        contain a DB, it directly adds parse to the iGs. Then, creates and initializes new list as inflectionalGroups
        and fills with the items of iGs.
        """
        parse = self.transitionList()
        iGs = []
        while "^DB+" in parse:
            iGs.append(parse[:parse.index("^DB+")])
            parse = parse[parse.index("^DB+") + 4:]
        iGs.append(parse)
        self.inflectionalGroups = []
        self.inflectionalGroups.append(
            InflectionalGroup(iGs[0][iGs[0].index("+") + 1:]))
        for i in range(1, len(iGs)):
            self.inflectionalGroups.append(InflectionalGroup(iGs[i]))

    def getVerbAgreement(self) -> str:
        """
        Getter for the verbAgreement variable.

        RETURNS
        -------
        str
            The verbAgreement variable.
        """
        return self.__verbAgreement

    def getPossesiveAgreement(self) -> str:
        """
        Getter for the possesiveAgreement variable.

        RETURNS
        -------
        str
            The possesiveAgreement variable.
        """
        return self.__possesiveAgreement

    def setAgreement(self, transitionName: str):
        """
        The setAgreement method takes a str transitionName as an input and if it is one of the A1SG, A2SG, A3SG,
        A1PL, A2PL or A3PL it assigns transitionName input to the verbAgreement variable. Or if it is ine of the PNON,
        P1SG, P2SG,P3SG, P1PL, P2PL or P3PL it assigns transitionName input to the possesiveAgreement variable.

        PARAMETERS
        ----------
        transitionName : str
            String input.
        """
        if transitionName == "A1SG" or transitionName == "A2SG" or transitionName == "A3SG" or transitionName == "A1PL"\
                or transitionName == "A2PL" or transitionName == "A3PL":
            self.__verbAgreement = transitionName
        if transitionName == "PNON" or transitionName == "P1SG" or transitionName == "P2SG" or transitionName == "P3SG"\
                or transitionName == "P1PL" or transitionName == "P2PL" or transitionName == "P3PL":
            self.__possesiveAgreement = transitionName

    def getLastLemmaWithTag(self, pos: str) -> str:
        """
        The getLastLemmaWithTag method takes a String input pos as an input. If given pos is an initial pos then it
        assigns root to the lemma, and assign null otherwise. Then, it loops i times where i ranges from 1 to size of
        the formList, if the item at i-1 of transitionList is not null and contains a derivational boundary with pos but
        not with ZERO, it assigns the ith item of formList to lemma.

        PARAMETERS
        ----------
        pos : str
            String input.

        RETURNS
        -------
        str
            String output lemma.
        """
        if self.__initialPos is not None and self.__initialPos == pos:
            lemma = self.root.getName()
        else:
            lemma = None
        for i in range(1, len(self.__formList)):
            if self.__transitionList[i - 1] is not None and ("^DB+" + pos) in self.__transitionList[i - 1] and \
                    ("^DB+" + pos + "+ZERO") in self.__transitionList[i - 1]:
                lemma = self.__formList[i]
        return lemma

    def getLastLemma(self) -> str:
        """
        The getLastLemma method initially assigns root as lemma. Then, it loops i times where i ranges from 1 to size of
        the formList, if the item at i-1 of transitionList is not null and contains a derivational boundary, it assigns
        the ith item of formList to lemma.

        RETURNS
        -------
        str
            String output lemma.
        """
        lemma = self.root.getName()
        for i in range(1, len(self.__formList)):
            if self.__transitionList[
                    i - 1] is not None and "^DB+" in self.__transitionList[i -
                                                                           1]:
                lemma = self.__formList[i]
        return lemma

    def addSuffix(self, suffix: State, form: str, transition: str,
                  withName: str, toPos: str):
        """
        The addSuffix method takes 5 different inputs; State suffix, str form, transition, with and toPos.
        If the pos of given input suffix is not None, it then assigns it to the pos variable. If the pos of the given
        suffix is None but given toPos is not None than it assigns toPos to pos variable. At the end, it adds suffix to
        the suffixList, form to the formList, transition to the transitionList and if given with is not 0, it is also
        added to withList.

        PARAMETERS
        ----------
        suffix : State
            State input.
        form : str
            String input.
        transition : str
            String input.
        withName : str
            String input.
        toPos : str
            String input.
        """
        if suffix.getPos() is not None:
            self.__pos = suffix.getPos()
        else:
            if toPos is not None:
                self.__pos = toPos
        self.__suffixList.append(suffix)
        self.__formList.append(form)
        self.__transitionList.append(transition)
        if withName != "0":
            self.__withList.append(withName)
        self.__form = form

    def getSurfaceForm(self) -> str:
        """
        Getter for the form variable.

        RETURNS
        -------
        str
            The form variable.
        """
        return self.__form

    def getStartState(self) -> State:
        """
        The getStartState method returns the first item of suffixList list.

        RETURNS
        -------
        State
            The first item of suffixList list.
        """
        return self.__suffixList[0]

    def getFinalPos(self) -> str:
        """
        Getter for the pos variable.

        RETURNS
        -------
        str
            The pos variable.
        """
        return self.__pos

    def getInitialPos(self) -> str:
        """
        Getter for the initialPos variable.

        RETURNS
        -------
        str
            The initialPos variable.
        """
        return self.__initialPos

    def setForm(self, name: str):
        """
        The setForm method takes a str name as an input and assigns it to the form variable, then it removes the first
        item of formList list and adds the given name to the formList.

        PARAMETERS
        ----------
        name : str
            String input to set form.
        """
        self.__form = name
        self.__formList.pop(0)
        self.__formList.append(name)

    def getFinalSuffix(self) -> State:
        """
        The getFinalSuffix method returns the last item of suffixList list.

        RETURNS
        -------
        State
            The last item of suffixList list.
        """
        return self.__suffixList[len(self.__suffixList) - 1]

    def headerTransition(self) -> str:
        """
        The headerTransition method gets the first item of formList and checks for cases;

        If it is <DOC>, it returns "<DOC>+BDTAG" which indicates the beginning of a document.
        If it is </DOC>, it returns "</DOC>+EDTAG" which indicates the ending of a document.
        If it is <TITLE>, it returns "<TITLE>+BTTAG" which indicates the beginning of a title.
        If it is </TITLE>, it returns "</TITLE>+ETTAG" which indicates the ending of a title.
        If it is "<S>", it returns "<S>+BSTAG" which indicates the beginning of a sentence.
        If it is "</S>, it returns "</S>+ESTAG" which indicates the ending of a sentence.

        RETURNS
        -------
        str
            Corresponding tags of the headers and an empty {@link String} if any case does not match.
        """
        if self.__formList[0] == "<DOC>":
            return "<DOC>+BDTAG"
        elif self.__formList[0] == "</DOC>":
            return "</DOC>+EDTAG"
        elif self.__formList[0] == "<TITLE>":
            return "<TITLE>+BTTAG"
        elif self.__formList[0] == "</TITLE>":
            return "</TITLE>+ETTAG"
        elif self.__formList[0] == "<S>":
            return "<S>+BSTAG"
        elif self.__formList[0] == "</S>":
            return "</S>+ESTAG"
        else:
            return ""

    def pronounTransition(self) -> str:
        """
        The pronounTransition method gets the first item of formList and checks for cases;

        If it is "kendi", it returns kendi+PRON+REFLEXP which indicates a reflexive pronoun.
        If it is one of the "hep, öbür, topu, öteki, kimse, hiçbiri, tümü, çoğu, hepsi, herkes, başkası, birçoğu,
        birçokları, biri, birbirleri, birbiri, birkaçı, böylesi, diğeri, cümlesi, bazı, kimi", it returns
        +PRON+QUANTP which indicates a quantitative pronoun.
        If it is one of the "o, bu, şu" and if it is "o" it also checks the first item of suffixList and if it is a
        PronounRoot(DEMONS), it returns +PRON+DEMONSP which indicates a demonstrative pronoun.
        If it is "ben", it returns +PRON+PERS+A1SG+PNON which indicates a 1st person singular agreement.
        If it is "sen", it returns +PRON+PERS+A2SG+PNON which indicates a 2nd person singular agreement.
        If it is "o" and the first item of suffixList, if it is a PronounRoot(PERS), it returns +PRON+PERS+A3SG+PNON
        which indicates a 3rd person singular agreement.
        If it is "biz", it returns +PRON+PERS+A1PL+PNON which indicates a 1st person plural agreement.
        If it is "siz", it returns +PRON+PERS+A2PL+PNON which indicates a 2nd person plural agreement.
        If it is "onlar" and the first item of suffixList, if it is a PronounRoot(PERS), it returns
        o+PRON+PERS+A3PL+PNON which indicates a 3rd person plural agreement.
        If it is one of the "nere, ne, kim, hangi", it returns +PRON+QUESP which indicates a question pronoun.

        RETURNS
        -------
        str
            Corresponding transitions of pronouns and an empty str if any case does not match.
        """
        if self.__formList[0] == "kendi":
            return "kendi+PRON+REFLEXP"
        elif self.__formList[0] == "hep" or self.__formList[0] == "öbür" or self.__formList[0] == "topu" \
                or self.__formList[0] == "öteki" or self.__formList[0] == "kimse" or self.__formList[0] == "hiçbiri" \
                or self.__formList[0] == "tümü" or self.__formList[0] == "çoğu" or self.__formList[0] == "hepsi" \
                or self.__formList[0] == "herkes" or self.__formList[0] == "başkası" or self.__formList[0] == "birçoğu"\
                or self.__formList[0] == "birçokları" or self.__formList[0] == "birbiri" \
                or self.__formList[0] == "birbirleri" or self.__formList[0] == "biri" \
                or self.__formList[0] == "birkaçı" or self.__formList[0] == "böylesi" or self.__formList[0] == "diğeri"\
                or self.__formList[0] == "cümlesi" or self.__formList[0] == "bazı" or self.__formList[0] == "kimi":
            return self.__formList[0] + "+PRON+QUANTP"
        elif (self.__formList[0] == "o" and self.__suffixList[0].getName() == "PronounRoot(DEMONS)") \
                or self.__formList[0] == "bu" or self.__formList[0] == "şu":
            return self.__formList[0] + "+PRON+DEMONSP"
        elif self.__formList[0] == "ben":
            return self.__formList[0] + "+PRON+PERS+A1SG+PNON"
        elif self.__formList[0] == "sen":
            return self.__formList[0] + "+PRON+PERS+A2SG+PNON"
        elif self.__formList[0] == "o" and self.__suffixList[0].getName(
        ) == "PronounRoot(PERS)":
            return self.__formList[0] + "+PRON+PERS+A3SG+PNON"
        elif self.__formList[0] == "biz":
            return self.__formList[0] + "+PRON+PERS+A1PL+PNON"
        elif self.__formList[0] == "siz":
            return self.__formList[0] + "+PRON+PERS+A2PL+PNON"
        elif self.__formList[0] == "onlar":
            return "o+PRON+PERS+A3PL+PNON"
        elif self.__formList[0] == "nere" or self.__formList[0] == "ne" or self.__formList[0] == "kaçı" \
                or self.__formList[0] == "kim" or self.__formList[0] == "hangi":
            return self.__formList[0] + "+PRON+QUESP"
        else:
            return ""

    def transitionList(self) -> str:
        """
        The transitionList method first creates an empty {@link String} result, then gets the first item of suffixList
        and checks for cases; If it is one of the "NominalRoot, NominalRootNoPossesive, CompoundNounRoot,
        NominalRootPlural", it assigns concatenation of first item of formList and +NOUN to the result String.
        Ex : Birincilik

        If it is one of the "VerbalRoot, PassiveHn", it assigns concatenation of first item of formList and +VERB to the
        result String.
        Ex : Başkalaştı

        If it is "CardinalRoot", it assigns concatenation of first item of formList and +NUM+CARD to the result String.
        Ex : Onuncu

        If it is "FractionRoot", it assigns concatenation of first item of formList and NUM+FRACTION to the result
        String.
        Ex : 1/2

        If it is "TimeRoot", it assigns concatenation of first item of formList and +TIME to the result String.
        Ex : 14:28

        If it is "RealRoot", it assigns concatenation of first item of formList and +NUM+REAL to the result String.
        Ex : 1.2

        If it is "Punctuation", it assigns concatenation of first item of formList and +PUNC to the result String.
        Ex : ,

        If it is "Hashtag", it assigns concatenation of first item of formList and +HASHTAG to the result String.
        Ex : #

        If it is "DateRoot", it assigns concatenation of first item of formList and +DATE to the result String.
        Ex : 11/06/2018

        If it is "RangeRoot", it assigns concatenation of first item of formList and +RANGE to the result String.
        Ex : 3-5

        If it is "Email", it assigns concatenation of first item of formList and +EMAIL to the result String.
        Ex : abc@

        If it is "PercentRoot", it assigns concatenation of first item of formList and +PERCENT to the result String.
        Ex : %12.5

        If it is "DeterminerRoot", it assigns concatenation of first item of formList and +DET to the result String.
        Ex : Birtakım

        If it is "ConjunctionRoot", it assigns concatenation of first item of formList and +CONJ to the result String.
        Ex : Ama

        If it is "AdverbRoot", it assigns concatenation of first item of formList and +ADV to the result String.
        Ex : Acilen

        If it is "ProperRoot", it assigns concatenation of first item of formList and +NOUN+PROP to the result String.
        Ex : Ahmet

        If it is "HeaderRoot", it assigns the result of the headerTransition method to the result String.
        Ex : &lt;DOC&gt;

        If it is "InterjectionRoot", it assigns concatenation of first item of formList and +INTERJ to the result
        String.
        Ex : Hey

        If it is "DuplicateRoot", it assigns concatenation of first item of formList and +DUP to the result String.
        Ex : Allak

        If it is "QuestionRoot", it assigns concatenation of first item of formList and +QUES to the result String.
        Ex : Mı

        If it is "PostP", and the first item of formList is one of the "karşı, ilişkin, göre, kadar, ait, yönelik,
        rağmen, değin, dek, doğru, karşın, dair, atfen, binaen, hitaben, istinaden, mahsuben, mukabil, nazaran", it
        assigns concatenation of first item of formList and +POSTP+PCDAT to the result String.
        Ex : İlişkin

        If it is "PostP", and the first item of formList is one of the "sonra, önce, beri, fazla, dolayı, itibaren,
        başka, çok, evvel, ötürü, yana, öte, aşağı, yukarı, dışarı, az, gayrı", it assigns concatenation of first
        item of formList and +POSTP+PCABL to the result String.
        Ex : Başka

        If it is "PostP", and the first item of formList is "yanısıra", it assigns concatenation of first
        item of formList and +POSTP+PCGEN to the result String.
        Ex : Yanısıra

        If it is "PostP", and the first item of formList is one of the "birlikte, beraber", it assigns concatenation of
        first item of formList and +PPOSTP+PCINS to the result String.
        Ex : Birlikte

        If it is "PostP", and the first item of formList is one of the "aşkın, takiben", it assigns concatenation of
        first item of formList and +POSTP+PCACC to the result String.
        Ex : Takiben

        If it is "PostP", it assigns concatenation of first item of formList and +POSTP+PCNOM to the result String.

        If it is "PronounRoot", it assigns result of the pronounTransition method to the result String.
        Ex : Ben

        If it is "OrdinalRoot", it assigns concatenation of first item of formList and +NUM+ORD to the result String.
        Ex : Altıncı

        If it starts with "Adjective", it assigns concatenation of first item of formList and +ADJ to the result String.
        Ex : Güzel

        At the end, it loops through the formList and concatenates each item with result {@link String}.

        RETURNS
        -------
        str
            str result accumulated with items of formList.
        """
        result = ""
        if self.__suffixList[0].getName() == "NominalRoot" \
                or self.__suffixList[0].getName() == "NominalRootNoPossesive" \
                or self.__suffixList[0].getName() == "CompoundNounRoot" \
                or self.__suffixList[0].getName() == "NominalRootPlural":
            result = self.__formList[0] + "+NOUN"
        elif self.__suffixList[0].getName().startswith(
                "VerbalRoot") or self.__suffixList[0].getName() == "PassiveHn":
            result = self.__formList[0] + "+VERB"
        elif self.__suffixList[0].getName() == "CardinalRoot":
            result = self.__formList[0] + "+NUM+CARD"
        elif self.__suffixList[0].getName() == "FractionRoot":
            result = self.__formList[0] + "+NUM+FRACTION"
        elif self.__suffixList[0].getName() == "TimeRoot":
            result = self.__formList[0] + "+TIME"
        elif self.__suffixList[0].getName() == "RealRoot":
            result = self.__formList[0] + "+NUM+REAL"
        elif self.__suffixList[0].getName() == "Punctuation":
            result = self.__formList[0] + "+PUNC"
        elif self.__suffixList[0].getName() == "Hashtag":
            result = self.__formList[0] + "+HASHTAG"
        elif self.__suffixList[0].getName() == "DateRoot":
            result = self.__formList[0] + "+DATE"
        elif self.__suffixList[0].getName() == "RangeRoot":
            result = self.__formList[0] + "+RANGE"
        elif self.__suffixList[0].getName() == "Email":
            result = self.__formList[0] + "+EMAIL"
        elif self.__suffixList[0].getName() == "PercentRoot":
            result = self.__formList[0] + "+PERCENT"
        elif self.__suffixList[0].getName() == "DeterminerRoot":
            result = self.__formList[0] + "+DET"
        elif self.__suffixList[0].getName() == "ConjunctionRoot":
            result = self.__formList[0] + "+CONJ"
        elif self.__suffixList[0].getName() == "AdverbRoot":
            result = self.__formList[0] + "+ADV"
        elif self.__suffixList[0].getName() == "ProperRoot":
            result = self.__formList[0] + "+NOUN+PROP"
        elif self.__suffixList[0].getName() == "HeaderRoot":
            result = self.headerTransition()
        elif self.__suffixList[0].getName() == "InterjectionRoot":
            result = self.__formList[0] + "+INTERJ"
        elif self.__suffixList[0].getName() == "DuplicateRoot":
            result = self.__formList[0] + "+DUP"
        elif self.__suffixList[0].getName() == "QuestionRoot":
            result = self.__formList[0] + "+QUES"
        elif self.__suffixList[0].getName() == "PostP":
            if self.__formList[0] == "karşı" or self.__formList[0] == "ilişkin" or self.__formList[0] == "göre" \
                    or self.__formList[0] == "kadar" or self.__formList[0] == "ait" or self.__formList[0] == "yönelik" \
                    or self.__formList[0] == "rağmen" or self.__formList[0] == "değin" or self.__formList[0] == "dek" \
                    or self.__formList[0] == "doğru" or self.__formList[0] == "karşın" or self.__formList[0] == "dair" \
                    or self.__formList[0] == "atfen" or self.__formList[0] == "binaen" or self.__formList[
                0] == "hitaben" \
                    or self.__formList[0] == "istinaden" or self.__formList[0] == "mahsuben" \
                    or self.__formList[0] == "mukabil" or self.__formList[0] == "nazaran":
                result = self.__formList[0] + "+POSTP+PCDAT"
            elif self.__formList[0] == "sonra" or self.__formList[0] == "önce" or self.__formList[0] == "beri" \
                    or self.__formList[0] == "fazla" or self.__formList[0] == "dolayı" or self.__formList[
                0] == "itibaren" \
                    or self.__formList[0] == "başka" or self.__formList[0] == "çok" or self.__formList[0] == "evvel" \
                    or self.__formList[0] == "ötürü" or self.__formList[0] == "yana" or self.__formList[0] == "öte" \
                    or self.__formList[0] == "aşağı" or self.__formList[0] == "yukarı" \
                    or self.__formList[0] == "dışarı" or self.__formList[0] == "az" or self.__formList[0] == "gayrı":
                result = self.__formList[0] + "+POSTP+PCABL"
            elif self.__formList[0] == "yanısıra":
                result = self.__formList[0] + "+POSTP+PCGEN"
            elif self.__formList[0] == "birlikte" or self.__formList[
                    0] == "beraber":
                result = self.__formList[0] + "+POSTP+PCINS"
            elif self.__formList[0] == "aşkın" or self.__formList[
                    0] == "takiben":
                result = self.__formList[0] + "+POSTP+PCACC"
            else:
                result = self.__formList[0] + "+POSTP+PCNOM"
        elif self.__suffixList[0].getName().startswith("PronounRoot"):
            result = self.pronounTransition()
        elif self.__suffixList[0].getName() == "OrdinalRoot":
            result = self.__formList[0] + "+NUM+ORD"
        elif self.__suffixList[0].getName().startswith("Adjective"):
            result = self.__formList[0] + "+ADJ"
        for transition in self.__transitionList:
            if transition is not None:
                if not transition.startswith("^"):
                    result = result + "+" + transition
                else:
                    result = result + transition
        return result

    def suffixList(self) -> str:
        """
        The suffixList method gets the first items of suffixList and formList and concatenates them with parenthesis and
        assigns a String result. Then, loops through the formList and it the current ith item is not equal to previous
        item it accumulates ith items of formList and suffixList to the result str.

        RETURNS
        -------
        str
            result str accumulated with the items of formList and suffixList.
        """
        result = self.__suffixList[0].getName(
        ) + "(" + self.__formList[0] + ")"
        for i in range(1, len(self.__formList)):
            if self.__formList[i] != self.__formList[i - 1]:
                result = result + self.__suffixList[i].getName(
                ) + "(" + self.__formList[i] + ")"
        return result

    def withList(self) -> str:
        """
        The withList method gets the root as a result str then loops through the withList and concatenates each item
        with result str.

        RETURNS
        -------
        str
            result str accumulated with items of withList.
        """
        result = self.root.getName()
        for aWith in self.__withList:
            result = result + "+" + aWith
        return result

    def __str__(self) -> str:
        """
        The overridden str method which returns transitionList method.

        RETURNS
        -------
        str
            Returns transitionList method.
        """
        return self.transitionList()