def testTbxOrth(self): filepath = os.path.join(util.TESTDATA_FOLDER, "TbxIntHunt06.xml") fileItem = LingExFileItem(self.userVars) fileItem.filepath = filepath config = InterlinInputSettings(None) config.fileList = [fileItem] config.separateMorphColumns = True config.showMorphemeBreaks = True self.userVars.store("SFMarker_Word2", "or") self.userVars.store("SFMarker_Morpheme2", "mbtam") xmlReader = interlin_reader.InterlinReader(self.unoObjs, self.userVars, config) exampleDict = xmlReader.read() gramEx = exampleDict["Hunt06".lower()] word1 = gramEx.wordList[0] self.assertNotEqual(word1.text2, "") morph1 = word1.morphList[0] self.assertNotEqual(morph1.text2, "") word4 = gramEx.wordList[3] self.assertNotEqual(word4.text2, "") morph1 = word4.morphList[0] self.assertNotEqual(morph1.text2, "") self.userVars.store("SFMarker_Word2", "") # reset self.userVars.store("SFMarker_Morpheme2", "") # reset
def testTbx(self): filepath = os.path.join(util.TESTDATA_FOLDER, "TbxIntHunt06.xml") fileItem = LingExFileItem(self.userVars) fileItem.filepath = filepath config = InterlinInputSettings(None) config.fileList = [fileItem] config.separateMorphColumns = True config.showMorphemeBreaks = True xmlReader = interlin_reader.InterlinReader(self.unoObjs, self.userVars, config) exampleDict = xmlReader.read() self.assertEqual(xmlReader.get_filetype(filepath, xmlReader.dom), "toolbox") self.assertTrue("Hunt06".lower() in exampleDict) gramEx = exampleDict["Hunt06".lower()] self.assertEqual(gramEx.refText, "Hunt06") self.assertEqual( gramEx.freeTrans, '"Not so. Tell him, "We should take along the sister\'s ' + 'husband and go to the hill for hunting.\'" Only when he hunts ' + 'they will go.') self.assertEqual(len(gramEx.wordList), 13) word1 = gramEx.wordList[0] self.assertNotEqual(word1.text1, "") self.assertEqual(word1.text2, "") self.assertEqual(len(word1.morphList), 1) morph1 = word1.morphList[0] self.assertEqual(morph1.gloss, "like.that") self.assertEqual(morph1.pos, "adv") self.assertNotEqual(morph1.text1, "") self.assertEqual(morph1.text2, "") word4 = gramEx.wordList[3] self.assertEqual(len(word4.morphList), 2) morph1 = word4.morphList[0] self.assertEqual(morph1.gloss, "sister") self.assertEqual(morph1.pos, "n") self.assertNotEqual(morph1.text1, "") self.assertEqual(morph1.text2, "") suggestions = xmlReader.getSuggestions() self.assertEqual(len(suggestions), 1) self.assertEqual(suggestions[0], "Hunt01")
def testFw(self): filepath = os.path.join(util.TESTDATA_FOLDER, "FWtextPigFox.xml") fileItem = LingExFileItem(self.userVars) fileItem.filepath = filepath fileItem.prefix = "Prefix-" config = InterlinInputSettings(None) config.fileList = [fileItem] config.separateMorphColumns = True config.showMorphemeBreaks = True xmlReader = interlin_reader.InterlinReader(self.unoObjs, self.userVars, config) exampleDict = xmlReader.read() self.assertEqual(xmlReader.get_filetype(filepath, xmlReader.dom), "fieldworks") self.assertTrue("Prefix-1.1".lower() in exampleDict) self.assertTrue(not "Prefix-1".lower() in exampleDict) self.assertTrue("Prefix-1.2".lower() in exampleDict) self.assertTrue(not "Prefix-1.3".lower() in exampleDict) self.assertTrue("Prefix-2".lower() in exampleDict) self.assertTrue(not "Prefix-2.1".lower() in exampleDict) self.assertTrue(not "Prefix-2.2".lower() in exampleDict) interlinEx = exampleDict["Prefix-1.2".lower()] self.assertEqual(interlinEx.refText, "Prefix-1.2") self.assertEqual( interlinEx.freeTrans, u" \u200e\u200eIn his house he kept one pig and one fox ") self.assertEqual(len(interlinEx.wordList), 7) word2 = interlinEx.wordList[1] self.assertNotEqual(word2.text1, "") self.assertEqual(word2.text2, "") self.assertEqual(len(word2.morphList), 2) morph2 = word2.morphList[1] self.assertEqual(morph2.gloss, "LOC.in") self.assertEqual(morph2.pos, "case ") self.assertNotEqual(morph2.text1, "") self.assertEqual(morph2.text2, "")
def testFlexText(self): filepath = os.path.join(util.TESTDATA_FOLDER, "Sena Int.flextext") fileItem = LingExFileItem(self.userVars) fileItem.filepath = filepath fileItem.prefix = "ABC " config = InterlinInputSettings(None) config.fileList = [fileItem] config.separateMorphColumns = True config.showMorphemeBreaks = True xmlReader = interlin_reader.InterlinReader(self.unoObjs, self.userVars, config) exampleDict = xmlReader.read() self.assertEqual(xmlReader.get_filetype(filepath, xmlReader.dom), "fieldworks") self.assertTrue("ABC 1.1".lower() in exampleDict) self.assertTrue("ABC 1.2".lower() in exampleDict) self.assertTrue(not "ABC 2.1".lower() in exampleDict) gramEx = exampleDict["ABC 1.2".lower()] self.assertEqual(gramEx.refText, "ABC 1.2") self.assertEqual(gramEx.freeTrans, "[1.2 ft]") self.assertEqual(len(gramEx.wordList), 4) word1 = gramEx.wordList[0] self.assertEqual(word1.text1, "Tonsene") word2 = gramEx.wordList[2] self.assertEqual(word2.text1, "yathu") self.assertEqual(word2.text2, "") morph2 = word2.morphList[1] self.assertEqual(morph2.text1, "a-") self.assertEqual(morph2.gloss, "assocpx") self.assertEqual(morph2.pos, "Poss:assocpx") self.assertEqual(morph2.text2, "")