Esempio n. 1
0
    def test_attribution(self):
        itm = p.Attribution('Ot', 'Comm', 'Null', 'Null')
        xml = x._Attribution_xml(itm)
        self.assertEqual(itm, x._read_Attribution(xml))

        itm_sel = p.Selection(span=[(9, 35)],
                              gorn=[
                                  p.GornAddress([0, 0]),
                                  p.GornAddress([0, 1, 0]),
                                  p.GornAddress([0, 1, 2]),
                                  p.GornAddress([0, 2])
                              ],
                              text='CenTrust Savings Bank said')
        itm = p.Attribution('Ot', 'Comm', 'Null', 'Null', itm_sel)
        xml = x._Attribution_xml(itm)
        self.assertEqual(itm, x._read_Attribution(xml))
Esempio n. 2
0
File: pdtbx.py Progetto: tjane/educe
def _read_Attribution(node):
    attr = node.attrib
    selection = on_single_element(node, (), _read_Selection, 'selection')
    return ty.Attribution(polarity=attr['polarity'],
                          determinacy=attr['determinacy'],
                          type=attr['type'],
                          source=attr['source'],
                          selection=None if selection is () else selection)
Esempio n. 3
0
 def test_implicit_features_1(self):
     expected_attr = p.Attribution('Wr', 'Comm', 'Null', 'Null')
     expected_conn = p.Connective('also',
                                  p.SemClass(['Expansion', 'Conjunction']))
     expected = p.ImplicitRelationFeatures(expected_attr, expected_conn,
                                           None)
     txt = ex_implicit_attribution
     self.assertParse(p._implicitRelationFeatures, expected, txt)
Esempio n. 4
0
 def test_implicit_features_2(self):
     expected_conn1 = p.Connective(
         'in particular',
         p.SemClass(['Expansion', 'Restatement', 'Specification']))
     expected_conn2 = p.Connective(
         'because', p.SemClass(['Contingency', 'Cause', 'Reason']))
     expected_attr = p.Attribution('Wr', 'Comm', 'Null', 'Null')
     expected = p.ImplicitRelationFeatures(expected_attr, expected_conn1,
                                           expected_conn2)
     txt = ex_implicit_features
     self.assertParse(p._implicitRelationFeatures, expected, txt)
Esempio n. 5
0
 def test_attribution_sel(self):
     expected_sel = p.Selection(span=[(9, 35)],
                                gorn=[
                                    p.GornAddress([0, 0]),
                                    p.GornAddress([0, 1, 0]),
                                    p.GornAddress([0, 1, 2]),
                                    p.GornAddress([0, 2])
                                ],
                                text='CenTrust Savings Bank said')
     expected = p.Attribution('Ot', 'Comm', 'Null', 'Null', expected_sel)
     txt = ex_attribution2
     self.assertParse(p._attributionFeatures, expected, txt)
Esempio n. 6
0
 def test_attribution(self):
     expected = p.Attribution('Ot', 'Comm', 'Null', 'Null')
     txt = ex_attribution1
     self.assertParse(p._attributionFeatures, expected, txt)