|
|
|
|
|
by microtonal
5435 days ago
|
|
Our (natural language) parser/generator is for the largest part written in Prolog (the rest is C/C++/Tcl): http://www.let.rug.nl/vannoord/alp/Alpino/ Prolog matches very well with the grammar formalism that we use (attribute-value grammars), since attribute-value structures with arbitrary depth and re-entrancy can easily be represented as Prolog terms and larger analyses can be constructed through unification. E.g. the grammar rules are plain Prolog rules where one argument argument is a list that represents the right hand side of a grammar rule, and another argument is the left-hand side. The rule goals define relations between the RHS and LHS by unifying parts of the RHS structures with the LHS structure. For instance, the rule for np -> det, n is this: grammar_rule(np_det_n, NP, [ Det, N ] ) :-
np_det_n_struct(NP,Det,N).
Where np_det_n_struct unifies paths between NP <-> Det, NP <-> N, and unifies some paths with atoms. Completing a grammar rule is simply a matter of unifying members of the RHS list. |
|