def testExtractorFromUrl(self): ''' test the extractor ''' url = 'https://en.wikipedia.org/wiki/Louvre' e = Extractor(url=url) e.find_geoEntities() self.check(e.places, ['Paris', 'France'])
def testExtractorFromUrl(self): ''' test the extractor ''' url = 'http://www.bbc.com/news/world-europe-26919928' e = Extractor(url=url) e.find_geoEntities() self.check(e.places, ['Russia', 'Kiev', 'Ukraine'])
def testStackoverflow43322567(self): ''' see https://stackoverflow.com/questions/43322567 ''' url = 'https://en.wikipedia.org/wiki/U.S._state' e = Extractor(url=url) places = e.find_geoEntities() self.check(places, ['Alabama', 'Virginia', 'New York']) print(places)
def testStackoverflow54712198(self): ''' see https://stackoverflow.com/questions/54712198/not-only-extracting-places-from-a-text-but-also-other-names-in-geograpypython ''' text = '''Opposition Leader Mahinda Rajapaksa says that the whole public administration has collapsed due to the constitution council’s arbitrary actions. The Opposition Leader said so in response to a query a journalised raised after a meeting held...''' e = Extractor(text) places = e.find_geoEntities() if self.debug: print(places) self.assertEqual([], places)