Handbook
Glossary
step4 ( str -- newstr )
Porter stemming algorithm
Prev:
step3 ( str -- newstr )
Next:
step5 ( str -- newstr )
Vocabulary
porter-stemmer
Inputs
str
an
object
Outputs
newstr
an
object
Definition
USING:
combinators
kernel
math
splitting
;
IN:
porter-stemmer
:
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
;