Exemplo n.º 1
0
 def test_by_slash6(self):
     # slash index                   2  1  0  3
     catseq = self.build_seq([ ["((a\\b)/b)/(c/d)", "c/d", False ],
                          ["(a\\b)/b", "b", False ],
                          ["b", "a\\b", True],
                          ["a", None, False] ])
     apps = list(applications_per_slash_with_path(catseq, 4))
     self.assertEqual([ "fwd_appl", "fwd_appl", "bwd_appl", None ], apps)
Exemplo n.º 2
0
 def test_by_slash3(self):
     # slash index:              4  3  2  1  0
     catseq = self.build_seq([ ["((((a/b)/c)/d)/e)/f", None, False],
                          ["g/(g\\(((((a/b)/c)/d)/e)/f))", ",", False],
                          ["g/(g\\(((((a/b)/c)/d)/e)/f))", "g\\(((((a/b)/c)/d)/e)/f)", False],
                          ["g", None, False] ])
     apps = list(applications_per_slash_with_path(catseq, 5))
     self.assertEqual([ None, None, None, None, None
                  ], apps)
Exemplo n.º 3
0
 def test_by_slash_mixed(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_per_slash_with_path(catseq, 2))
     self.assertEqual(["fwd_comp", # slash 0
                   None],#"bwd_xsubst"], # slash 1
                   apps)
Exemplo n.º 4
0
 def test_by_slash(self):
     catseq = self.build_seq([ ["S\\NP", "(S\\NP)\\(S\\NP)", True],
                          ["NP", "S\\NP", True],
                          ["S",    ".", False],
                          ["S", None, False] ])
     
     apps = list(applications_per_slash_with_path(catseq, 3))
     self.assertEqual(["bwd_appl", # slash 0
                   "bwd_appl", # slash 1
                    None], apps)
Exemplo n.º 5
0
 def test_by_slash2(self):
     # slash index:           1  2  3  4     0  5
     catseq = self.build_seq([ ["(C/(D/(E/(F/G))))/(A/B)", "(A/B)/C", False],
                          ["(C/(D/(E/(F/G))))/C", "C", False],
                          ["C/(D/(E/(F/G)))", "D/(E/(F/G))", False],
                          ["C", None, False] ])
     
     apps = list(applications_per_slash_with_path(catseq, 6))
     self.assertEqual(["fwd_comp",
                   "fwd_appl",
                   None,
                   None,
                   None,
                   None], apps)
Exemplo n.º 6
0
 def test_by_slash5(self):
     catseq = self.build_seq([ ["a/b", ",", False],
                          ["a/b", None, False] ])
     apps = list(applications_per_slash_with_path(catseq, 1))
     # Defines comma absorption as consuming the slash (although it doesn't)
     self.assertEqual([None], apps)
Exemplo n.º 7
0
 def test_by_slash4(self):
     catseq = self.build_seq([ ["a/b", None, False],
                          ["t/(t\\(a/b))", None, False] ])
     apps = list(applications_per_slash_with_path(catseq, 1))
     self.assertEqual([ None ], apps)