Question

I would like to find what is the most top synsets (highest level) in wordNet, How can I find them? and how can I know how many dauhter synsets below each of the top ones? Usually we use hyp relations to do it, I am trying to write:

hyp(I, J), %[I would like to write here, be sure that there is no parent for I].  

Can you please help me with it please?

Était-ce utile?

La solution

all top level facts:

root_hyp(H) :- hyp(H, _), \+ hyp(_, H).

leafs don't have children:

leaf_hyp(L) :- hyp(_, L), \+ hyp(L, _).

if your Prolog doesn't have library(aggregate), you can count elements with this snippet

count_synset_daughters(S, N) :-
    s(S,_,_,_,_,_),
    setof(D, hyp(S,D), L),
    length(L, N).

then simply combine (join) them:

?- root_hyp(R), count_synset_daughters(R, N).
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top