CSE 675, Spring 2000
RTN PARSER
(Adapted from Allen,
James
(1987),
Natural
Language Understanding (Menlo Park, CA: Benjamin/Cummings), pp. 50ff.)
INPUT: sentence (= sequence of words), with positions marked.
DATA STRUCTURE: parse-state = (current_node * return_points_list)
(* = current word; return_points_list = where to pop back to)
* := first word of sentence;
repeat until * = nil (or no arc can be taken):
case current_arc = cat C & ctgy(*) = C:
update * to next word of sentence;
update current_node to destination of arc;
case current_arc = push P:
add destination of P to return_points_list;
update current_node to start_node of P;
case current_arc = pop:
if return_points_list <> nil
then:
remove first return_point;
update current_node to first return_point;
else:
if * = nil (i.e., endofsent)
then succeed
else fail;
case current_arc = jump:
update current_node to destination of arc
Copyright © 2000 by
William J. Rapaport
(rapaport@cse.buffalo.edu)
file: 675w/rtnparser.23fb00.html