step2 ( str -- newstr )
Porter stemming algorithm

Prev:step1c ( str -- newstr )
Next:step3 ( str -- newstr )


Vocabulary
porter-stemmer

Inputs
stra string


Outputs
newstra new string


Word description
Maps double suffices to single ones. so -ization maps to -ize etc. note that the string before the suffix must give positive consonant-seq.

Definition


: step2 ( str -- newstr )
{
{ [ "ational" ?tail ] [ "ational" "ate" r ] }
{ [ "tional" ?tail ] [ "tional" "tion" r ] }
{ [ "enci" ?tail ] [ "enci" "ence" r ] }
{ [ "anci" ?tail ] [ "anci" "ance" r ] }
{ [ "izer" ?tail ] [ "izer" "ize" r ] }
{ [ "bli" ?tail ] [ "bli" "ble" r ] }
{ [ "alli" ?tail ] [ "alli" "al" r ] }
{ [ "entli" ?tail ] [ "entli" "ent" r ] }
{ [ "eli" ?tail ] [ "eli" "e" r ] }
{ [ "ousli" ?tail ] [ "ousli" "ous" r ] }
{ [ "ization" ?tail ] [ "ization" "ize" r ] }
{ [ "ation" ?tail ] [ "ation" "ate" r ] }
{ [ "ator" ?tail ] [ "ator" "ate" r ] }
{ [ "alism" ?tail ] [ "alism" "al" r ] }
{ [ "iveness" ?tail ] [ "iveness" "ive" r ] }
{ [ "fulness" ?tail ] [ "fulness" "ful" r ] }
{ [ "ousness" ?tail ] [ "ousness" "ous" r ] }
{ [ "aliti" ?tail ] [ "aliti" "al" r ] }
{ [ "iviti" ?tail ] [ "iviti" "ive" r ] }
{ [ "biliti" ?tail ] [ "biliti" "ble" r ] }
{ [ "logi" ?tail ] [ "logi" "log" r ] }
[ ]
} cond ;