How do I get all articles about people from Wikipe

2019-01-17 23:18发布

问题:

What would be the easiest way to get all articles about people from Wikipedia? I know I can download a dump of all the pages, but then how do I filter those and get only the ones about people? I need as many as I can get (preferably more than a million) so using any sort of API is probably not an option.

回答1:

Since articles about people usually contain the Persondata template, you can just search for all articles that contain Persondata. You can find a sample API query for doing just that here:

Does the Wikipedia API support searches for a specific template?



回答2:

As of 2014 you have another option: Query WikiData for all entities where the property instance of (P31) has the value human (Q5).

Full list of humans: https://www.wikidata.org/wiki/Special:WhatLinksHere/Q5

From that list, filter out any thing that doesn't have a sex or gender (P21), to get rid of pages like “scientist”

This way, you don't need to keep track of what templates are used for people in each and every different language edition (there are 285) of Wikipedia.



回答3:

If you are going to roll out on your own, basically what you need is to focus is on the "infobox data" in the XML dump.

Reference: http://code.google.com/p/infobox2rdf/

Or you can also checkout the http://www.freebase.com or http://dbpedia.org