Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
0
def _read_ImplicitRelationFeatures(node):
    connectives = node.findall('connective')
    if len(connectives) == 0:
        raise EduceXmlException('Was expecting at least one connective (got none)')
    elif len(connectives) > 2:
        raise EduceXmlException('Was expecting no more than two connectives (got %d)' % len(connectives))

    attribution = on_single_element(node, None, _read_Attribution, 'attribution')
    connective1 = _read_Connective(connectives[0])
    connective2 = _read_Connective(connectives[1]) if len(connectives) == 2 else None
    return ty.ImplicitRelationFeatures(attribution = attribution,
                                       connective1 = connective1,
                                       connective2 = connective2)