General
Lab Material
Lab 1 (NL Recognizer)
Lab 2 (Parsing)
Lab 3 (Semantics, NL Generation)
Lab 4 (Formal Grammars)
Lab 5 (NL Parser)
Lab 6 (L4NLP)

Lab 5 (Long Distance Dependencies): Exercises

In this page you find two sets of exercises (CTL and CFG). If you had problems with the Prolog exercises of the first labs or don't feel familiar enough with PROLOG, you can skip the second one and focus your attention on the CTL exercises.

Categorial Type Logic

Exercise 1


ERRATA CORRIGE: I have been just told by Konrad that russel is not accessible from out side the university network. Hence you cannot use GRAIL.

Possibile solutions:

  • a) Try accessing via ssh fermi.inf.unibz.it using your windows-login and windows-password. With scp copy the file from russel to fermi and submit this URL.
  • b) you have a web page somewherelse.b) Try what Konrad suggests:
  • you sent me the files, and I send you back the results.

As a first step, create in your account in russel a directory called public_html (this create the URL: http://russel.inf.unibz.it/~yourlogin/.) Download this fragment of CTL and save it under public_html.). Submit it to GRAIL by providing the URL of the file (i.e. http://russel.inf.unibz.it/~yourlogin/filename.) Test it with the sentences you find at the end of the file (by clicking on each of them).

Exercise 2

Use the sample fragment of exercise 1 to write in PROLOG the CG grammar you have obtained last time that corresponds to the CFG below and submit it to GRAIL.

s --> np vp
vp --> iv
vp --> tv np
vp --> vp adv
vp --> cop adj
vp --> dtv np pp
pp --> p np
p --> to
adv --> slowly
cop --> is
np --> pn
np --> det n
n --> adj n
det --> the, a
pn --> john, peter
n --> man, horse
iv --> walks, swears
tv --> eats, makes
adj --> green, big
dtv --> gave

Add some sentences at the end of the file, to test your solution.

Exercise 2

Modify the fragment of CTL you have built so to rule out sentences like *John is big slowly. Try the new solution with Grail.

Exercise 3

Test the solutions you have found for the exercises 8-10 seen in class yesterday --you can skip the part on the lambda term if you don't fill confortable with PROLOG notation of terms.

CFG

Gap-features

Think of the first use of the gap-feature we have looked at in class by testing this file

First, check that this little DCG handles ordinary sentences:

s(_,[harry,likes,the,witch],[]).

(It should say "yes")

Now check that we can build relative clauses. First, object position relativization:

np(_,[the,witch,who,harry,likes],[]).
(It should say "yes")

Now subject position relativization:

np(_,[harry,who,likes,the,witch],[]).
(It should say "yes")

s(_,[a,house-elf,likes,a,house-elf,who,a,witch,likes],[]).
(It should say "yes")

Use traces to understand what happens.

Relative pronoun and different subcategorization pattern

Test the extended DCG discussed in class with the following sentences:
  • ``The witch gave the house-elf to Harry''.
  • ``the house-elf who the witch gave to Harry''.
  • ``Harry, who the witch gave the house-elf to''.
  • ``The house-elf who the wizard gave''

Gap Threading

Try to understand how the gap threading solution work by testing this file to analayse the sentences below.
  • ``The witch gave the house-elf to Harry''.
  • ``the house-elf who the witch gave to Harry''.
  • ``Harry, who the witch gave the house-elf to''.
  • ``The house-elf who the wizard gave''