def test_morphologicalAnalysisIsPortmanteau(self): dictionary = self.fsm.getDictionary() for i in range(dictionary.size()): word = dictionary.getWordWithIndex(i) if isinstance(word, TxtWord): if word.isNominal() and word.isPortmanteau() and not word.isPlural() and \ not word.isPortmanteauFacedVowelEllipsis(): transitionState = State("CompoundNounRoot", True, False) startState = State("CompoundNounRoot", True, False) transition = Transition("lArH", transitionState, "A3PL+P3PL") exceptLast2 = word.getName()[:len(word.getName()) - 2] exceptLast = word.getName()[:len(word.getName()) - 1] if word.isPortmanteauFacedSoftening(): if word.getName()[len(word.getName()) - 2] == "b": rootForm = exceptLast2 + 'p' elif word.getName()[len(word.getName()) - 2] == "c": rootForm = exceptLast2 + 'ç' elif word.getName()[len(word.getName()) - 2] == "d": rootForm = exceptLast2 + 't' elif word.getName()[len(word.getName()) - 2] == "ğ": rootForm = exceptLast2 + 'k' else: rootForm = exceptLast else: if word.isPortmanteauEndingWithSI(): rootForm = exceptLast2 else: rootForm = exceptLast surfaceForm = transition.makeTransition( word, rootForm, startState) self.assertTrue( self.fsm.morphologicalAnalysis(surfaceForm).size() != 0 )
def test_morphologicalAnalysisNounSoftenDuringSuffixation(self): dictionary = self.fsm.getDictionary() for i in range(dictionary.size()): word = dictionary.getWordWithIndex(i) if isinstance(word, TxtWord): if word.isNominal() and word.nounSoftenDuringSuffixation(): transitionState = State("Possessive", False, False) startState = State("NominalRoot", True, False) transition = Transition("yH", transitionState, "ACC") surfaceForm = transition.makeTransition( word, word.getName(), startState) self.assertTrue( self.fsm.morphologicalAnalysis(surfaceForm).size() != 0 )
def test_morphologicalAnalysisVowelAChangesToIDuringYSuffixation(self): dictionary = self.fsm.getDictionary() for i in range(dictionary.size()): word = dictionary.getWordWithIndex(i) if isinstance(word, TxtWord): if word.isVerb() and word.vowelAChangesToIDuringYSuffixation(): transitionState = State("VerbalStem", False, False) startState = State("VerbalRoot", True, False) transition = Transition("Hyor", transitionState, "PROG1") surfaceForm = transition.makeTransition( word, word.getName(), startState) self.assertTrue( self.fsm.morphologicalAnalysis(surfaceForm).size() != 0 )
def test_morphologicalAnalysisLastIdropsDuringPassiveSuffixation(self): dictionary = self.fsm.getDictionary() for i in range(dictionary.size()): word = dictionary.getWordWithIndex(i) if isinstance(word, TxtWord): if word.isVerb() and word.lastIdropsDuringPassiveSuffixation(): transitionState = State("VerbalStem", False, False) startState = State("VerbalRoot", True, False) transition = Transition("Hl", transitionState, "^DB+VERB+PASS") surfaceForm = transition.makeTransition( word, word.getName(), startState) self.assertTrue( self.fsm.morphologicalAnalysis(surfaceForm).size() != 0 )