Exemple #1
0
 def test_parse_de_definitions_simple(self):
     parser = make_es_definitions_parser()
     text = load_resource_document('lexnlp/extract/es/definitions/eula.txt',
                                   'utf-8')
     ret = parser.parse(text)
     self.assertGreater(len(ret), 4)
     annotate_definitions_text(text, ret, 'output/es_definitions_01.html')
    def test_parse_de_definitions_simple(self):
        text = load_resource_document('lexnlp/extract/de/sample_de_definitions01.txt', 'utf-8')
        ret = get_definition_list(text)
        self.assertGreater(len(ret), 5)

        start = ret[0].coords[0]
        end = ret[0].coords[1]
        def_name = ret[0].name
        self.assertTrue("Diensteanbieter" in def_name)
        definition = text[start:end]
        self.assertTrue(def_name in definition)
        annotate_definitions_text(text, ret, 'output/de_definitions_01.html')
    def test_parse_de_definitions_simple(self):
        parser = make_de_definitions_parser()
        text = load_resource_document('lexnlp/extract/de/sample_de_definitions01.txt', 'utf-8')
        ret = parser.parse(text)
        assert len(ret) > 5

        start = ret[0]['attrs']['start']
        end = ret[0]['attrs']['end']
        def_name = ret[0]['tags']['Extracted Entity Definition Name']
        assert "Diensteanbieter" in def_name
        definition = text[start:end]
        assert def_name in definition
        annotate_definitions_text(text, ret, 'output/de_definitions_01.html')