Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

navigate wikipedia categories quickly in a local redis instance

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.md
Octocat-spinner-32 fastcat.py
Octocat-spinner-32 load.py
Octocat-spinner-32 requirements.pip
Octocat-spinner-32 test.py
README.md

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

Something went wrong with that request. Please try again.