i am trying to write a prolog program that recommends hobbies based on a persons likes. the program also contains a language parser that finds any verbs or nouns in a sentence.
i am wondering if i can access certain parts of the output of my language parser. the output of my parser looks like R = sentence(np(np(det(an), np2(adj(old), np2(noun(father))))), vp(vp(verb(likes), np(det(a), np2(adj(good), np2(noun(book)))))))
i want to see the value of the verb (likes) and the second noun (book).
input(Input sentence):-
sentence(Input sentence,Output of parser),
recommend(Output of parser(verb), Output of parser(noun), recommendation).
my code would sort of look like above but with Out(verb)
and Out(noun)
being proper prolog syntax
how would i go about doing this?