<< Prev | - Up - |
Modify the chart parser such that all its edges are named and have reference to the names of their childs. For instance, the chart for the sentence john runs
should contain edges of the following form:
[edge(begin:1 cat:s 'end':3 id:17 ids:[16 12])
edge(begin:1 cat:s 'end':8 id:18 ids:[16 13])
edge(begin:1 cat:s 'end':8 id:19 ids:[16 15])
edge(begin:1 cat:s 'end':5 id:20 ids:[16 14])
edge(begin:1 cat:np 'end':2 id:16 ids:[1])
edge(begin:1 cat:pn 'end':2 id:1 ids:nil)
edge(begin:2 cat:vp 'end':3 id:12 ids:[2])
edge(begin:2 cat:vp 'end':8 id:13 ids:[2 11])
edge(begin:2 cat:vp 'end':8 id:15 ids:[14 9])
edge(begin:2 cat:vp 'end':5 id:14 ids:[2 10])
edge(begin:2 cat:v 'end':3 id:2 ids:nil)
edge(begin:3 cat:np 'end':8 id:11 ids:[10 9])
edge(begin:3 cat:np 'end':5 id:10 ids:[3 4])
edge(begin:3 cat:det 'end':4 id:3 ids:nil)
edge(begin:4 cat:n 'end':5 id:4 ids:nil)
edge(begin:5 cat:pp 'end':8 id:9 ids:[5 8])
edge(begin:5 cat:prep 'end':6 id:5 ids:nil)
edge(begin:6 cat:np 'end':8 id:8 ids:[6 7])
edge(begin:6 cat:det 'end':7 id:6 ids:nil)
edge(begin:7 cat:n 'end':8 id:7 ids:nil)]
The name (identity) of an edge can be an arbitrary Oz value, for instance the integers 10 11 12 13 14
as above.
Write a functional procedure ChartToParseTrees
that computes the set of parse trees from a chart with named edges. If you have not solved the previous excercise then simply compute the parse trees constructable from the above list of edges for the sentence [john runs]
.
Define a stack that inspects everything that is pushed onto it. Hint: Use the function Record.adjoin
.
Write a chart parser with window output in Oz. Use the chart parser functor of the previous excercise and the functor at the URL:
http://www.ps.uni-sb.de/~niehren/oz-course.html/Functors/Version.3.2/ChartToWindow.ozf.
What is the meaning of the symbol ! in pattern matching statements, as used in procedure Process
?
<< Prev | - Up - |