-
Notifications
You must be signed in to change notification settings - Fork 0
RDG
Alto supports grammars in the Regular Dependency Grammar formalism. RDG is a dependency grammar formalism which is strongly equivalent to (slightly restricted) LCFRS; in particular, it can describe non-projective dependency structures.
Alto can read RDG grammars (with filename extension .rdg
) in a file format that looks pretty much like one would write RDGs on paper:
S -> <wird:101>(VP)
VP -> <gegeben:1,20>(NP, NP)
NP -> <hans:0>
NP -> <kaesebrot:10>(Det)
Det -> <ein:0>
Each rule expands a nonterminal symbol (such as S
or VP
) into a right-hand side, which may specify a number of nonterminals as children and connects them with a terminal symbol of the form <word:oa>
. Here word
is a word that may appear in the string, and oa
is an order annotation, which specifies how the string tuples derived by the nonterminals on the right-hand side are combined into a string tuple for the parent nonterminal. Each order annotation may contain an arbitrary number of blocks, which are separated by commas.
Unlike in the standard RDG literature, a comma may occur as the first or last character of an order annotation, indicating a string tuple where the first or last block is an empty string. Thus for instance, the order annotation ,0
describes a pair of strings; the first element of the pair is an empty string, and the second element of the pair is the word itself.
RDGs in Alto always use the start symbol S
.
You can load an RDG grammar (with filename extension .rdg
) from the Alto GUI, using File -> Load IRTG. This will open a grammar window, from which you can parse input strings (on the string
interpretation) as usual.
You can start Alto in a special mode in which you can simply type sentences and they will be parsed with a given RDG grammar. To this end, start Alto as follows:
java -cp <alto.jar> de.up.ling.irtg.script.RdgParser <grammar.rdg>
where <alto.jar>
is the name of your Alto Jarfile, and <grammar.rdg>
is the filename of your RDG grammar. This will open an interactive parser shell which looks as follows:
You can then type a sentence, and Alto will try to parse it. If parsing succeeded, Alto will show a window in which you can scroll through the different parses:
You can type quit
to exit the parser shell, and help
to get help on the commands you can use within the parser shell.