Extracting structured information from text

IA161 NLP in Practice Course, Course Guarantee: Aleš Horák

Prepared by: Zuzana Nevěřilová

State of the Art

Information extraction (IE) is a technology based on analyzing natural language in order to extract snippets of information. The process takes texts (and sometimes speech) as input and produces fixed-format, unambiguous data as output. This data may be used directly for display to users, or may be stored in a database or spreadsheet for later analysis, or may be used for indexing purposes in information retrieval (IR) applications such as Internet search engines like Google.


  1. Cunningham, Hamish. An Introduction to Information Extraction. Encyclopedia of Language and Linguistics, 2nd Edition. Elsevier, 2005.
  2. Piskorski, J. and Yangarber, R. Information Extraction: Past, Present and Future, pages 23–49. Springer Berlin Heidelberg, Berlin, Heidelberg, 2013.
  3. Aydar, Mehmet, Ozge Bozal, and Furkan Ozbay. Neural relation extraction: a survey. arXiv e-prints (2020): arXiv-2007.

Practical Session

We will extract information from news articles using GATE.

  1. Create <YOUR_FILE>, a text file named ia161-UCO-08.txt where UCO is your university ID.
  2. Download and install GATE (Java 8 is necessary) from Either run the MS installer or the Java installer, install and run as app or in the command line:
    java -jar gate-<VERSION>-installer.jar
  3. Run GATE
  4. Load ANNIE (with defaults), read about its components
  5. Create document(s):
    • right click on Language Resources/New/GATE Document in the left menu
    • change markupAware to false
    • change sourceUrl to stringContent and paste some news text
    • repeat these steps
    • you can find three sample texts here: text1.txt, text2.txt, text3.txt
  6. Create corpus:
    • right click on Language Resources/New/GATE Corpus in the left menu
    • drag and drop the document in order to put them into the corpus
  7. Run ANNIE: Click on Applications/Annie in the left menu, select Corpus
  8. Observe the annotated results, click on a document, then Annotation Sets and/or Annotation List.

So far, GATE did not much more than Stanford NER. Note, however, that all tokens are annotated and POS-tagged. Also note the annotation type Lookup.

We add rules for extracting job titles and the respective person names. The rules are defined in the grammars jobtitle.jape and jobtitleperson.jape

  1. Right click Processing Resources/New/JAPE Transducer in the left menu
  2. Download the grammar(s).
  3. Click on grammmarUrl and choose the grammar file jobtitle.jape
  4. Click on Applications/Annie in the left menu and add the JAPE Transducer to the ANNIE pipeline (Selected Processing Resources)
  5. Run ANNIE again: Click on Applications/Annie in the left menu
  6. Observe the annotated results, click on a document, then Annotation Sets and/or Annotation List. If applicable, you can see new annotation JobTitle.
  7. Observe the grammars jobtitle.jape and jobtitleperson.jape
  8. Add new transducer with the grammar jobtitleperson.jape and observe the results.
  9. Optionally, you can add further documents and observe how universal the jobtitleperson.jape grammar is.
  10. According to the above grammars, write your own that extracts new relations (e.g. job title in company or person works in company).

Write your observations to <YOUR_FILE>: Particularly, comment how well the Gazetteer and NE Transducer perform, describe how well the grammar works. Note that no coreference resolution is used (optionally, you can try one). Copy your grammar from the last point to <YOUR_FILE>.

Last modified 22 months ago Last modified on Aug 30, 2022, 10:39:15 AM

Attachments (10)

Download all attachments as: .zip