3 ms·
I think because many NLP parsing problems can be solved by dynamic programing approaches that logic programs can easily express and optimize for Another reason
by danieldk 12y ago
I think because many NLP parsing problems can be solved by dynamic programing approaches that logic programs can easily express and optimize for
Another reason is that you can directly express unification grammars in Prolog e.g., see definite clause grammar:
https://en.wikipedia.org/wiki/Definite_clause_grammar https://en.wikipedia.org/wiki/Definite_clause_grammar
During my PhD I worked on a parser/generator for Dutch at the University of Groningen, which is written in a mix of Prolog, C, and C++:
http://www.let.rug.nl/vannoord/alp/Alpino/ http://www.let.rug.nl/vannoord/alp/Alpino/
- arnsholt 12y agoAnd backtracking is so useful when doing parsing in general. For an NLP class I did we made a shift-reduce parser with dotted items for an assignment, and my liberally commented Prolog source weighs in a 33 lines of code. My friend's Lisp code which only found one parse (but did make parse trees, to be fair), was several hundred lines if memory serves. The corollary to Greenspun's tenth rule in action, I guess. =)
- danieldk 12y agoYep. I taught a Prolog NLP course and among the parsers covered was a shift-reduce parser, which would fit on one slide without much trouble. Same thing for chart parsing in Prolog. When you get backtracking and unification for free, implementing a parser is simple ;).