ICL Home >> Lab Sessions >> Lab 5
 

Introduction to Computational Linguistics

Lab 5 — Trees and Grammatical Analysis

This lab is based on the NLTK-Lite parsing tutorial and the lecture on Context Free Grammars.

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

>>> from nltk_lite.parse.tree import Tree

Following the suggestions in the NLTK_Lite Parsing Tutorial, experiment using the Tree constructor to build some trees. NB: assuming you have already defined tree1 (e.g. as an NP structure), you can build a nested tree with the following statement:

>>> tree2 = Tree('S', [ tree1, Tree('VP' , ['walked'])])

You can get a graphical version of your tree with the command

>>> tree2.draw()

Next, give the command

>>> from nltk_lite.parse import bracket_parse

Experiment building some trees using the labeled bracket notation given in the tutorial, parsing them with bracket_parse, and drawing them with the draw() method.

In the next part of this tutorial, you need to think a bit about assigning structures to English phrases and sentences.

  1. The phrase old men and women is ambiguous. Construct two trees for each interpretation, using one of the tree-building methods above.
  2. Do the same for Lee likes bananas or peaches and cream.
  3. Consider the following contrasts:
    • *There was a student of French and also one of Spanish.
    • There was a student from France and also one from Spain.
    On the basis of this data, consider whether of French and from France should be considered as arguments of the head noun or as modifiers. Assuming that arguments are represented as sisters of N, while modifiers are sisters of Nom, construct trees for the relevant noun phrases to illustrate your analysis.
  4. Draw a tree for Lee can pay and must pay. Can you think of other data which would help determine whether can pay is a constituent?
  5. Assume that eating is of the category V_ing, that it can be the head of a VP_ing phrase, and that likes can take arguments of category VP_ing. Draw a tree for Kim likes eating squid. Now consider the sentence Kim likes smiling faces. Should it have the same structure, and if not, what should its analysis be?
  6. Construct two trees for Time flies like an arrow. (Assume like can be both a preposition and a verb.)


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