step4 ( str -- newstr )
Porter stemming algorithm

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


Vocabulary
porter-stemmer

Inputs
stran object


Outputs
newstran object


Definition


: step4 ( str -- newstr )
dup {
{ [ "al" ?tail ] [ ] }
{ [ "ance" ?tail ] [ ] }
{ [ "ence" ?tail ] [ ] }
{ [ "er" ?tail ] [ ] }
{ [ "ic" ?tail ] [ ] }
{ [ "able" ?tail ] [ ] }
{ [ "ible" ?tail ] [ ] }
{ [ "ant" ?tail ] [ ] }
{ [ "ement" ?tail ] [ ] }
{ [ "ment" ?tail ] [ ] }
{ [ "ent" ?tail ] [ ] }
{ [ "ion" ?tail ] [ -ion ] }
{ [ "ou" ?tail ] [ ] }
{ [ "ism" ?tail ] [ ] }
{ [ "ate" ?tail ] [ ] }
{ [ "iti" ?tail ] [ ] }
{ [ "ous" ?tail ] [ ] }
{ [ "ive" ?tail ] [ ] }
{ [ "ize" ?tail ] [ ] }
[ ]
} cond dup consonant-seq 1 > [ nip ] [ drop ] if ;