-
Notifications
You must be signed in to change notification settings - Fork 78
Infoboxes
Steve edited this page Aug 14, 2017
·
11 revisions
We're getting the Infoboxes from parse tree XML, and converting it to a dict with utils.template_to_dict.
Example:
>>> gandhi.infobox {'alma_mater': [[University College London]]<ext><name>ref</name><attr/><inner>{{cite book|author1=Jeffrey M. Shaw |author2=Timothy J. Demy |title=War and Religion: An Encyclopedia of Faith and Conflict |url=https://books.google.com/books?id=KDlFDgAAQBAJ&pg=PA309|year=2017|publisher=ABC-CLIO|isbn=978-1-61069-517-6|pages=309 }}</inner><close></ref></close></ext><br>[[Inner Temple]]', 'alt': u'The face of Gandhi in old age\u2014smiling, wearing glasses, and with a white sash over his right shoulder', 'birth_date': '{{Birth date|df|=|yes|1869|10|2}}', 'birth_name': 'Mohandas Karamchand Gandhi', 'birth_place': [[Porbandar State]], [[Kathiawar Agency]], [[British Indian Empire]]<ext><name>ref</name><attr> name="Gandhi DOB"</attr><inner>[[#Rajmohan|Gandhi, Rajmohan (2006)]] [https://books.google.com/?id=FauJL7LKXmkC pp. 1–3].</inner><close></ref></close></ext><br />(now in [[Gujarat]], India)', 'children': '{{hlist|[[Harilal Gandhi|Harilal]]|[[Manilal Gandhi|Manilal]]|[[Ramdas Gandhi|Ramdas]]|[[Devdas Gandhi|Devdas]]}}', 'death_cause': '[[Assassination of Mahatma Gandhi|Assassination]]', 'death_date': '{{Death date and age|df|=|yes|1948|1|30|1869|10|2}}', 'death_place': 'New Delhi, [[Delhi]], [Dominion of India] (now India)', 'father': '[[Karamchand Uttamchand Gandhi|Karamchand Gandhi]]', 'honorific_prefix': '[[Mahatma]]', 'image': 'MKGandhi.jpg', 'known_for': [[Indian Independence Movement]],<br>[[Peace movement]]', 'mother': 'Putlibai Gandhi', 'movement': '[[Indian independence movement]]', 'name': 'Mohandas Karamchand Gandhi', 'occupation': '{{hlist|Lawyer|Politician|Activist|Writer|Soldier}}', 'other_names': 'Mahatma Gandhi, Bapu, Gandhiji', 'party': '[[Indian National Congress]]', 'resting_place': [[Raj Ghat and associated memorials|Raj Ghat]], Delhi', 'signature': 'Mohandas K. Gandhi signature.svg', 'spouse': '{{marriage|[[Kasturba Gandhi]]|1883|1944|end|=|died}}'}
Getting data from Infoboxes may be unavoidable, but getting Wikidata (via page.get_wikidata()) is preferred. Wikidata is structured but sometimes data poor, while Infoboxen are unstructured and frequently data rich. Please consider updating Wikidata if the information you want is only available in a MediaWiki instance so that others may benefit from open, linked data.