Skip to content
/ fastcat Public

navigate wikipedia categories quickly in a local redis instance

Notifications You must be signed in to change notification settings

edsu/fastcat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fastcat

fastcat is a little Python library for quickly looking up broader/narrower relations in Wikipedia categories locally. The idea is that fastcat can be useful in situations where you need to rapidly lookup category relations, but don't want to hammer on the Wikipedia API. fastcat relies on redis, and a SKOS file that dbpedia make available based on the Wikipedia MySQL dumps.

Usage

The first time you import fastcat you'll need to populate your redis database with the category data from dbpedia. To do that instantiate a FastCat object and call the load method. After that you can use it to do lookups.

>>> import fastcat
>>> f = fastcat.FastCat()
>>> f.load()
...
>>> print fastcat.broader("Computer programming")
['Software engineering', 'Computing']
>>> print fastcat.narrower("Computer programming")
['Programming idioms', 'Programming languages', 'Concurrent computing', 'Source code', 'Refactoring', 'Data structures', 'Programming games', 'Computer programmers', 'Version control', 'Anti-patterns', 'Programming constructs', 'Algorithms', 'Web Services tools', 'Programming paradigms', 'Software optimization', 'Debugging', 'Computer programming tools', 'Computer libraries', 'Programming contests', 'Archive networks', 'Self-hosting software', 'Educational abstract machines', 'Software design patterns', 'Computer arithmetic']

Install

To install and load fastcat on Ubuntu try this:

  1. apt-get install redis-server virtualenvwrapper git-core
  2. git clone git://github.com/edsu/fastcat.git
  3. cd fastcat
  4. mkvirtualenv fastcat
  5. pip install -r requirements.pip
  6. ./load.py
  7. brew a pot of coffee while the data is downloaded and loaded into redis
  8. profit?

License

Creative Commons Attribution-ShareAlike 3.0

About

navigate wikipedia categories quickly in a local redis instance

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages