(self, word)
return stem
Returns a stemmed version of the argument string.
Returns a stemmed version of the argument string.
Returns a stemmed version of the argument string .
def stem(self, word):
        """Returns a stemmed version of the argument string.
        """

        rules = self.rules
        match = self.stem_expr.match(word)
        if not match:
            return word
        stem = self.strip_prefix(match.group(0))

        is_intact = True
        continuing = True
        while continuing:
            pfv = self.first_vowel(stem)
            rulelist = rules.get(stem[-1])
            if not rulelist:
                break

            continuing = False
            for ending, intact, num, append, cont in rulelist:
                if stem.endswith(ending):
                    if intact and not is_intact:
                        continue
                    newlen = len(stem) - num + len(append)

                    if ((pfv == 0 and newlen < 2)
                        or (pfv > 0 and newlen < 3)):
                        # If word starts with vowel, minimum stem length is 2.
                        # If word starts with consonant, minimum stem length is
                        # 3.
                            continue

                    is_intact = False
                    stem = stem[:0 - num] + append

                    continuing = cont
                    break

        return stem
def stem ( self , word ) : rules = self . rules match = self . stem_expr . match ( word ) if not match : return word stem = self . strip_prefix ( match . group ( 0 ) ) is_intact = True continuing = True while continuing : pfv = self . first_vowel ( stem ) rulelist = rules . get ( stem [ - 1 ] ) if not rulelist : break continuing = False for ending , intact , num , append , cont in rulelist : if stem . endswith ( ending ) : if intact and not is_intact : continue newlen = len ( stem ) - num + len ( append ) if ( ( pfv == 0 and newlen < 2 ) or ( pfv > 0 and newlen < 3 ) ) : # If word starts with vowel, minimum stem length is 2. # If word starts with consonant, minimum stem length is # 3. continue is_intact = False stem = stem [ : 0 - num ] + append continuing = cont break return stem