INF347, Télécom ParisTech

Information Extraction

Fabian Suchanek (fabian@LASTNAME.name)

24th of June 2011

 

The purpose of this lab session is to extract structured information from a natural language text corpus.

Data Set

Our corpus will be the Simple English Wikipedia (http://simple.wikipedia.org/), a simpler and smaller encyclopedia than the regular English Wikipedia). The whole content of the encyclopedia can be downloaded from http://dumps.wikimedia.org/. For these labs, we provide the data in the following forms:

We provide the following classes:

  1. a class Page, which represents a page in Wikipedia.
  2. a class Parser, which allows iterating over the pages of a Wikipedia corpus.
  3. a class Triple, which represents a triple of subject, predicate and object.

Tasks

For all of the following, go for precision rather than recall.
  1. Create an abstract class Extractor, which has a method extract(Page):Triple. Create a simple extractor, TestExtractor, which produces triples of the form <PageTitle, is, processed>. Create a class InformationExtractor, which has only one method: run. This method takes as input a corpus file, a target file and a list of extractors. It iterates over all pages in the corpus, calls all extractors and writes the triples, TAB-separated, into the target file. Test this method with the TestExtractor on the small sample corpus.
  2. Write an extractor DateExtractor that uses a regular expression to find the first date mentioned in the article. Let it return a triple of the form <PageTitle, hasDate, Date>. Try the extractor with the pages of Elvis Presley and Alan Turing. If you are adventurous, try normalizing the dates you extract to the form [-]YYYY-MM-DD. Regular expressions work as follows in Java:
    Pattern pattern=Pattern.compile(EXPRESSION);
    Matcher matcher=pattern.matcher(STRING);
    while(matcher.find()) {
      // matcher.group(N) holds the N-th group of the match
      // matcher.group() holds the entire match
    }
    Use named regular expressions. Measure the precision on 20 output pairs manually, hand in the results.
  3. Write an extractor TypeExtractor that extracts the type of the article entity ("Leicester is a city"). Manually exclude terms that are too abstract ("member of...", "way of..."). The results should be triples of the form <PageTitle, is_a, Type>. A triple is correct if Type is the answer to the question "What is PageTitle?" ("What is Leceister?" — "Leceister is a city!").
    Measure the precision on 20 output pairs manually, hand in the results.
  4. Write an extractor LocationExtractor that extracts the location of a place ("Hollywood is a district in Los Angeles"). Alternatively or additionally: Write a TypeAndLocationExtractor, which first calls the TypeExtractor, checks if the article entity is a city, district, etc., and, if so, extracts the location. Measure the precision on 20 output pairs manually, hand in the results.

To go further

  1. Write extractors that work on the full version of the simple Wikipedia. In this version, you can use the infoboxes to extract birth dates (e.g., for Elvis Presley), or population numbers (e.g., for Paris).