2

I'm using dbpedia spotlight to do NER. I would like to map each entity to wikipedia categories he's under. Is there an easy way to do this?

A simple example might be if I recognized the basketball player Michael Jordan I would want to fetch the categories he's under, probably NBA Players, Sports, Chicago Bulls Past Players, Etc...

Noam
  • 3,341
  • 4
  • 35
  • 64
  • Have you actually looked at [the categories Michael Jordan is in](https://en.wikipedia.org/wiki/Michael_Jordan#catlinks) on Wikipedia? – svick Aug 12 '14 at 17:01
  • @svick I was hoping there might be a dbpedia entity per category. Is there a Wikipedia API to get the categories like in the link you showed? – Noam Aug 13 '14 at 11:50

1 Answers1

2

In DBpedia, Wikipedia categories are represented using the dcterms:subject property. So, to retrieve the categories for Michael Jordan, you can use SPARQL like:

PREFIX : <http://dbpedia.org/resource/>
PREFIX dcterms: <http://purl.org/dc/terms/>

SELECT ?cat WHERE {
    :Michael_Jordan dcterms:subject ?cat
}

Wikipedia also has an API to get categories of an article, using the categories module.

svick
  • 236,525
  • 50
  • 385
  • 514
  • Note that the MediaWiki API by default lists all categories, including hidden categories. Add `&clshow=!hidden` to remove them. – leo Aug 13 '14 at 20:44