def test_ftype_fcomp(self): catseq = self.build_seq([ ["NP", None, False], ["S/(S\\NP)", "(S\\NP)/NP", False], ["S/NP", ".", False], ["S/NP", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["fwd_raise", "fwd_comp", "r_punct_absorb"], apps)
def test_bappl(self): catseq = self.build_seq([ ["S\\NP", "(S\\NP)\\(S\\NP)", False], ["NP", "S\\NP", True], ["S", ".", False], ["S", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["bwd_appl", "bwd_appl", "r_punct_absorb"], apps)
def test_fappl(self): catseq = self.build_seq([ ["(S/NP)/(S/NP)", "(S/NP)", False], ["(S/NP)" , "NP", False], ["S", ".", False], ["S", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["fwd_appl", "fwd_appl", "r_punct_absorb"], apps)
def test_mixed_fsubst(self): catseq = self.build_seq([ ["(VP\\VP)/VP", "VP/NP", False], ["VP/NP", "(VP\\VP)/NP", True], ["S/VP", "VP/NP", True], ["(N\\N)/(S/NP)", "S/NP", True], ["N\\N", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["fwd_comp", "bwd_xsubst", "fwd_comp", "fwd_appl"], apps)
def test_btype(self): catseq = self.build_seq([ ["NP", None, False], ["S\\(S/NP)", ".", False], ["S\\(S/NP)", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["bwd_raise", "r_punct_absorb"], apps)
def assert_is_unary_conversion(self, frm, to, expect): catseq = self.build_seq([ [frm, None, False], [to, None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual([expect], apps)
def test_funny_conj(self): catseq = self.build_seq([ ["conj", "N", False], ["N", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["funny_conj"], apps)
def test_conjoin(self): catseq = self.build_seq([ ["NP[f]", "NP[conj]", False], ["NP" , "NP[conj]", False], ["NP" , None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["conjoin", "conjoin"], apps)
def test_appositive_comma_absorb(self): catseq = self.build_seq([ [",", "NP", False ], ["(S\\NP)\\(S\\NP)", None, False ]]) apps = list(applications_with_path(catseq)) self.assertEqual(["appositive_comma_absorb"], apps)
def test_punct_conj_with_existing_feature(self): catseq = self.build_seq([ [":", "PP[b]", False], ["PP[b][conj]", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["conj_comma_absorb"], apps)
def test_punct_conj(self): catseq = self.build_seq([ [";", "NP", False], [";", "NP[conj]", True], ["NP[conj]", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["conj_comma_absorb", "conj_comma_absorb"], apps)
def test_mixed_punct_absorb(self): catseq = self.build_seq([ ["NP", ".", False], [",", "NP", True], ["NP", None, False] ]) apps = list(applications_with_path(catseq)) self.assertEqual(["r_punct_absorb", "l_punct_absorb"], apps)