def test_de_annotations(self):
        text = "some odd text and Georgien mentioned inside it"
        ants = list(
            get_geoentity_annotations(
                text,
                entity_df,
                preformed_entity={'Entity Type': 'geo entity'},
                priority_sort_column="Entity Priority"))
        self.assertEqual(1, len(ants))
        self.assertEqual((17, 27), ants[0].coords)

        self.assertEqual(999, ants[0].entity_id)
        self.assertEqual('Dummy', ants[0].entity_category)
        self.assertEqual('Georgien', ants[0].source)
        self.assertEqual('Georgien', ants[0].name)
        self.assertEqual('Georgia', ants[0].name_en)
        self.assertEqual(700, ants[0].entity_priority)
        self.assertEqual('GE', ants[0].iso_3166_2)
        self.assertEqual('GEO', ants[0].iso_3166_3)
        self.assertEqual('', ants[0].alias)
Example #2
0
def get_ordered_geo_annotations(text: str) -> List[GeoAnnotation]:
    ants = list(get_geoentity_annotations(text, entity_df))
    ants.sort(key=lambda a: a.coords[0])
    return ants