Author Topic: Prolog Help:  (Read 298 times)

I'm having some trouble with prolog, I need to parse english terms for their respective morphological constituents, so that I can generate parts of speech tags.

So given an atomic expression "tried", I need to construct a list [t,r,i,e,d] and then separate it into its morphological elements. The root stem, [t,r,y] and the past tense participle [e,d], so I can output the correct part of speech [verb, past-tense].

I'm having difficult recursing through the list though.

%pops off the head
rm([_|T], T).

%recurses through list
recurse(X) :- rm(X,Y), morph(Y), recurse(Y).

morph(X) :- X = [e,d].

My issue, confirmed via traces, is that recurse isn't recursing , it stops after one iteration, resulting in the list never getting short enough to be true compared to the morph.


Can someone please help, I need this to make best block and mods.

I suggest looking at the atom_chars/2 predicate to convert an atom into a list of character elements and possibly try using append/3 to find a list that separates the root word from the suffix. From there is should be trivial to construct an FST given you now have the original root word and the inflectional suffix.

Hope that helps and that we can see some cool blocks and mods.