Unwanted output in pyswip-0.2.3

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Unwanted output in pyswip-0.2.3

algebra
This post has NOT been accepted by the mailing list yet.
I'm using pyswip-0.2.3 in Mac OS to parser a DCG.

DCG Grammar file (test.pl):

sentence(s(NP,VP)) --> noun_phrase(NP), verb_phrase(VP).
noun_phrase(np(D,N)) --> det(D), noun(N).
verb_phrase(vp(V,NP)) --> verb(V), noun_phrase(NP).
det(d(the)) --> [the].
det(d(a)) --> [a].
noun(n(bat)) --> [bat].
noun(n(cat)) --> [cat].
verb(v(eats)) --> [eats].

Code:
prolog = Prolog()
prolog.consult('test.pl')
for result in prolog.query("sentence(Parse_tree, [the,bat,eats,a,cat], [])."):
    print result["Parse_tree"]

I get this output:
Functor7524621

but the correct solution would be:
s(np(d(the),n(bat)),vp(v(eats),np(d(a),n(cat))))

Someone can help me get this solution?
Loading...