DCG semantic parser for English

Bratko’s textbook contains a semantic parser for a very tiny fragment of English. It can parse sentences like

every woman that admires a man that paints likes monet.


∀x: woman(x) ∧ (∃y: man(y) ∧ paints(y) ∧ admires(x, y) → likes(x, monet))

which is fun (although incorrect, in this case). I wonder what the state of the art is for these kinds of parsers? Anything I can play with in SWI Prolog?

1 Like

Well, surely not ‘state-of-the-art’, but I suggest to take a look at chat80.

For something playable and more advanced, I suggest to evaluate Attempto.

The post Looking for SHRDLU Prolog clone with working code has some suggestions.

Yes, the pack is the way to go.
Thanks for pointing out.

Also online: SWISH -- SWI-Prolog for SHaring

There was quite a bit of work on this in the 1980s and 1990s. Two projects I know of (that also used Prolog) were “Lilog” at IBM Germany (there’s a Springer book on that) and another at IBM Sweden, but I can’t find the references to the latter (it was based on someone’s PhD thesis, I think). I’ll try to find out more about this, but no promises.

Other places to start looking:
Prolog implementation of machine translation: Michael McCord
Syllog: Adrian Walker
Logic grammars: Abramson & Dahl
Common Logic Controlled English: John Sowa
Attempto Controlled English: Norbert Fuchs

1 Like

A bit ashamed to ask… but what is incorrect in that sentence ?

“a man” is ambiguous and can mean “there exists”, as in, “A man is in my garage”, or “for any”, as in “A man needs regular sleep”. In this particular case, a universal quantifier makes more sense, but Bratko’s mini-grammar interprets “a” only as an existential one.

Thanks, everyone, for the replies. I was hoping to find basically a bigger version of Bratko’s approach: something that just spews out multiple interpretations instead of prohibiting ambiguities.

Sorry I don’t have a copy of Bratko available, but probably the technique he applied should derive from the formalization (or better, implementation in Prolog) of Montague approach, popularized from Pereira Schieber in Prolog and Natural-Language Analysis (I have the Italian edition). In this book, they keep a pragmatical approach wrt (unavoidable) syntactical ambiguity, and show how to generate every possible reading out of a set of qualified statements. Maybe chat80 will use something similar…

There is also quite extensive study on semantic representation of natural language for the purpose of inferencing by Blackburn and Bos here (folder with files). (all examples are in Prolog).

I am very glad to see this comment. In fact, I have a cgi page on Montague’s PTQ (sorry only in Japanese.)


You will find some famous sample sentences in PTQ.

[john, walk]
[every, unicorn, seek, john]

I wrote originally as offline prolog codes in SICStus at that time more than 20 years ago, and revised it from time to time so as to work on latest SWI-Prolog. Although time has passed since I stopped, which is enough for me to be unfamiliar with recent states of computational semantics, still I keep several ideas to try. For example, ZDD for PTQ like sematics. In PTQ, an individual is interpreted as a bundle of properties (a proper filter, or similar). I am wondering if
ZDD technology opens a direct way to implement such huge computational models on computers assuming that possible worlds are similar to each other with rich sharing structues. Anyway I do not want to be taken seriously on this, but just in case you are interested.

1 Like

Interesting. It reminds me of donkey sentence in DRT theory:

If Pedro owns a donky he beats it.
1 Like

This might interest you: Interfacing a Natural Language Front-End to a Relational Database
by Ioannis Androutsopoulos
It references a few other systems, including IBM’s LanguageAccess (which was written in Prolog).

1 Like

(sorry only in Japanese.)

Just to say- Google translate seems to do a phenomenal job of translating your page into English. [Your work looks extremely interesting to this amateur prolog and NLP enthusiast.]