Example #1
0
 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)
Example #2
0
 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)
Example #3
0
 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)
Example #4
0
 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)
Example #5
0
 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)
Example #6
0
 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)
Example #7
0
 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)
Example #8
0
 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)
Example #9
0
 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)
Example #10
0
 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)
Example #11
0
 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)
Example #12
0
 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)