ICL Home >> Lab Sessions >> Lab 6
 

Introduction to Computational Linguistics

Lab 6 — Parsing

This lab is based on the NLTK-Lite parsing tutorial.

  1. Start an interactive Python session from the command line, and enter the following statement:

    >>> from nltk_lite.draw.rdparser import demo
    >>> demo()
    

    Experiment using the parser.

  2. Now experiment with the shift reduce parser:

    >>> from nltk_lite.draw.srparser import demo
    >>> demo()
    
  3. Unfortunately, there's a bug in the rdparser and srparser demos which means that you cannot modify the grammar or the input string. However, you can download this zip archive containing some modified versions into your home directory. When you unzip the archive, it will create directory called parse_demo. Change to this directory, and start up the Python interpreter. You should now be able to get a more useful version of the demo working with the commands:

    >>> from rdparser import demo
    >>> demo()
    
    and
    >>> from srparser import demo
    >>> demo()
    

    Now try modifying the grammar and/or the input string. For example, see if you can create small rulesets that allow you to parse old men and women and time flies like an arrow with the structures that you assigned in the Lab exercise 5.


Home : Teaching : Courses : Icl 

Informatics Forum, 10 Crichton Street, Edinburgh, EH8 9AB, Scotland, UK
Tel: +44 131 651 5661, Fax: +44 131 651 1426, E-mail: school-office@inf.ed.ac.uk
Please contact our webadmin with any comments or corrections. Logging and Cookies
Unless explicitly stated otherwise, all material is copyright © The University of Edinburgh