README
npm install wtf-plugin-person
A plugin that finds birth date, birth place
, and death date
information for people, in its various places in a wikipedia article.
const wtf = require('wtf_wikipedia')
wtf.extend(require('wtf-plugin-person'))
;(async () => {
await wtf.fetch('David Phillips (entrepreneur)').birthDate()
// {year: 1964, month:null, date:null}
})()
Notes:
This library assumes that every article you give it is about a person. You may want to use it in conjunction with wtf-plugin-classify to ensure that a page is first about a person, and not a place, or musical group:
wtf.fetch('Billy Elliot').then((doc) => {
let res = doc.classify() // 'CreativeWork/Play'
if (res.root === 'Person') {
console.log(doc.birthPlace())
}
})
.birthDate()
returns month
, year
and date
properties, or a null response
- looks at varous person-infoboxes, like
Infobox officeholder
orInfobox ice hockey player
- looks at first-sentence parentheses, like
'Wayne Douglas Gretzky CC (/ˈɡrɛtski/; born January 26, 1961) is a ...'
- looks at category information, like
'Category:1933 births'
.birthPlace()
returns a string - and a wikipedia article title, if possible
- looks at varous person infoboxes
- looks at category information, like
'Category:People from Geneva'
.isAlive()
returns true
, false
, or null
for unknown result.
- looks for a
.deathDate()
or.deathPlace()
result - looks at category information, like
Category:Dead people
- looks at template information, like
{{WikiProject Biography|living=yes }}
.deathDate()
same as .birthDate()
.deathPlace()
same as .birthPlace()
work-in-progress
MIT