Exemplo 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))
Exemplo n.º 2
0
Arquivo: pdtbx.py Projeto: 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)
Exemplo 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)
Exemplo 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)
Exemplo 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)
Exemplo n.º 6
0
 def test_attribution(self):
     expected = p.Attribution('Ot', 'Comm', 'Null', 'Null')
     txt = ex_attribution1
     self.assertParse(p._attributionFeatures, expected, txt)