Is it possible to make a transitive function like the following in DCG? Or to combine it with a DCG rule?
genx(A,B) :- gen(A,B).
genx(A,C) :- gen(A,B), genx(B,C).
gen(a,b).
gen(b,c).
I will explain what i'm trying to do exactly :
If i have this grammar:
noun_phrase(D,N) --> det(D), noun(N).
noun(n(cat)) --> [cat].
I want to make some restriction like if i want N in noun(N) to be an animal. So i can use something like this:
noun_phrase(np(D,N)) --> det(D), noun(N), genx(N, animal).
Where the information of a cat is an animal is inferenced from some facts like:
gen(cat,pet).
gen(pet,animal).
Thanks