semantics of verb-attached preposition phrases Prolog

340 views Asked by At

I am trying to implement a verb-attached preposition phrases in prolog.

So I've got:

VP -> Vbar

Vbar -> v, PP

PP -> Pbar

Pbar -> prep,np

the problem is when I try to phrase something like "Mary saw Tom with a telescope". There would be an error.

Can someone please give me some idea how to fix it?

Also can anyone please give me an idea how to implement the semantic of the Verb-attach prepositional phrase?

1

There are 1 answers

2
qfwfq On

I do not know what the error is so I cannot say for sure, but the code you posted has a number of issues.

  • Prolog predicates must end in a period.
  • Prolog predicates begin with a lowercase letter.
  • You probably want to use -->, not ->. I am not sure what -> does, if anything at all.
  • I do not believe using strings would unify with any of your given predicates. You probably want to be using symbols, with ''.
  • You are using a bit of a weird syntax by including -->. You can find some information on it here. Because of this, if you want the symbol v to unify in your predicates you should write [v].

I am not sure if this code has the functionality you desire, but it does run:

vp --> vbar.
vbar --> [v], pp.
pp --> pbar.
pbar --> [prep,np].

You can call it like this:

vp([here, is, some, statement], []).