def stem_porter
w = self.dup.to_str
return w if w.length < 3
w[0] = 'Y' if w[0] == ?y
if w =~ /(ss|i)es$/
w = $` + $1
elsif w =~ /([^s])s$/
w = $` + $1
end
if w =~ /eed$/
w.chop! if $` =~ MGR0
elsif w =~ /(ed|ing)$/
stem = $`
if stem =~ VOWEL_IN_STEM
w = stem
case w
when /(at|bl|iz)$/ then w << "e"
when /([^aeiouylsz])\1$/ then w.chop!
when /^#{CC}#{V}[^aeiouwxy]$/o then w << "e"
end
end
end
if w =~ /y$/
stem = $`
w = stem + "i" if stem =~ VOWEL_IN_STEM
end
if w =~ SUFFIX_1_REGEXP
stem = $`
suffix = $1
if stem =~ MGR0
w = stem + STEP_2_LIST[suffix]
end
end
if w =~ /(icate|ative|alize|iciti|ical|ful|ness)$/
stem = $`
suffix = $1
if stem =~ MGR0
w = stem + STEP_3_LIST[suffix]
end
end
if w =~ SUFFIX_2_REGEXP
stem = $`
if stem =~ MGR1
w = stem
end
elsif w =~ /(s|t)(ion)$/
stem = $` + $1
if stem =~ MGR1
w = stem
end
end
if w =~ /e$/
stem = $`
if (stem =~ MGR1) ||
(stem =~ MEQ1 && stem !~ /^#{CC}#{V}[^aeiouwxy]$/o)
w = stem
end
end
if w =~ /ll$/ && w =~ MGR1
w.chop!
end
w[0] = 'y' if w[0] == ?Y
w
end