Skip to content

dnet/wp-megye

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Parser for Hungarian county list of Wikipedia

Wikipedia has a list of Hungarian cities, and this library parses it into city -> county tuples or dictionary.

generator module

The following functions of the generator module can be used to parse the input.

  • generate_items is a generator and yields (city, county) tuples
  • generate_dict returns a city -> county dictionary
  • generate_pickled saves such a dictionary into a Pickle file

The generator module can also be called from the command line with a file argument, as it can be seen in the following example.

$ python generator.py output.pickle

lookup module

The lookup modules has a Lookup class, which can be instantiated with a string parameter having the name of a Pickle file generated by generator. The get method can be used to get the county associated with a certain city. The lookup module can also be called from the command line with two arguments as it can be seen in the following example.

$ python lookup.py test.pickle Budapest
Budapest

License

The whole project is available under MIT license.

Dependencies

  • Python 2.x (tested on 2.7.3)
  • lxml (Debian/Ubuntu package: python-lxml)

About

Parser for Hungarian county list of Wikipedia

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages