def testIgnore(self): tree = computeTree(data.give_how_old()) NamedEntityMerging(tree).merge() PrepositionMerging(tree).merge() simplify(tree) tree.sort() root = tree # Root self.assertEqual(root.wordList, [Word("ROOT", 0)]) self.assertEqual(root.namedEntityTag, 'undef') self.assertEqual(root.dependency, 'R0') self.assertEqual(root.parent, None) self.assertEqual(len(root.child), 1) self.assertEqual(root.subtreeType, 'NUMBER') self.assertEqual(root.dfsTag, 0) # Are are = root.child[0] self.assertEqual(are.wordList, [Word("are", 3, 'VBP')]) self.assertEqual(are.namedEntityTag, 'undef') self.assertEqual(are.dependency, 'R0') self.assertEqual(are.parent, root) self.assertEqual(len(are.child), 0) self.assertEqual(are.subtreeType, 'NUMBER') self.assertEqual(are.dfsTag, 0)
def testIgnore(self): tree = computeTree(data.give_how_old()["sentences"][0]) NamedEntityMerging(tree).merge() PrepositionMerging(tree).merge() simplify(tree) tree.sort() root = tree # Root self.assertEqual(root.wordList, [Word("ROOT", 0)]) self.assertEqual(root.namedEntityTag, "undef") self.assertEqual(root.dependency, "R0") self.assertEqual(root.parent, None) self.assertEqual(len(root.child), 1) self.assertEqual(root.subtreeType, "NUMBER") self.assertEqual(root.dfsTag, 0) # Are are = root.child[0] self.assertEqual(are.wordList, [Word("are", 3, "VBP")]) self.assertEqual(are.namedEntityTag, "undef") self.assertEqual(are.dependency, "R0") self.assertEqual(are.parent, root) self.assertEqual(len(are.child), 0) self.assertEqual(are.subtreeType, "NUMBER") self.assertEqual(are.dfsTag, 0)
def testQuestion2(self): tree = computeTree(data.give_how_old()) NamedEntityMerging(tree).merge() PrepositionMerging(tree).merge() self.assertEqual(simplify(tree), 'how old')
def testQuestion2(self): tree = computeTree(data.give_how_old()["sentences"][0]) NamedEntityMerging(tree).merge() PrepositionMerging(tree).merge() self.assertEqual(simplify(tree), "how old")