Next: Removing Suffixes
Up: No Title
Previous: Letter Tree Definition
% find_word(+Word,+Tree,-LexEntry)
% Finds Word in Tree retrieving LexEntry.
find_word([H|T],Tree,LexEntry) :-
member([H|Branches],Tree),
find_word(T,Branches,LexEntry).
find_word([],Tree,LexEntry) :-
member(LexEntry,Tree),
\+ (LexEntry = [_|_]).
- If the first clause: if the first letter of the word
is the same as the first element of a branch, then recurse into
the branch with the remainder of the word,
- When there are no more letters, Tree is the tail of a branch,
consisting of (we hope) the lexical entry and possibly other branches.
Mike Rosner
Mon Feb 14 08:45:31 MET 2000