Extension talk:WikiGrok/Claim suggestions

Discuss stuff here :)

tl;dr
At worst, we can semi-reliably extract a year (of birth/death for people, of formation for bands, and of release for albums) from categories, infoboxes, persondata, and lead sentences, in order of increasing complexity. At best, we can extract the full date from infoboxes, persondata, and lead sentences.

Infoboxes and persondata
Both infoboxes and persondata use templates that, typically, have dates confirming to MOS:YEAR. Extracting dates from infoboxes and persondata then involves some "parsing" of the article's source, probably with a regular expression or two.

Categories
Birth and death categories are a good source of birth/death year suggestions. There are well formed categories for births and deaths in most years from 17th century BC, e.g. Category:1646_BC_deaths to 21st century, e.g. Category:2014_births.

Lead sentences
There isn't any requirement that birth and death dates in lead sentences follow a format or are in a specific position. Biographical articles tend to have the dates following the subject's name, possibly separated by an em dash. Like infoboxes and persondata, extracting dates from lead sentences will require a handful of regular expressions that match a variety of date formats and positions. This shouldn't be a huge performance hit because we're only ever trying to match one sentence.

Generating a corpus of suggestions
There are three approaches to ensuring that WikiGrok has a good corpus of suggestions, which can all share the same extraction code:


 * 1) Bulk extract suggestions from articles for eligible items
 * 2) Extract suggestions when the article is saved by listening to the PageContentSaveComplete or CategoryAfterPageAdded hooks
 * 3) Extract suggestions when suggestions are requested during a WikiGrok game

2 and 3 are complementary. If we only used approach 2, then it'd take a non-trivial amount of time to generate a good corpus of suggestions.