Ejemplo n.º 1
0
    def _prepare(self):
        self.pkuseg = pkuseg.pkuseg(postag=True)

        china_loc = china_location_loader()
        world_loc = world_location_loader()
        self._mapping_china_location(china_loc)
        self._mapping_world_location(world_loc)
Ejemplo n.º 2
0
    def _prepare_world_locations(self):
        world_location = world_location_loader()
        world_list = list()
        world_list.extend(list(world_location.keys()))
        for continent, countries in world_location.items():
            world_list.extend(list(countries.keys()))
            for country, info in countries.items():
                if 'main_city' in info:
                    world_list.extend(info['main_city'])
                world_list.append(info['full_name'])
                world_list.append(info['capital'])

        return world_list