How do I get all articles about people from Wikipedia?

自闭症网瘾萝莉.ら 提交于 2019-11-27 02:12:02

问题


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



来源:https://stackoverflow.com/questions/4017166/how-do-i-get-all-articles-about-people-from-wikipedia

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!