def stem(self, word, early_english=False):
<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>if len(word) < <NUM_LIT:3>:<EOL><INDENT>return word<EOL><DEDENT>if word[<NUM_LIT:0>] == '<STR_LIT:y>':<EOL><INDENT>word = '<STR_LIT:Y>' + word[<NUM_LIT:1>:]<EOL><DEDENT>for i in range(<NUM_LIT:1>, len(word)):<EOL><INDENT>if word[i] == '<STR_LIT:y>' and word[i - <NUM_LIT:1>] in self._vowels:<EOL><INDENT>word = word[:i] + '<STR_LIT:Y>' + word[i + <NUM_LIT:1> :]<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:1>] == '<STR_LIT:s>':<EOL><INDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>step1b_flag = False<EOL>if word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if self._has_vowel(word[:-<NUM_LIT:2>]):<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL>step1b_flag = True<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._has_vowel(word[:-<NUM_LIT:3>]):<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL>step1b_flag = True<EOL><DEDENT><DEDENT>elif early_english:<EOL><INDENT>if word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._has_vowel(word[:-<NUM_LIT:3>]):<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL>step1b_flag = True<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._has_vowel(word[:-<NUM_LIT:3>]):<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL>step1b_flag = True<EOL><DEDENT><DEDENT><DEDENT>if step1b_flag:<EOL><INDENT>if word[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word += '<STR_LIT:e>'<EOL><DEDENT>elif self._ends_in_doubled_cons(word) and word[-<NUM_LIT:1>] not in {<EOL>'<STR_LIT:l>',<EOL>'<STR_LIT:s>',<EOL>'<STR_LIT:z>',<EOL>}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif self._m_degree(word) == <NUM_LIT:1> and self._ends_in_cvc(word):<EOL><INDENT>word += '<STR_LIT:e>'<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:1>] in {'<STR_LIT:Y>', '<STR_LIT:y>'} and self._has_vowel(word[:-<NUM_LIT:1>]):<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:i>'<EOL><DEDENT>if len(word) > <NUM_LIT:1>:<EOL><INDENT>if word[-<NUM_LIT:2>] == '<STR_LIT:a>':<EOL><INDENT>if word[-<NUM_LIT:7>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:7>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:5>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:6>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:6>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:c>':<EOL><INDENT>if word[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:e>':<EOL><INDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:g>':<EOL><INDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:l>':<EOL><INDENT>if word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:o>':<EOL><INDENT>if word[-<NUM_LIT:7>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:7>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:5>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:s>':<EOL><INDENT>if word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:7>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:7>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:2>] == '<STR_LIT:t>':<EOL><INDENT>if word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>] + '<STR_LIT:e>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:6>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:6>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:5>] + '<STR_LIT>'<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if word[-<NUM_LIT:5>:] in '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:5>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:0>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:2>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:2>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:5>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:5>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:4>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:2>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:3>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:1>] == '<STR_LIT:e>':<EOL><INDENT>if self._m_degree(word[:-<NUM_LIT:1>]) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif self._m_degree(word[:-<NUM_LIT:1>]) == <NUM_LIT:1> and not self._ends_in_cvc(<EOL>word[:-<NUM_LIT:1>]<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:2>:] == '<STR_LIT>' and self._m_degree(word) > <NUM_LIT:1>:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>for i in range(len(word)):<EOL><INDENT>if word[i] == '<STR_LIT:Y>':<EOL><INDENT>word = word[:i] + '<STR_LIT:y>' + word[i + <NUM_LIT:1> :]<EOL><DEDENT><DEDENT>return word<EOL>
Return Porter stem.

        Parameters
        ----------
        word : str
            The word to stem
        early_english : bool
            Set to True in order to remove -eth & -est (2nd & 3rd person
            singular verbal agreement suffixes)

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = Porter()
        >>> stmr.stem('reading')
        'read'
        >>> stmr.stem('suspension')
        'suspens'
        >>> stmr.stem('elusiveness')
        'elus'

        >>> stmr.stem('eateth', early_english=True)
        'eat'