Beispiel #1
0
    def test_modifier(self):
        new_syntax = merge_primary_and_syntax("NP V NP", "Agent V Patient<+plural>")
        xml = xml_of_syntax(new_syntax)
        self.assertEqual(
            ET.tostring(xml, encoding="unicode"),
            '<SYNTAX><NP value="Agent"><SYNRESTRS /></NP><VERB /><NP modifier="+plural" value="Patient"><SYNRESTRS /></NP></SYNTAX>',
        )

        new_syntax = merge_primary_and_syntax("NP se V ADV", "Patient se V<+middle> ADV")
        xml = xml_of_syntax(new_syntax)
        self.assertEqual(
            ET.tostring(xml, encoding="unicode"),
            '<SYNTAX><NP value="Patient"><SYNRESTRS /></NP><VERB pronominal="true" restr="middle" /><ADV /></SYNTAX>',
        )
Beispiel #2
0
 def test_pp_category(self):
     new_syntax = merge_primary_and_syntax("NP V PP", "Agent V {{+loc}} Patient")
     xml = xml_of_syntax(new_syntax)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         '<SYNTAX><NP value="Agent"><SYNRESTRS /></NP><VERB /><PREP><SELRESTRS><SELRESTR Value="+" type="loc" /></SELRESTRS></PREP><NP value="Patient"><SYNRESTRS /></NP></SYNTAX>',
     )
Beispiel #3
0
 def test_simple_sentence(self):
     new_syntax = merge_primary_and_syntax("NP V NP", "Agent V Patient")
     xml = xml_of_syntax(new_syntax)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         '<SYNTAX><NP value="Agent"><SYNRESTRS /></NP><VERB /><NP value="Patient"><SYNRESTRS /></NP></SYNTAX>',
     )
Beispiel #4
0
 def test_p(self):
     new_syntax = merge_primary_and_syntax("NP V Qu Psubj", "Agent V Topic<+Qu Psubj>")
     xml = xml_of_syntax(new_syntax)
     print(new_syntax)
     print(xml)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         "<SYNTAX>" '<NP value="Agent"><SYNRESTRS /></NP>' "<VERB />" '<PSUBJ value="Topic" />' "</SYNTAX>",
     )
Beispiel #5
0
 def test_vinf_direct(self):
     new_syntax = merge_primary_and_syntax("NP V de V-inf", "Pivot V Theme<+de VPivot-inf>")
     xml = xml_of_syntax(new_syntax)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         "<SYNTAX>"
         '<NP value="Pivot"><SYNRESTRS /></NP>'
         "<VERB />"
         '<VINF emptysubjectrole="Pivot" introduced_by="de" value="Theme" />'
         "</SYNTAX>",
     )
Beispiel #6
0
 def test_vinf_indirect(self):
     new_syntax = merge_primary_and_syntax("NP V de V-inf", "Pivot V {de} Theme<+VSource-inf>")
     xml = xml_of_syntax(new_syntax)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         "<SYNTAX>"
         '<NP value="Pivot"><SYNRESTRS /></NP>'
         "<VERB />"
         '<PREP><SELRESTRS><SELRESTR Value="de" /></SELRESTRS></PREP>'
         '<VINF emptysubjectrole="Source" value="Theme" />'
         "</SYNTAX>",
     )
Beispiel #7
0
 def test_dece_quep(self):
     self.maxDiff = None
     new_syntax = merge_primary_and_syntax("NP V PP de ce Qu Pind", "Agent V {avec} Co-Agent {de} Topic<+Qu Pind>")
     xml = xml_of_syntax(new_syntax)
     self.assertEqual(
         ET.tostring(xml, encoding="unicode"),
         "<SYNTAX>"
         '<NP value="Agent"><SYNRESTRS /></NP>'
         "<VERB />"
         '<PREP><SELRESTRS><SELRESTR Value="avec" /></SELRESTRS></PREP>'
         '<NP value="Co-Agent"><SYNRESTRS /></NP>'
         '<PREP><SELRESTRS><SELRESTR Value="de" /></SELRESTRS></PREP>'
         '<PIND introduced_by="de" value="Topic" />'
         "</SYNTAX>",
     )