def testMatchFeatureConstraints2(self): currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) content = conll.load(parentdir + "/test/sampleCoNLLU.conll", verbose=False) x, y = content[0], content[1] self.assertEqual( False, _matchFeatureConstraints("nsubj[ID!=story]", x.rightChild)) return
def testMatchNode2(self): currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) content = conll.load(parentdir + "/test/sampleCoNLLU.conll", verbose=False) self.assertEqual( False, matchPatternOnNode("(* nsubj *|root|*)", content[0].rightChild)) return
def testMatchGeneral1(self): currentdir = os.path.dirname( os.path.abspath(inspect.getfile(inspect.currentframe()))) parentdir = os.path.dirname(currentdir) content = conll.load(parentdir + "/test/sampleCoNLLU.conll", verbose=False) self.assertEqual([content[0].rightChild], matchPattern("(*|root|* nsubj *)", content[0])) match1 = matchPattern("(case *|nmod|*)", content[1]) self.assertEqual(3, len(match1)) self.assertSequenceEqual([4, 14, 18], sorted([item.id for item in match1])) return