<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>word = word.translate(self._accented)<EOL>for i in range(len(word)):<EOL><INDENT>if i == <NUM_LIT:0> and word[<NUM_LIT:0>] == '<STR_LIT:y>':<EOL><INDENT>word = '<STR_LIT:Y>' + word[<NUM_LIT:1>:]<EOL><DEDENT>elif 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>elif (<EOL>word[i] == '<STR_LIT:i>'<EOL>and word[i - <NUM_LIT:1>] in self._vowels<EOL>and i + <NUM_LIT:1> < len(word)<EOL>and word[i + <NUM_LIT:1>] in self._vowels<EOL>):<EOL><INDENT>word = word[:i] + '<STR_LIT:I>' + word[i + <NUM_LIT:1> :]<EOL><DEDENT><DEDENT>r1_start = max(<NUM_LIT:3>, self._sb_r1(word))<EOL>r2_start = self._sb_r2(word)<EOL>if word[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r1_start:]) >= <NUM_LIT:5>:<EOL><INDENT>word = word[:-<NUM_LIT:3>] + '<STR_LIT:id>'<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r1_start:]) >= <NUM_LIT:3> and (<EOL>word[-<NUM_LIT:4>] not in self._vowels and word[-<NUM_LIT:6>:-<NUM_LIT:3>] != '<STR_LIT>'<EOL>):<EOL><INDENT>word = self._undouble(word[:-<NUM_LIT:3>])<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r1_start:]) >= <NUM_LIT:2> and (<EOL>word[-<NUM_LIT:3>] not in self._vowels and word[-<NUM_LIT:5>:-<NUM_LIT:2>] != '<STR_LIT>'<EOL>):<EOL><INDENT>word = self._undouble(word[:-<NUM_LIT:2>])<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if (<EOL>len(word[r1_start:]) >= <NUM_LIT:2><EOL>and word[-<NUM_LIT:3>] not in self._not_s_endings<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:1>:] == '<STR_LIT:s>':<EOL><INDENT>if (<EOL>len(word[r1_start:]) >= <NUM_LIT:1><EOL>and word[-<NUM_LIT:2>] not in self._not_s_endings<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>e_removed = False<EOL>if word[-<NUM_LIT:1>:] == '<STR_LIT:e>':<EOL><INDENT>if len(word[r1_start:]) >= <NUM_LIT:1> and word[-<NUM_LIT:2>] not in self._vowels:<EOL><INDENT>word = self._undouble(word[:-<NUM_LIT:1>])<EOL>e_removed = True<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:4> and word[-<NUM_LIT:5>] != '<STR_LIT:c>':<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL>if word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r1_start:]) >= <NUM_LIT:2> and (<EOL>word[-<NUM_LIT:3>] not in self._vowels and word[-<NUM_LIT:5>:-<NUM_LIT:2>] != '<STR_LIT>'<EOL>):<EOL><INDENT>word = self._undouble(word[:-<NUM_LIT:2>])<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:4>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL>if word[-<NUM_LIT:1>:] == '<STR_LIT:e>':<EOL><INDENT>if (<EOL>len(word[r1_start:]) >= <NUM_LIT:1><EOL>and word[-<NUM_LIT:2>] not in self._vowels<EOL>):<EOL><INDENT>word = self._undouble(word[:-<NUM_LIT:1>])<EOL><DEDENT><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:4>:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] in ('<STR_LIT:end>', '<STR_LIT>'):<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:3>:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL>if (<EOL>word[-<NUM_LIT:2>:] == '<STR_LIT>'<EOL>and len(word[r2_start:]) >= <NUM_LIT:2><EOL>and word[-<NUM_LIT:3>] != '<STR_LIT:e>'<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>else:<EOL><INDENT>word = self._undouble(word)<EOL><DEDENT><DEDENT><DEDENT>elif word[-<NUM_LIT:3>:] == '<STR_LIT:bar>':<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:3> and e_removed:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if len(word[r2_start:]) >= <NUM_LIT:2> and word[-<NUM_LIT:3>] != '<STR_LIT:e>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>if (<EOL>len(word) >= <NUM_LIT:4><EOL>and word[-<NUM_LIT:3>] == word[-<NUM_LIT:2>]<EOL>and word[-<NUM_LIT:2>] in {'<STR_LIT:a>', '<STR_LIT:e>', '<STR_LIT:o>', '<STR_LIT:u>'}<EOL>and word[-<NUM_LIT:4>] not in self._vowels<EOL>and word[-<NUM_LIT:1>] not in self._vowels<EOL>and word[-<NUM_LIT:1>] != '<STR_LIT:I>'<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:2>] + word[-<NUM_LIT:1>]<EOL><DEDENT>for i in range(<NUM_LIT:0>, 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>elif word[i] == '<STR_LIT:I>':<EOL><INDENT>word = word[:i] + '<STR_LIT:i>' + word[i + <NUM_LIT:1> :]<EOL><DEDENT><DEDENT>return word<EOL>

Return Snowball Dutch stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = SnowballDutch()
        >>> stmr.stem('lezen')
        'lez'
        >>> stmr.stem('opschorting')
        'opschort'
        >>> stmr.stem('ongrijpbaarheid')
        'ongrijp'


return PaiceHusk().stem(word)<EOL>

Return Paice-Husk stem.

    This is a wrapper for :py:meth:`PaiceHusk.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str
        Word stem

    Examples
    --------
    >>> paice_husk('assumption')
    'assum'
    >>> paice_husk('verifiable')
    'ver'
    >>> paice_husk('fancies')
    'fant'
    >>> paice_husk('fanciful')
    'fancy'
    >>> paice_husk('torment')
    'tor'


terminate = False<EOL>intact = True<EOL>while not terminate:<EOL><INDENT>for n in range(<NUM_LIT:6>, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>if word[-n:] in self._rule_table[n]:<EOL><INDENT>accept = False<EOL>if len(self._rule_table[n][word[-n:]]) < <NUM_LIT:4>:<EOL><INDENT>for rule in self._rule_table[n][word[-n:]]:<EOL><INDENT>(<EOL>word,<EOL>accept,<EOL>intact,<EOL>terminate,<EOL>) = self._apply_rule(word, rule, intact, terminate)<EOL>if accept:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>rule = self._rule_table[n][word[-n:]]<EOL>(word, accept, intact, terminate) = self._apply_rule(<EOL>word, rule, intact, terminate<EOL>)<EOL><DEDENT>if accept:<EOL><INDENT>break<EOL><DEDENT><DEDENT><DEDENT>else:<EOL><INDENT>break<EOL><DEDENT><DEDENT>return word<EOL>

Return Paice-Husk stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = PaiceHusk()
        >>> stmr.stem('assumption')
        'assum'
        >>> stmr.stem('verifiable')
        'ver'
        >>> stmr.stem('fancies')
        'fant'
        >>> stmr.stem('fanciful')
        'fancy'
        >>> stmr.stem('torment')
        'tor'


def _sb_r1(self, term, r1_prefixes=None):

vowel_found = False<EOL>if hasattr(r1_prefixes, '<STR_LIT>'):<EOL><INDENT>for prefix in r1_prefixes:<EOL><INDENT>if term[: len(prefix)] == prefix:<EOL><INDENT>return len(prefix)<EOL><DEDENT><DEDENT><DEDENT>for i in range(len(term)):<EOL><INDENT>if not vowel_found and term[i] in self._vowels:<EOL><INDENT>vowel_found = True<EOL><DEDENT>elif vowel_found and term[i] not in self._vowels:<EOL><INDENT>return i + <NUM_LIT:1><EOL><DEDENT><DEDENT>return len(term)<EOL>

Return the R1 region, as defined in the Porter2 specification.

        Parameters
        ----------
        term : str
            The term to examine
        r1_prefixes : set
            Prefixes to consider

        Returns
        -------
        int
            Length of the R1 region


def _sb_r2(self, term, r1_prefixes=None):

r1_start = self._sb_r1(term, r1_prefixes)<EOL>return r1_start + self._sb_r1(term[r1_start:])<EOL>

Return the R2 region, as defined in the Porter2 specification.

        Parameters
        ----------
        term : str
            The term to examine
        r1_prefixes : set
            Prefixes to consider

        Returns
        -------
        int
            Length of the R1 region


if not term:<EOL><INDENT>return False<EOL><DEDENT>if len(term) == <NUM_LIT:2>:<EOL><INDENT>if term[-<NUM_LIT:2>] in self._vowels and term[-<NUM_LIT:1>] not in self._vowels:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>elif len(term) >= <NUM_LIT:3>:<EOL><INDENT>if (<EOL>term[-<NUM_LIT:3>] not in self._vowels<EOL>and term[-<NUM_LIT:2>] in self._vowels<EOL>and term[-<NUM_LIT:1>] in self._codanonvowels<EOL>):<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Return True iff term ends in a short syllable.

        (...according to the Porter2 specification.)

        NB: This is akin to the CVC test from the Porter stemmer. The
        description is unfortunately poor/ambiguous.

        Parameters
        ----------
        term : str
            The term to examine

        Returns
        -------
        bool
            True iff term ends in a short syllable


def _sb_short_word(self, term, r1_prefixes=None):

if self._sb_r1(term, r1_prefixes) == len(<EOL>term<EOL>) and self._sb_ends_in_short_syllable(term):<EOL><INDENT>return True<EOL><DEDENT>return False<EOL>

Return True iff term is a short word.

        (...according to the Porter2 specification.)

        Parameters
        ----------
        term : str
            The term to examine
        r1_prefixes : set
            Prefixes to consider

        Returns
        -------
        bool
            True iff term is a short word


for letter in term:<EOL><INDENT>if letter in self._vowels:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Return Porter helper function _sb_has_vowel value.

        Parameters
        ----------
        term : str
            The term to examine

        Returns
        -------
        bool
            True iff a vowel exists in the term (as defined in the Porter
            stemmer definition)


return Lovins().stem(word)<EOL>

Return Lovins stem.

    This is a wrapper for :py:meth:`Lovins.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str: Word stem

    Examples
    --------
    >>> lovins('reading')
    'read'
    >>> lovins('suspension')
    'suspens'
    >>> lovins('elusiveness')
    'elus'


return len(word) - suffix_len >= <NUM_LIT:3><EOL>

Return Lovins' condition B.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return len(word) - suffix_len >= <NUM_LIT:4><EOL>

Return Lovins' condition C.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return len(word) - suffix_len >= <NUM_LIT:5><EOL>

Return Lovins' condition D.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] != '<STR_LIT:e>'<EOL>

Return Lovins' condition E.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return len(word) - suffix_len >= <NUM_LIT:3> and word[-suffix_len - <NUM_LIT:1>] != '<STR_LIT:e>'<EOL>

Return Lovins' condition F.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return len(word) - suffix_len >= <NUM_LIT:3> and word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:f>'<EOL>

Return Lovins' condition G.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return (<EOL>word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:t>'<EOL>or word[-suffix_len - <NUM_LIT:2> : -suffix_len] == '<STR_LIT>'<EOL>)<EOL>

Return Lovins' condition H.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] not in {'<STR_LIT:e>', '<STR_LIT:o>'}<EOL>

Return Lovins' condition I.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] not in {'<STR_LIT:a>', '<STR_LIT:e>'}<EOL>

Return Lovins' condition J.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return (len(word) - suffix_len >= <NUM_LIT:3>) and (<EOL>word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:i>', '<STR_LIT:l>'}<EOL>or (word[-suffix_len - <NUM_LIT:3>] == '<STR_LIT:u>' and word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:e>')<EOL>)<EOL>

Return Lovins' condition K.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return (<EOL>word[-suffix_len - <NUM_LIT:1>] not in {'<STR_LIT:s>', '<STR_LIT:u>', '<STR_LIT:x>'}<EOL>or word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT>'<EOL>)<EOL>

Return Lovins' condition L.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] not in {'<STR_LIT:a>', '<STR_LIT:c>', '<STR_LIT:e>', '<STR_LIT:m>'}<EOL>

Return Lovins' condition M.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


if len(word) - suffix_len >= <NUM_LIT:3>:<EOL><INDENT>if word[-suffix_len - <NUM_LIT:3>] == '<STR_LIT:s>':<EOL><INDENT>if len(word) - suffix_len >= <NUM_LIT:4>:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Return Lovins' condition N.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:i>', '<STR_LIT:l>'}<EOL>

Return Lovins' condition O.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] != '<STR_LIT:c>'<EOL>

Return Lovins' condition P.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return len(word) - suffix_len >= <NUM_LIT:3> and word[-suffix_len - <NUM_LIT:1>] not in {<EOL>'<STR_LIT:l>',<EOL>'<STR_LIT:n>',<EOL>}<EOL>

Return Lovins' condition Q.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:n>', '<STR_LIT:r>'}<EOL>

Return Lovins' condition R.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:2> : -suffix_len] == '<STR_LIT>' or (<EOL>word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:t>'<EOL>and word[-suffix_len - <NUM_LIT:2> : -suffix_len] != '<STR_LIT>'<EOL>)<EOL>

Return Lovins' condition S.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return (<EOL>word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:s>', '<STR_LIT:t>'}<EOL>and word[-suffix_len - <NUM_LIT:2> : -suffix_len] != '<STR_LIT>'<EOL>)<EOL>

Return Lovins' condition T.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:l>', '<STR_LIT:m>', '<STR_LIT:n>', '<STR_LIT:r>'}<EOL>

Return Lovins' condition U.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:c>'<EOL>

Return Lovins' condition V.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] not in {'<STR_LIT:s>', '<STR_LIT:u>'}<EOL>

Return Lovins' condition W.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:i>', '<STR_LIT:l>'} or (<EOL>word[-suffix_len - <NUM_LIT:3> : -suffix_len] == '<STR_LIT:u>'<EOL>and word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:e>'<EOL>)<EOL>

Return Lovins' condition X.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:2> : -suffix_len] == '<STR_LIT>'<EOL>

Return Lovins' condition Y.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] != '<STR_LIT:f>'<EOL>

Return Lovins' condition Z.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] in {'<STR_LIT:d>', '<STR_LIT:f>', '<STR_LIT:l>', '<STR_LIT:t>'} or word[<EOL>-suffix_len - <NUM_LIT:2> : -suffix_len<EOL>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}<EOL>

Return Lovins' condition AA.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return (<EOL>len(word) - suffix_len >= <NUM_LIT:3><EOL>and word[-suffix_len - <NUM_LIT:3> : -suffix_len] != '<STR_LIT>'<EOL>and word[-suffix_len - <NUM_LIT:4> : -suffix_len] != '<STR_LIT>'<EOL>)<EOL>

Return Lovins' condition BB.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


return word[-suffix_len - <NUM_LIT:1>] == '<STR_LIT:l>'<EOL>

Return Lovins' condition CC.

        Parameters
        ----------
        word : str
            Word to check
        suffix_len : int
            Suffix length

        Returns
        -------
        bool
            True if condition is met


if stem[-<NUM_LIT:3>:-<NUM_LIT:2>] in {'<STR_LIT:a>', '<STR_LIT:i>', '<STR_LIT:o>'}:<EOL><INDENT>return stem<EOL><DEDENT>return stem[:-<NUM_LIT:2>] + '<STR_LIT:l>'<EOL>

Return Lovins' conditional recode rule 9.

        Parameters
        ----------
        stem : str
            Word to stem

        Returns
        -------
        str
            Word stripped of suffix


if stem[-<NUM_LIT:4>:-<NUM_LIT:3>] == '<STR_LIT:s>':<EOL><INDENT>return stem<EOL><DEDENT>return stem[:-<NUM_LIT:1>] + '<STR_LIT:s>'<EOL>

Return Lovins' conditional recode rule 24.

        Parameters
        ----------
        stem : str
            Word to stem

        Returns
        -------
        str
            Word stripped of suffix


if stem[-<NUM_LIT:4>:-<NUM_LIT:3>] in {'<STR_LIT:p>', '<STR_LIT:t>'}:<EOL><INDENT>return stem<EOL><DEDENT>return stem[:-<NUM_LIT:1>] + '<STR_LIT:s>'<EOL>

Return Lovins' conditional recode rule 28.

        Parameters
        ----------
        stem : str
            Word to stem

        Returns
        -------
        str
            Word stripped of suffix


if stem[-<NUM_LIT:4>:-<NUM_LIT:3>] == '<STR_LIT:m>':<EOL><INDENT>return stem<EOL><DEDENT>return stem[:-<NUM_LIT:1>] + '<STR_LIT:s>'<EOL>

Return Lovins' conditional recode rule 30.

        Parameters
        ----------
        stem : str
            Word to stem

        Returns
        -------
        str
            Word stripped of suffix


if stem[-<NUM_LIT:3>:-<NUM_LIT:2>] == '<STR_LIT:n>':<EOL><INDENT>return stem<EOL><DEDENT>return stem[:-<NUM_LIT:1>] + '<STR_LIT:s>'<EOL>

Return Lovins' conditional recode rule 32.

        Parameters
        ----------
        stem : str
            Word to stem

        Returns
        -------
        str
            Word stripped of suffix


self._suffix = {<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_g,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT:action>': self._cond_g,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_z,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_d,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_bb,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_i,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_y,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_i,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_j,<EOL>'<STR_LIT>': self._cond_cc,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_k,<EOL>'<STR_LIT>': self._cond_i,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_y,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_l,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_m,<EOL>'<STR_LIT>': self._cond_n,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_h,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_bb,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_o,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_y,<EOL>'<STR_LIT>': self._cond_y,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_l,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_p,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_m,<EOL>'<STR_LIT>': self._cond_n,<EOL>'<STR_LIT>': self._cond_q,<EOL>'<STR_LIT>': self._cond_c,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_aa,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_r,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_bb,<EOL>'<STR_LIT>': self._cond_x,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': self._cond_f,<EOL>'<STR_LIT>': self._cond_e,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': self._cond_b,<EOL>'<STR_LIT>': self._cond_s,<EOL>'<STR_LIT>': self._cond_t,<EOL>'<STR_LIT>': self._cond_u,<EOL>'<STR_LIT>': self._cond_v,<EOL>'<STR_LIT>': self._cond_r,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT>': None,<EOL>'<STR_LIT:a>': None,<EOL>'<STR_LIT:e>': None,<EOL>'<STR_LIT:i>': None,<EOL>'<STR_LIT:o>': None,<EOL>'<STR_LIT:s>': self._cond_w,<EOL>'<STR_LIT:y>': self._cond_b,<EOL>}<EOL>self._recode = (<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT:rb>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', self._recode9),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT:end>', self._recode24),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', self._recode28),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', self._recode30),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', self._recode32),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>)<EOL>


<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>for suffix_len in range(<NUM_LIT:11>, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>ending = word[-suffix_len:]<EOL>if (<EOL>ending in self._suffix<EOL>and len(word) - suffix_len >= <NUM_LIT:2><EOL>and (<EOL>self._suffix[ending] is None<EOL>or self._suffix[ending](word, suffix_len)<EOL>)<EOL>):<EOL><INDENT>word = word[:-suffix_len]<EOL>break<EOL><DEDENT><DEDENT>if word[-<NUM_LIT:2>:] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>for ending, replacement in self._recode:<EOL><INDENT>if word.endswith(ending):<EOL><INDENT>if callable(replacement):<EOL><INDENT>word = replacement(word)<EOL><DEDENT>else:<EOL><INDENT>word = word[: -len(ending)] + replacement<EOL><DEDENT><DEDENT><DEDENT>return word<EOL>

Return Lovins stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

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


return Schinke().stem(word)<EOL>

Return the stem of a word according to the Schinke stemmer.

    This is a wrapper for :py:meth:`Schinke.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str
        Word stem

    Examples
    --------
    >>> schinke('atque')
    {'n': 'atque', 'v': 'atque'}
    >>> schinke('census')
    {'n': 'cens', 'v': 'censu'}
    >>> schinke('virum')
    {'n': 'uir', 'v': 'uiru'}
    >>> schinke('populusque')
    {'n': 'popul', 'v': 'populu'}
    >>> schinke('senatus')
    {'n': 'senat', 'v': 'senatu'}


word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>word = '<STR_LIT>'.join(<EOL>c<EOL>for c in word<EOL>if c<EOL>in {<EOL>'<STR_LIT:a>',<EOL>'<STR_LIT:b>',<EOL>'<STR_LIT:c>',<EOL>'<STR_LIT:d>',<EOL>'<STR_LIT:e>',<EOL>'<STR_LIT:f>',<EOL>'<STR_LIT:g>',<EOL>'<STR_LIT:h>',<EOL>'<STR_LIT:i>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT:k>',<EOL>'<STR_LIT:l>',<EOL>'<STR_LIT:m>',<EOL>'<STR_LIT:n>',<EOL>'<STR_LIT:o>',<EOL>'<STR_LIT:p>',<EOL>'<STR_LIT:q>',<EOL>'<STR_LIT:r>',<EOL>'<STR_LIT:s>',<EOL>'<STR_LIT:t>',<EOL>'<STR_LIT:u>',<EOL>'<STR_LIT:v>',<EOL>'<STR_LIT:w>',<EOL>'<STR_LIT:x>',<EOL>'<STR_LIT:y>',<EOL>'<STR_LIT:z>',<EOL>}<EOL>)<EOL>word = word.replace('<STR_LIT>', '<STR_LIT:i>').replace('<STR_LIT:v>', '<STR_LIT:u>')<EOL>if word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>if word[:-<NUM_LIT:3>] in self._keep_que or word == '<STR_LIT>':<EOL><INDENT>return {'<STR_LIT:n>': word, '<STR_LIT:v>': word}<EOL><DEDENT>else:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>noun = word<EOL>verb = word<EOL>for endlen in range(<NUM_LIT:4>, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>if word[-endlen:] in self._n_endings[endlen]:<EOL><INDENT>if len(word) - <NUM_LIT:2> >= endlen:<EOL><INDENT>noun = word[:-endlen]<EOL><DEDENT>else:<EOL><INDENT>noun = word<EOL><DEDENT>break<EOL><DEDENT><DEDENT>for endlen in range(<NUM_LIT:6>, <NUM_LIT:0>, -<NUM_LIT:1>):<EOL><INDENT>if word[-endlen:] in self._v_endings_strip[endlen]:<EOL><INDENT>if len(word) - <NUM_LIT:2> >= endlen:<EOL><INDENT>verb = word[:-endlen]<EOL><DEDENT>else:<EOL><INDENT>verb = word<EOL><DEDENT>break<EOL><DEDENT>if word[-endlen:] in self._v_endings_alter[endlen]:<EOL><INDENT>if word[-endlen:] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>new_word = word[:-endlen] + '<STR_LIT:i>'<EOL>addlen = <NUM_LIT:1><EOL><DEDENT>elif word[-endlen:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>new_word = word[:-endlen] + '<STR_LIT>'<EOL>addlen = <NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>new_word = word[:-endlen] + '<STR_LIT>'<EOL>addlen = <NUM_LIT:3><EOL><DEDENT>if len(new_word) >= <NUM_LIT:2> + addlen:<EOL><INDENT>verb = new_word<EOL><DEDENT>else:<EOL><INDENT>verb = word<EOL><DEDENT>break<EOL><DEDENT><DEDENT>return {'<STR_LIT:n>': noun, '<STR_LIT:v>': verb}<EOL>

Return the stem of a word according to the Schinke stemmer.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = Schinke()
        >>> stmr.stem('atque')
        {'n': 'atque', 'v': 'atque'}
        >>> stmr.stem('census')
        {'n': 'cens', 'v': 'censu'}
        >>> stmr.stem('virum')
        {'n': 'uir', 'v': 'uiru'}
        >>> stmr.stem('populusque')
        {'n': 'popul', 'v': 'populu'}
        >>> stmr.stem('senatus')
        {'n': 'senat', 'v': 'senatu'}


return SnowballNorwegian().stem(word)<EOL>

Return Snowball Norwegian stem.

    This is a wrapper for :py:meth:`SnowballNorwegian.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str
        Word stem

    Examples
    --------
    >>> sb_norwegian('lese')
    'les'
    >>> sb_norwegian('suspensjon')
    'suspensjon'
    >>> sb_norwegian('sikkerhet')
    'sikker'


<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>r1_start = min(max(<NUM_LIT:3>, self._sb_r1(word)), len(word))<EOL>_r1 = word[r1_start:]<EOL>if _r1[-<NUM_LIT:7>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:7>]<EOL><DEDENT>elif _r1[-<NUM_LIT:6>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:6>]<EOL><DEDENT>elif _r1[-<NUM_LIT:5>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:5>]<EOL><DEDENT>elif _r1[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>if word[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>else:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT><DEDENT>elif _r1[-<NUM_LIT:3>:] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>if word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT><DEDENT>elif _r1[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>elif _r1[-<NUM_LIT:1>:] in {'<STR_LIT:a>', '<STR_LIT:e>'}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif _r1[-<NUM_LIT:1>:] == '<STR_LIT:s>':<EOL><INDENT>if (len(word) > <NUM_LIT:1> and word[-<NUM_LIT:2>] in self._s_endings) or (<EOL>len(word) > <NUM_LIT:2><EOL>and word[-<NUM_LIT:2>] == '<STR_LIT:k>'<EOL>and word[-<NUM_LIT:3>] not in self._vowels<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>if word[r1_start:][-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>_r1 = word[r1_start:]<EOL>if _r1[-<NUM_LIT:7>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:7>]<EOL><DEDENT>elif _r1[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT>elif _r1[-<NUM_LIT:3>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT>elif _r1[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>return word<EOL>

Return Snowball Norwegian stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = SnowballNorwegian()
        >>> stmr.stem('lese')
        'les'
        >>> stmr.stem('suspensjon')
        'suspensjon'
        >>> stmr.stem('sikkerhet')
        'sikker'


return CLEFGermanPlus().stem(word)<EOL>

Return 'CLEF German stemmer plus' stem.

    This is a wrapper for :py:meth:`CLEFGermanPlus.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str
        Word stem

    Examples
    --------
    >>> stmr = CLEFGermanPlus()
    >>> clef_german_plus('lesen')
    'les'
    >>> clef_german_plus('graues')
    'grau'
    >>> clef_german_plus('buchstabieren')
    'buchstabi'


<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>word = word.translate(self._accents)<EOL>wlen = len(word) - <NUM_LIT:1><EOL>if wlen > <NUM_LIT:4> and word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT>elif wlen > <NUM_LIT:3> and word[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>elif wlen > <NUM_LIT:2> and (<EOL>word[-<NUM_LIT:1>] == '<STR_LIT:e>'<EOL>or (word[-<NUM_LIT:1>] == '<STR_LIT:s>' and word[-<NUM_LIT:2>] in self._st_ending)<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>wlen = len(word) - <NUM_LIT:1><EOL>if wlen > <NUM_LIT:4> and word[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT>elif wlen > <NUM_LIT:3> and (<EOL>word[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>'}<EOL>or (word[-<NUM_LIT:2>:] == '<STR_LIT>' and word[-<NUM_LIT:3>] in self._st_ending)<EOL>):<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>return word<EOL>

Return 'CLEF German stemmer plus' stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = CLEFGermanPlus()
        >>> clef_german_plus('lesen')
        'les'
        >>> clef_german_plus('graues')
        'grau'
        >>> clef_german_plus('buchstabieren')
        'buchstabi'


return Porter().stem(word, early_english)<EOL>

Return Porter stem.

    This is a wrapper for :py:meth:`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
    --------
    >>> porter('reading')
    'read'
    >>> porter('suspension')
    'suspens'
    >>> porter('elusiveness')
    'elus'

    >>> porter('eateth', early_english=True)
    'eat'


mdeg = <NUM_LIT:0><EOL>last_was_vowel = False<EOL>for letter in term:<EOL><INDENT>if letter in self._vowels:<EOL><INDENT>last_was_vowel = True<EOL><DEDENT>else:<EOL><INDENT>if last_was_vowel:<EOL><INDENT>mdeg += <NUM_LIT:1><EOL><DEDENT>last_was_vowel = False<EOL><DEDENT><DEDENT>return mdeg<EOL>

Return Porter helper function _m_degree value.

        m-degree is equal to the number of V to C transitions

        Parameters
        ----------
        term : str
            The word for which to calculate the m-degree

        Returns
        -------
        int
            The m-degree as defined in the Porter stemmer definition


for letter in term:<EOL><INDENT>if letter in self._vowels:<EOL><INDENT>return True<EOL><DEDENT><DEDENT>return False<EOL>

Return Porter helper function _has_vowel value.

        Parameters
        ----------
        term : str
            The word to scan for vowels

        Returns
        -------
        bool
            True iff a vowel exists in the term (as defined in the Porter
            stemmer definition)


return (<EOL>len(term) > <NUM_LIT:1><EOL>and term[-<NUM_LIT:1>] not in self._vowels<EOL>and term[-<NUM_LIT:2>] == term[-<NUM_LIT:1>]<EOL>)<EOL>

Return Porter helper function _ends_in_doubled_cons value.

        Parameters
        ----------
        term : str
            The word to check for a final doubled consonant

        Returns
        -------
        bool
            True iff the stem ends in a doubled consonant (as defined in the
            Porter stemmer definition)


return len(term) > <NUM_LIT:2> and (<EOL>term[-<NUM_LIT:1>] not in self._vowels<EOL>and term[-<NUM_LIT:2>] in self._vowels<EOL>and term[-<NUM_LIT:3>] not in self._vowels<EOL>and term[-<NUM_LIT:1>] not in tuple('<STR_LIT>')<EOL>)<EOL>

Return Porter helper function _ends_in_cvc value.

        Parameters
        ----------
        term : str
            The word to scan for cvc

        Returns
        -------
        bool
            True iff the stem ends in cvc (as defined in the Porter stemmer
            definition)


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'


return SnowballSwedish().stem(word)<EOL>

Return Snowball Swedish stem.

    This is a wrapper for :py:meth:`SnowballSwedish.stem`.

    Parameters
    ----------
    word : str
        The word to stem

    Returns
    -------
    str
        Word stem

    Examples
    --------
    >>> sb_swedish('undervisa')
    'undervis'
    >>> sb_swedish('suspension')
    'suspension'
    >>> sb_swedish('visshet')
    'viss'


<EOL>word = normalize('<STR_LIT>', text_type(word.lower()))<EOL>r1_start = min(max(<NUM_LIT:3>, self._sb_r1(word)), len(word))<EOL>_r1 = word[r1_start:]<EOL>if _r1[-<NUM_LIT:7>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:7>]<EOL><DEDENT>elif _r1[-<NUM_LIT:6>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:6>]<EOL><DEDENT>elif _r1[-<NUM_LIT:5>:] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>word = word[:-<NUM_LIT:5>]<EOL><DEDENT>elif _r1[-<NUM_LIT:4>:] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>word = word[:-<NUM_LIT:4>]<EOL><DEDENT>elif _r1[-<NUM_LIT:3>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT>elif _r1[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>elif _r1[-<NUM_LIT:1>:] in {'<STR_LIT:a>', '<STR_LIT:e>'}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif _r1[-<NUM_LIT:1>:] == '<STR_LIT:s>':<EOL><INDENT>if len(word) > <NUM_LIT:1> and word[-<NUM_LIT:2>] in self._s_endings:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>if word[r1_start:][-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>_r1 = word[r1_start:]<EOL>if _r1[-<NUM_LIT:5>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif _r1[-<NUM_LIT:4>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif _r1[-<NUM_LIT:3>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[:-<NUM_LIT:3>]<EOL><DEDENT>elif _r1[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:2>]<EOL><DEDENT>return word<EOL>

Return Snowball Swedish stem.

        Parameters
        ----------
        word : str
            The word to stem

        Returns
        -------
        str
            Word stem

        Examples
        --------
        >>> stmr = SnowballSwedish()
        >>> stmr.stem('undervisa')
        'undervis'
        >>> stmr.stem('suspension')
        'suspension'
        >>> stmr.stem('visshet')
        'viss'


pass<EOL>

Return stem.

        Parameters
        ----------
        word : str
            The word to stem
        *args
            Variable length argument list
        **kwargs
            Arbitrary keyword arguments

        Returns
        -------
        str
            Word stem


def __init__(self, term, qval=<NUM_LIT:2>, start_stop='<STR_LIT>', skip=<NUM_LIT:0>):

<EOL>self._term = term<EOL>self._term_ss = term<EOL>self._ordered_list = []<EOL>if not isinstance(qval, Iterable):<EOL><INDENT>qval = (qval,)<EOL><DEDENT>if not isinstance(skip, Iterable):<EOL><INDENT>skip = (skip,)<EOL><DEDENT>for qval_i in qval:<EOL><INDENT>for skip_i in skip:<EOL><INDENT>if len(self._term) < qval_i or qval_i < <NUM_LIT:1>:<EOL><INDENT>continue<EOL><DEDENT>if start_stop and qval_i > <NUM_LIT:1>:<EOL><INDENT>term = (<EOL>start_stop[<NUM_LIT:0>] * (qval_i - <NUM_LIT:1>)<EOL>+ self._term<EOL>+ start_stop[-<NUM_LIT:1>] * (qval_i - <NUM_LIT:1>)<EOL>)<EOL><DEDENT>else:<EOL><INDENT>term = self._term<EOL><DEDENT>if len(term) > len(self._term_ss):<EOL><INDENT>self._term_ss = term<EOL><DEDENT>skip_i += <NUM_LIT:1><EOL>self._ordered_list += [<EOL>term[i : i + (qval_i * skip_i) : skip_i]<EOL>for i in range(len(term) - (qval_i - <NUM_LIT:1>))<EOL>]<EOL><DEDENT><DEDENT>super(QGrams, self).__init__(self._ordered_list)<EOL>

Initialize QGrams.

        Parameters
        ----------
        term : str
            A string to extract q-grams from
        qval : int or Iterable
            The q-gram length (defaults to 2), can be an integer, range object,
            or list
        start_stop : str
            A string of length >= 0 indicating start & stop symbols.
            If the string is '', q-grams will be calculated without start &
            stop symbols appended to each end.
            Otherwise, the first character of start_stop will pad the
            beginning of the string and the last character of start_stop
            will pad the end of the string before q-grams are calculated.
            (In the case that start_stop is only 1 character long, the same
            symbol will be used for both.)
        skip : int or Iterable
            The number of characters to skip, can be an integer, range object,
            or list

        Examples
        --------
        >>> qg = QGrams('AATTATAT')
        >>> qg
        QGrams({'AT': 3, 'TA': 2, '$A': 1, 'AA': 1, 'TT': 1, 'T#': 1})

        >>> qg = QGrams('AATTATAT', qval=1, start_stop='')
        >>> qg
        QGrams({'A': 4, 'T': 4})

        >>> qg = QGrams('AATTATAT', qval=3, start_stop='')
        >>> qg
        QGrams({'TAT': 2, 'AAT': 1, 'ATT': 1, 'TTA': 1, 'ATA': 1})


return sum(self.values())<EOL>

Return q-grams count.

        Returns
        -------
        int
            The total count of q-grams in a QGrams object

        Examples
        --------
        >>> qg = QGrams('AATTATAT')
        >>> qg.count()
        9

        >>> qg = QGrams('AATTATAT', qval=1, start_stop='')
        >>> qg.count()
        8

        >>> qg = QGrams('AATTATAT', qval=3, start_stop='')
        >>> qg.count()
        6


return reduce(mul, nums, <NUM_LIT:1>)<EOL>

r"""Return the product of nums.

    The product is :math:`\prod nums`.

    Cf. https://en.wikipedia.org/wiki/Product_(mathematics)

    Parameters
    ----------
    nums : list
        A collection (list, tuple, set, etc.) of numbers

    Returns
    -------
    numeric
        The product of a nums

    Examples
    --------
    >>> _prod([1,1,1,1])
    1
    >>> _prod((2,4,8))
    64
    >>> _prod({1,2,3,4})
    24
    >>> _prod(2**i for i in range(5))
    1024


def dm_soundex(word, max_length=<NUM_LIT:6>, zero_pad=True):

return DaitchMokotoff().encode(word, max_length, zero_pad)<EOL>

Return the Daitch-Mokotoff Soundex code for a word.

    This is a wrapper for :py:meth:`DaitchMokotoff.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    max_length : int
        The length of the code returned (defaults to 6; must be between 6 and
        64)
    zero_pad : bool
        Pad the end of the return value with 0s to achieve a max_length string

    Returns
    -------
    str
        The Daitch-Mokotoff Soundex value

    Examples
    --------
    >>> sorted(dm_soundex('Christopher'))
    ['494379', '594379']
    >>> dm_soundex('Niall')
    {'680000'}
    >>> dm_soundex('Smith')
    {'463000'}
    >>> dm_soundex('Schmidt')
    {'463000'}

    >>> sorted(dm_soundex('The quick brown fox', max_length=20,
    ... zero_pad=False))
    ['35457976754', '3557976754']


def encode(self, word, max_length=<NUM_LIT:6>, zero_pad=True):

dms = ['<STR_LIT>']  <EOL>if max_length != -<NUM_LIT:1>:<EOL><INDENT>max_length = min(max(<NUM_LIT:6>, max_length), <NUM_LIT:64>)<EOL><DEDENT>else:<EOL><INDENT>max_length = <NUM_LIT:64><EOL><DEDENT>word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._uc_set)<EOL>if not word:<EOL><INDENT>if zero_pad:<EOL><INDENT>return {'<STR_LIT:0>' * max_length}<EOL><DEDENT>return {'<STR_LIT:0>'}<EOL><DEDENT>pos = <NUM_LIT:0><EOL>while pos < len(word):<EOL><INDENT>for sstr in self._dms_order[word[pos]]:  <EOL><INDENT>if word[pos:].startswith(sstr):<EOL><INDENT>dm_val = self._dms_table[sstr]<EOL>if pos == <NUM_LIT:0>:<EOL><INDENT>dm_val = dm_val[<NUM_LIT:0>]<EOL><DEDENT>elif (<EOL>pos + len(sstr) < len(word)<EOL>and word[pos + len(sstr)] in self._uc_v_set<EOL>):<EOL><INDENT>dm_val = dm_val[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>dm_val = dm_val[<NUM_LIT:2>]<EOL><DEDENT>if isinstance(dm_val, tuple):<EOL><INDENT>dms = [_ + text_type(dm_val[<NUM_LIT:0>]) for _ in dms] + [<EOL>_ + text_type(dm_val[<NUM_LIT:1>]) for _ in dms<EOL>]<EOL><DEDENT>else:<EOL><INDENT>dms = [_ + text_type(dm_val) for _ in dms]<EOL><DEDENT>pos += len(sstr)<EOL>break<EOL><DEDENT><DEDENT><DEDENT>dms = (<EOL>'<STR_LIT>'.join(c for c in self._delete_consecutive_repeats(_) if c != '<STR_LIT:_>')<EOL>for _ in dms<EOL>)<EOL>if zero_pad:<EOL><INDENT>dms = ((_ + ('<STR_LIT:0>' * max_length))[:max_length] for _ in dms)<EOL><DEDENT>else:<EOL><INDENT>dms = (_[:max_length] for _ in dms)<EOL><DEDENT>return set(dms)<EOL>

Return the Daitch-Mokotoff Soundex code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        max_length : int
            The length of the code returned (defaults to 6; must be between 6
            and 64)
        zero_pad : bool
            Pad the end of the return value with 0s to achieve a max_length
            string

        Returns
        -------
        str
            The Daitch-Mokotoff Soundex value

        Examples
        --------
        >>> pe = DaitchMokotoff()
        >>> sorted(pe.encode('Christopher'))
        ['494379', '594379']
        >>> pe.encode('Niall')
        {'680000'}
        >>> pe.encode('Smith')
        {'463000'}
        >>> pe.encode('Schmidt')
        {'463000'}

        >>> sorted(pe.encode('The quick brown fox', max_length=20,
        ... zero_pad=False))
        ['35457976754', '3557976754']


return HenryEarly().encode(word, max_length)<EOL>

Calculate the early version of the Henry code for a word.

    This is a wrapper for :py:meth:`HenryEarly.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    max_length : int
        The length of the code returned (defaults to 3)

    Returns
    -------
    str
        The early Henry code

    Examples
    --------
    >>> henry_early('Marchand')
    'MRC'
    >>> henry_early('Beaulieu')
    'BL'
    >>> henry_early('Beaumont')
    'BM'
    >>> henry_early('Legrand')
    'LGR'
    >>> henry_early('Pelletier')
    'PLT'


def encode(self, word, max_length=<NUM_LIT:3>):

word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._uc_set)<EOL>if not word:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>if word[<NUM_LIT:0>] in self._uc_vy_set:<EOL><INDENT>if (<EOL>word[<NUM_LIT:1>:<NUM_LIT:2>] in self._uc_c_set - {'<STR_LIT:M>', '<STR_LIT:N>'}<EOL>and word[<NUM_LIT:2>:<NUM_LIT:3>] in self._uc_c_set<EOL>) or (<EOL>word[<NUM_LIT:1>:<NUM_LIT:2>] in self._uc_c_set and word[<NUM_LIT:2>:<NUM_LIT:3>] not in self._uc_c_set<EOL>):<EOL><INDENT>if word[<NUM_LIT:0>] == '<STR_LIT:Y>':<EOL><INDENT>word = '<STR_LIT:I>' + word[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>elif word[<NUM_LIT:1>:<NUM_LIT:2>] in {'<STR_LIT:M>', '<STR_LIT:N>'} and word[<NUM_LIT:2>:<NUM_LIT:3>] in self._uc_c_set:<EOL><INDENT>if word[<NUM_LIT:0>] == '<STR_LIT:E>':<EOL><INDENT>word = '<STR_LIT:A>' + word[<NUM_LIT:1>:]<EOL><DEDENT>elif word[<NUM_LIT:0>] in {'<STR_LIT:I>', '<STR_LIT>', '<STR_LIT:Y>'}:<EOL><INDENT>word = '<STR_LIT:E>' + word[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>elif word[:<NUM_LIT:2>] in self._diph:<EOL><INDENT>word = self._diph[word[:<NUM_LIT:2>]] + word[<NUM_LIT:2>:]<EOL><DEDENT>elif word[<NUM_LIT:1>:<NUM_LIT:2>] in self._uc_vy_set and word[<NUM_LIT:0>] == '<STR_LIT:Y>':<EOL><INDENT>word = '<STR_LIT:I>' + word[<NUM_LIT:1>:]<EOL><DEDENT><DEDENT>code = '<STR_LIT>'<EOL>skip = <NUM_LIT:0><EOL>for pos, char in enumerate(word):<EOL><INDENT>nxch = word[pos + <NUM_LIT:1> : pos + <NUM_LIT:2>]<EOL>prev = word[pos - <NUM_LIT:1> : pos]<EOL>if skip:<EOL><INDENT>skip -= <NUM_LIT:1><EOL><DEDENT>elif char in self._uc_vy_set:<EOL><INDENT>code += char<EOL><DEDENT>elif char == nxch:<EOL><INDENT>skip = <NUM_LIT:1><EOL>code += char<EOL><DEDENT>elif word[pos : pos + <NUM_LIT:2>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>continue<EOL><DEDENT>elif char in self._simple:<EOL><INDENT>code += self._simple[char]<EOL><DEDENT>elif char in {'<STR_LIT:C>', '<STR_LIT>', '<STR_LIT:P>', '<STR_LIT>', '<STR_LIT:S>'}:<EOL><INDENT>if char == '<STR_LIT:C>':<EOL><INDENT>if nxch in {'<STR_LIT:A>', '<STR_LIT:O>', '<STR_LIT>', '<STR_LIT:L>', '<STR_LIT:R>'}:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>elif nxch in {'<STR_LIT:E>', '<STR_LIT:I>', '<STR_LIT:Y>'}:<EOL><INDENT>code += '<STR_LIT:S>'<EOL><DEDENT>elif nxch == '<STR_LIT:H>':<EOL><INDENT>if word[pos + <NUM_LIT:2> : pos + <NUM_LIT:3>] in self._uc_vy_set:<EOL><INDENT>code += '<STR_LIT:C>'<EOL><DEDENT>else:  <EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT><DEDENT>else:<EOL><INDENT>code += '<STR_LIT:C>'<EOL><DEDENT><DEDENT>elif char == '<STR_LIT>':<EOL><INDENT>if nxch in {'<STR_LIT:A>', '<STR_LIT:O>', '<STR_LIT>', '<STR_LIT:L>', '<STR_LIT:R>'}:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>elif nxch in {'<STR_LIT:E>', '<STR_LIT:I>', '<STR_LIT:Y>'}:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>elif nxch == '<STR_LIT:N>':<EOL><INDENT>code += '<STR_LIT:N>'<EOL><DEDENT><DEDENT>elif char == '<STR_LIT:P>':<EOL><INDENT>if nxch != '<STR_LIT:H>':<EOL><INDENT>code += '<STR_LIT:P>'<EOL><DEDENT>else:<EOL><INDENT>code += '<STR_LIT:F>'<EOL><DEDENT><DEDENT>elif char == '<STR_LIT>':<EOL><INDENT>if word[pos + <NUM_LIT:1> : pos + <NUM_LIT:3>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT>else:  <EOL><INDENT>code += '<STR_LIT>'<EOL><DEDENT><DEDENT>else:  <EOL><INDENT>if word[pos : pos + <NUM_LIT:6>] == '<STR_LIT>':<EOL><INDENT>code += '<STR_LIT:X>'<EOL>skip = <NUM_LIT:5><EOL><DEDENT>elif word[pos : pos + <NUM_LIT:5>] == '<STR_LIT>':<EOL><INDENT>code += '<STR_LIT:X>'<EOL>skip = <NUM_LIT:4><EOL><DEDENT>elif word[pos : pos + <NUM_LIT:3>] == '<STR_LIT>':<EOL><INDENT>code += '<STR_LIT:X>'<EOL>skip = <NUM_LIT:2><EOL><DEDENT>elif word[pos : pos + <NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>code += '<STR_LIT:X>'<EOL>skip = <NUM_LIT:1><EOL><DEDENT>elif nxch in self._uc_c_set:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>code += '<STR_LIT:S>'<EOL><DEDENT><DEDENT><DEDENT>elif char == '<STR_LIT:H>' and prev in self._uc_c_set:<EOL><INDENT>continue<EOL><DEDENT>elif char in self._uc_c_set - {<EOL>'<STR_LIT:L>',<EOL>'<STR_LIT:R>',<EOL>} and nxch in self._uc_c_set - {'<STR_LIT:L>', '<STR_LIT:R>'}:<EOL><INDENT>continue<EOL><DEDENT>elif char == '<STR_LIT:L>' and nxch in {'<STR_LIT:M>', '<STR_LIT:N>'}:<EOL><INDENT>continue<EOL><DEDENT>elif (<EOL>char in {'<STR_LIT:M>', '<STR_LIT:N>'}<EOL>and prev in self._uc_vy_set<EOL>and nxch in self._uc_c_set<EOL>):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>code += char<EOL><DEDENT><DEDENT>if code[-<NUM_LIT:4>:] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>code = code[:-<NUM_LIT:2>]<EOL><DEDENT>elif code[-<NUM_LIT:2>:-<NUM_LIT:1>] == '<STR_LIT:R>' and code[-<NUM_LIT:1>:] in self._uc_c_set:<EOL><INDENT>code = code[:-<NUM_LIT:1>]<EOL><DEDENT>elif code[-<NUM_LIT:2>:-<NUM_LIT:1>] in self._uc_vy_set and code[-<NUM_LIT:1>:] in {<EOL>'<STR_LIT:D>',<EOL>'<STR_LIT:M>',<EOL>'<STR_LIT:N>',<EOL>'<STR_LIT:S>',<EOL>'<STR_LIT:T>',<EOL>}:<EOL><INDENT>code = code[:-<NUM_LIT:1>]<EOL><DEDENT>elif code[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>code = code[:-<NUM_LIT:1>]<EOL><DEDENT>code = code[:<NUM_LIT:1>] + code[<NUM_LIT:1>:].translate(<EOL>{<NUM_LIT>: '<STR_LIT>', <NUM_LIT>: '<STR_LIT>', <NUM_LIT>: '<STR_LIT>', <NUM_LIT>: '<STR_LIT>', <NUM_LIT>: '<STR_LIT>', <NUM_LIT>: '<STR_LIT>'}<EOL>)<EOL>if max_length != -<NUM_LIT:1>:<EOL><INDENT>code = code[:max_length]<EOL><DEDENT>return code<EOL>

Calculate the early version of the Henry code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        max_length : int
            The length of the code returned (defaults to 3)

        Returns
        -------
        str
            The early Henry code

        Examples
        --------
        >>> henry_early('Marchand')
        'MRC'
        >>> henry_early('Beaulieu')
        'BL'
        >>> henry_early('Beaumont')
        'BM'
        >>> henry_early('Legrand')
        'LGR'
        >>> henry_early('Pelletier')
        'PLT'


return MetaSoundex().encode(word, lang)<EOL>

Return the MetaSoundex code for a word.

    This is a wrapper for :py:meth:`MetaSoundex.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    lang : str
        Either ``en`` for English or ``es`` for Spanish

    Returns
    -------
    str
        The MetaSoundex code

    Examples
    --------
    >>> metasoundex('Smith')
    '4500'
    >>> metasoundex('Waters')
    '7362'
    >>> metasoundex('James')
    '1520'
    >>> metasoundex('Schmidt')
    '4530'
    >>> metasoundex('Ashcroft')
    '0261'
    >>> metasoundex('Perez', lang='es')
    '094'
    >>> metasoundex('Martinez', lang='es')
    '69364'
    >>> metasoundex('Gutierrez', lang='es')
    '83994'
    >>> metasoundex('Santiago', lang='es')
    '4638'
    >>> metasoundex('Nicolás', lang='es')
    '6754'


def encode(self, word, lang='<STR_LIT>'):

if lang == '<STR_LIT>':<EOL><INDENT>return self._phonetic_spanish.encode(<EOL>self._spanish_metaphone.encode(word)<EOL>)<EOL><DEDENT>word = self._soundex.encode(self._metaphone.encode(word))<EOL>word = word[<NUM_LIT:0>].translate(self._trans) + word[<NUM_LIT:1>:]<EOL>return word<EOL>

Return the MetaSoundex code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        lang : str
            Either ``en`` for English or ``es`` for Spanish

        Returns
        -------
        str
            The MetaSoundex code

        Examples
        --------
        >>> pe = MetaSoundex()
        >>> pe.encode('Smith')
        '4500'
        >>> pe.encode('Waters')
        '7362'
        >>> pe.encode('James')
        '1520'
        >>> pe.encode('Schmidt')
        '4530'
        >>> pe.encode('Ashcroft')
        '0261'
        >>> pe.encode('Perez', lang='es')
        '094'
        >>> pe.encode('Martinez', lang='es')
        '69364'
        >>> pe.encode('Gutierrez', lang='es')
        '83994'
        >>> pe.encode('Santiago', lang='es')
        '4638'
        >>> pe.encode('Nicolás', lang='es')
        '6754'


def dolby(word, max_length=-<NUM_LIT:1>, keep_vowels=False, vowel_char='<STR_LIT:*>'):

return Dolby().encode(word, max_length, keep_vowels, vowel_char)<EOL>

r"""Return the Dolby Code of a name.

    This is a wrapper for :py:meth:`Dolby.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    max_length : int
        Maximum length of the returned Dolby code -- this also activates the
        fixed-length code mode if it is greater than 0
    keep_vowels : bool
        If True, retains all vowel markers
    vowel_char : str
        The vowel marker character (default to \*)

    Returns
    -------
    str
        The Dolby Code

    Examples
    --------
    >>> dolby('Hansen')
    'H*NSN'
    >>> dolby('Larsen')
    'L*RSN'
    >>> dolby('Aagaard')
    '*GR'
    >>> dolby('Braaten')
    'BR*DN'
    >>> dolby('Sandvik')
    'S*NVK'
    >>> dolby('Hansen', max_length=6)
    'H*NS*N'
    >>> dolby('Larsen', max_length=6)
    'L*RS*N'
    >>> dolby('Aagaard', max_length=6)
    '*G*R  '
    >>> dolby('Braaten', max_length=6)
    'BR*D*N'
    >>> dolby('Sandvik', max_length=6)
    'S*NF*K'

    >>> dolby('Smith')
    'SM*D'
    >>> dolby('Waters')
    'W*DRS'
    >>> dolby('James')
    'J*MS'
    >>> dolby('Schmidt')
    'SM*D'
    >>> dolby('Ashcroft')
    '*SKRFD'
    >>> dolby('Smith', max_length=6)
    'SM*D  '
    >>> dolby('Waters', max_length=6)
    'W*D*RS'
    >>> dolby('James', max_length=6)
    'J*M*S '
    >>> dolby('Schmidt', max_length=6)
    'SM*D  '
    >>> dolby('Ashcroft', max_length=6)
    '*SKRFD'


def encode(self, word, max_length=-<NUM_LIT:1>, keep_vowels=False, vowel_char='<STR_LIT:*>'):

<EOL>word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._uc_set)<EOL>if word[:<NUM_LIT:3>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:3>:]<EOL><DEDENT>elif word[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:2>:]<EOL><DEDENT>pos = len(word) - <NUM_LIT:2><EOL>while pos > -<NUM_LIT:1>:<EOL><INDENT>if word[pos : pos + <NUM_LIT:2>] in {<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>'<STR_LIT>',<EOL>}:<EOL><INDENT>word = word[: pos + <NUM_LIT:1>] + word[pos + <NUM_LIT:2> :]<EOL>pos += <NUM_LIT:1><EOL><DEDENT>pos -= <NUM_LIT:1><EOL><DEDENT>word = word.replace('<STR_LIT:X>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>pos = word.find('<STR_LIT>', <NUM_LIT:1>)<EOL>while pos != -<NUM_LIT:1>:<EOL><INDENT>if word[pos - <NUM_LIT:1> : pos] not in self._uc_vy_set:<EOL><INDENT>word = word[:pos] + '<STR_LIT:S>' + word[pos + <NUM_LIT:1> :]<EOL><DEDENT>pos = word.find('<STR_LIT>', pos + <NUM_LIT:1>)<EOL><DEDENT>word = word.replace('<STR_LIT:C>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT:S>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT:R>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT:T>', '<STR_LIT:D>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT:F>')<EOL>pos = word.find('<STR_LIT>', <NUM_LIT:0>)<EOL>while pos != -<NUM_LIT:1>:<EOL><INDENT>if pos > <NUM_LIT:1> and word[pos - <NUM_LIT:1> : pos] not in self._uc_vy_set | {<EOL>'<STR_LIT:L>',<EOL>'<STR_LIT:N>',<EOL>'<STR_LIT:R>',<EOL>}:<EOL><INDENT>word = word[: pos - <NUM_LIT:1>] + word[pos:]<EOL>pos -= <NUM_LIT:1><EOL><DEDENT>pos = word.find('<STR_LIT>', pos + <NUM_LIT:1>)<EOL><DEDENT>if max_length > <NUM_LIT:0> and word[-<NUM_LIT:1>:] == '<STR_LIT:E>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>word = self._delete_consecutive_repeats(word)<EOL>if word[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>word = word[<NUM_LIT:1>:]<EOL><DEDENT>if word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>elif word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>if word[-<NUM_LIT:3>:-<NUM_LIT:2>] in self._uc_vy_set:<EOL><INDENT>word = word[:-<NUM_LIT:2>] + '<STR_LIT:F>'<EOL><DEDENT>else:<EOL><INDENT>word = word[:-<NUM_LIT:2>] + '<STR_LIT>'<EOL><DEDENT><DEDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>if max_length > <NUM_LIT:0>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT:F>')<EOL><DEDENT>first = <NUM_LIT:1> + (<NUM_LIT:1> if max_length > <NUM_LIT:0> else <NUM_LIT:0>)<EOL>code = '<STR_LIT>'<EOL>for pos, char in enumerate(word):<EOL><INDENT>if char in self._uc_vy_set:<EOL><INDENT>if first or keep_vowels:<EOL><INDENT>code += vowel_char<EOL>first -= <NUM_LIT:1><EOL><DEDENT><DEDENT>elif pos > <NUM_LIT:0> and char in {'<STR_LIT>', '<STR_LIT:H>'}:<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>code += char<EOL><DEDENT><DEDENT>if max_length > <NUM_LIT:0>:<EOL><INDENT>if len(code) > max_length and code[-<NUM_LIT:1>:] == '<STR_LIT:S>':<EOL><INDENT>code = code[:-<NUM_LIT:1>]<EOL><DEDENT>if keep_vowels:<EOL><INDENT>code = code[:max_length]<EOL><DEDENT>else:<EOL><INDENT>code = code[: max_length + <NUM_LIT:2>]<EOL>while len(code) > max_length:<EOL><INDENT>vowels = len(code) - max_length<EOL>excess = vowels - <NUM_LIT:1><EOL>word = code<EOL>code = '<STR_LIT>'<EOL>for char in word:<EOL><INDENT>if char == vowel_char:<EOL><INDENT>if vowels:<EOL><INDENT>code += char<EOL>vowels -= <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>code += char<EOL><DEDENT><DEDENT>code = code[: max_length + excess]<EOL><DEDENT><DEDENT>code += '<STR_LIT:U+0020>' * (max_length - len(code))<EOL><DEDENT>return code<EOL>

r"""Return the Dolby Code of a name.

        Parameters
        ----------
        word : str
            The word to transform
        max_length : int
            Maximum length of the returned Dolby code -- this also activates
            the fixed-length code mode if it is greater than 0
        keep_vowels : bool
            If True, retains all vowel markers
        vowel_char : str
            The vowel marker character (default to \*)

        Returns
        -------
        str
            The Dolby Code

        Examples
        --------
        >>> pe = Dolby()
        >>> pe.encode('Hansen')
        'H*NSN'
        >>> pe.encode('Larsen')
        'L*RSN'
        >>> pe.encode('Aagaard')
        '*GR'
        >>> pe.encode('Braaten')
        'BR*DN'
        >>> pe.encode('Sandvik')
        'S*NVK'
        >>> pe.encode('Hansen', max_length=6)
        'H*NS*N'
        >>> pe.encode('Larsen', max_length=6)
        'L*RS*N'
        >>> pe.encode('Aagaard', max_length=6)
        '*G*R  '
        >>> pe.encode('Braaten', max_length=6)
        'BR*D*N'
        >>> pe.encode('Sandvik', max_length=6)
        'S*NF*K'

        >>> pe.encode('Smith')
        'SM*D'
        >>> pe.encode('Waters')
        'W*DRS'
        >>> pe.encode('James')
        'J*MS'
        >>> pe.encode('Schmidt')
        'SM*D'
        >>> pe.encode('Ashcroft')
        '*SKRFD'
        >>> pe.encode('Smith', max_length=6)
        'SM*D  '
        >>> pe.encode('Waters', max_length=6)
        'W*D*RS'
        >>> pe.encode('James', max_length=6)
        'J*M*S '
        >>> pe.encode('Schmidt', max_length=6)
        'SM*D  '
        >>> pe.encode('Ashcroft', max_length=6)
        '*SKRFD'


return Phonem().encode(word)<EOL>

Return the Phonem code for a word.

    This is a wrapper for :py:meth:`Phonem.encode`.

    Parameters
    ----------
    word : str
        The word to transform

    Returns
    -------
    str
        The Phonem value

    Examples
    --------
    >>> phonem('Christopher')
    'CRYSDOVR'
    >>> phonem('Niall')
    'NYAL'
    >>> phonem('Smith')
    'SMYD'
    >>> phonem('Schmidt')
    'CMYD'


word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>for i, j in self._substitutions:<EOL><INDENT>word = word.replace(i, j)<EOL><DEDENT>word = word.translate(self._trans)<EOL>return '<STR_LIT>'.join(<EOL>c<EOL>for c in self._delete_consecutive_repeats(word)<EOL>if c in self._uc_set<EOL>)<EOL>

Return the Phonem code for a word.

        Parameters
        ----------
        word : str
        The word to transform

        Returns
        -------
        str
            The Phonem value

        Examples
        --------
        >>> pe = Phonem()
        >>> pe.encode('Christopher')
        'CRYSDOVR'
        >>> pe.encode('Niall')
        'NYAL'
        >>> pe.encode('Smith')
        'SMYD'
        >>> pe.encode('Schmidt')
        'CMYD'


return StatisticsCanada().encode(word, max_length)<EOL>

Return the Statistics Canada code for a word.

    This is a wrapper for :py:meth:`StatisticsCanada.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    max_length : int
        The maximum length (default 4) of the code to return

    Returns
    -------
    str
        The Statistics Canada name code value

    Examples
    --------
    >>> statistics_canada('Christopher')
    'CHRS'
    >>> statistics_canada('Niall')
    'NL'
    >>> statistics_canada('Smith')
    'SMTH'
    >>> statistics_canada('Schmidt')
    'SCHM'


def encode(self, word, max_length=<NUM_LIT:4>):

<EOL>word = unicode_normalize('<STR_LIT>', text_type(word.upper()))<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._uc_set)<EOL>if not word:<EOL><INDENT>return '<STR_LIT>'<EOL><DEDENT>code = word[<NUM_LIT:1>:]<EOL>for vowel in self._uc_vy_set:<EOL><INDENT>code = code.replace(vowel, '<STR_LIT>')<EOL><DEDENT>code = word[<NUM_LIT:0>] + code<EOL>code = self._delete_consecutive_repeats(code)<EOL>code = code.replace('<STR_LIT:U+0020>', '<STR_LIT>')<EOL>return code[:max_length]<EOL>

Return the Statistics Canada code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        max_length : int
            The maximum length (default 4) of the code to return

        Returns
        -------
        str
            The Statistics Canada name code value

        Examples
        --------
        >>> pe = StatisticsCanada()
        >>> pe.encode('Christopher')
        'CHRS'
        >>> pe.encode('Niall')
        'NL'
        >>> pe.encode('Smith')
        'SMTH'
        >>> pe.encode('Schmidt')
        'SCHM'


return Caverphone().encode(word, version)<EOL>

Return the Caverphone code for a word.

    This is a wrapper for :py:meth:`Caverphone.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    version : int
        The version of Caverphone to employ for encoding (defaults to 2)

    Returns
    -------
    str
        The Caverphone value

    Examples
    --------
    >>> caverphone('Christopher')
    'KRSTFA1111'
    >>> caverphone('Niall')
    'NA11111111'
    >>> caverphone('Smith')
    'SMT1111111'
    >>> caverphone('Schmidt')
    'SKMT111111'

    >>> caverphone('Christopher', 1)
    'KRSTF1'
    >>> caverphone('Niall', 1)
    'N11111'
    >>> caverphone('Smith', 1)
    'SMT111'
    >>> caverphone('Schmidt', 1)
    'SKMT11'


def encode(self, word, version=<NUM_LIT:2>):

word = word.lower()<EOL>word = '<STR_LIT>'.join(c for c in word if c in self._lc_set)<EOL>def _squeeze_replace(word, char):<EOL><INDENT>"""<STR_LIT>"""<EOL>while char * <NUM_LIT:2> in word:<EOL><INDENT>word = word.replace(char * <NUM_LIT:2>, char)<EOL><DEDENT>return word.replace(char, char.upper())<EOL><DEDENT>if version != <NUM_LIT:1> and word[-<NUM_LIT:1>:] == '<STR_LIT:e>':<EOL><INDENT>word = word[:-<NUM_LIT:1>]<EOL><DEDENT>if word:<EOL><INDENT>if word[:<NUM_LIT:5>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:5>:]<EOL><DEDENT>if word[:<NUM_LIT:5>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:5>:]<EOL><DEDENT>if word[:<NUM_LIT:5>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:5>:]<EOL><DEDENT>if word[:<NUM_LIT:6>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:6>:]<EOL><DEDENT>if version != <NUM_LIT:1> and word[:<NUM_LIT:6>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:6>:]<EOL><DEDENT>if word[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:2>:]<EOL><DEDENT>if word[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:2>'<EOL><DEDENT>for src, tar in (<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT:c>', '<STR_LIT:k>'),<EOL>('<STR_LIT:q>', '<STR_LIT:k>'),<EOL>('<STR_LIT:x>', '<STR_LIT:k>'),<EOL>('<STR_LIT:v>', '<STR_LIT:f>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT:d>', '<STR_LIT:t>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT:b>', '<STR_LIT:p>'),<EOL>('<STR_LIT>', '<STR_LIT>'),<EOL>('<STR_LIT:z>', '<STR_LIT:s>'),<EOL>):<EOL><INDENT>word = word.replace(src, tar)<EOL><DEDENT>if word[<NUM_LIT:0>] in self._lc_v_set:<EOL><INDENT>word = '<STR_LIT:A>' + word[<NUM_LIT:1>:]<EOL><DEDENT>for vowel in '<STR_LIT>':<EOL><INDENT>word = word.replace(vowel, '<STR_LIT:3>')<EOL><DEDENT>if version != <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT:y>')<EOL>if word[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:2>:]<EOL><DEDENT>if word[:<NUM_LIT:1>] == '<STR_LIT:y>':<EOL><INDENT>word = '<STR_LIT:A>' + word[<NUM_LIT:1>:]<EOL><DEDENT>word = word.replace('<STR_LIT:y>', '<STR_LIT:3>')<EOL><DEDENT>for src, tar in (('<STR_LIT>', '<STR_LIT>'), ('<STR_LIT>', '<STR_LIT>'), ('<STR_LIT:g>', '<STR_LIT:k>')):<EOL><INDENT>word = word.replace(src, tar)<EOL><DEDENT>for char in '<STR_LIT>':<EOL><INDENT>word = _squeeze_replace(word, char)<EOL><DEDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>if version == <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>if version == <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if version != <NUM_LIT:1> and word[-<NUM_LIT:1>:] == '<STR_LIT:w>':<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:3>'<EOL><DEDENT>word = word.replace('<STR_LIT:w>', '<STR_LIT:2>')<EOL>if word[:<NUM_LIT:1>] == '<STR_LIT:h>':<EOL><INDENT>word = '<STR_LIT:A>' + word[<NUM_LIT:1>:]<EOL><DEDENT>word = word.replace('<STR_LIT:h>', '<STR_LIT:2>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>if version == <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if version != <NUM_LIT:1> and word[-<NUM_LIT:1>:] == '<STR_LIT:r>':<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:3>'<EOL><DEDENT>word = word.replace('<STR_LIT:r>', '<STR_LIT:2>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>if version == <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL><DEDENT>if version != <NUM_LIT:1> and word[-<NUM_LIT:1>:] == '<STR_LIT:l>':<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:3>'<EOL><DEDENT>word = word.replace('<STR_LIT:l>', '<STR_LIT:2>')<EOL>if version == <NUM_LIT:1>:<EOL><INDENT>word = word.replace('<STR_LIT>', '<STR_LIT:y>')<EOL>word = word.replace('<STR_LIT>', '<STR_LIT>')<EOL>word = word.replace('<STR_LIT:y>', '<STR_LIT:2>')<EOL><DEDENT>word = word.replace('<STR_LIT:2>', '<STR_LIT>')<EOL>if version != <NUM_LIT:1> and word[-<NUM_LIT:1>:] == '<STR_LIT:3>':<EOL><INDENT>word = word[:-<NUM_LIT:1>] + '<STR_LIT:A>'<EOL><DEDENT>word = word.replace('<STR_LIT:3>', '<STR_LIT>')<EOL><DEDENT>word += '<STR_LIT:1>' * <NUM_LIT:10><EOL>if version != <NUM_LIT:1>:<EOL><INDENT>word = word[:<NUM_LIT:10>]<EOL><DEDENT>else:<EOL><INDENT>word = word[:<NUM_LIT:6>]<EOL><DEDENT>return word<EOL>

Return the Caverphone code for a word.

        Parameters
        ----------
        word : str
            The word to transform
        version : int
            The version of Caverphone to employ for encoding (defaults to 2)

        Returns
        -------
        str
            The Caverphone value

        Examples
        --------
        >>> pe = Caverphone()
        >>> pe.encode('Christopher')
        'KRSTFA1111'
        >>> pe.encode('Niall')
        'NA11111111'
        >>> pe.encode('Smith')
        'SMT1111111'
        >>> pe.encode('Schmidt')
        'SKMT111111'

        >>> pe.encode('Christopher', 1)
        'KRSTF1'
        >>> pe.encode('Niall', 1)
        'N11111'
        >>> pe.encode('Smith', 1)
        'SMT111'
        >>> pe.encode('Schmidt', 1)
        'SKMT11'


def pshp_soundex_last(lname, max_length=<NUM_LIT:4>, german=False):

return PSHPSoundexLast().encode(lname, max_length, german)<EOL>

Calculate the PSHP Soundex/Viewex Coding of a last name.

    This is a wrapper for :py:meth:`PSHPSoundexLast.encode`.

    Parameters
    ----------
    lname : str
        The last name to encode
    max_length : int
        The length of the code returned (defaults to 4)
    german : bool
        Set to True if the name is German (different rules apply)

    Returns
    -------
    str
        The PSHP Soundex/Viewex Coding

    Examples
    --------
    >>> pshp_soundex_last('Smith')
    'S530'
    >>> pshp_soundex_last('Waters')
    'W350'
    >>> pshp_soundex_last('James')
    'J500'
    >>> pshp_soundex_last('Schmidt')
    'S530'
    >>> pshp_soundex_last('Ashcroft')
    'A225'


def encode(self, lname, max_length=<NUM_LIT:4>, german=False):

lname = unicode_normalize('<STR_LIT>', text_type(lname.upper()))<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT>')<EOL>lname = '<STR_LIT>'.join(c for c in lname if c in self._uc_set)<EOL>if lname[:<NUM_LIT:3>] == '<STR_LIT>' or lname[:<NUM_LIT:3>] == '<STR_LIT>':<EOL><INDENT>lname = lname[<NUM_LIT:3>:].strip()<EOL><DEDENT>if not german:<EOL><INDENT>if lname[:<NUM_LIT:3>] == '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT:M>' + lname[<NUM_LIT:3>:]<EOL><DEDENT>elif lname[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT:M>' + lname[<NUM_LIT:2>:]<EOL><DEDENT><DEDENT>if lname[:<NUM_LIT:1>] in {'<STR_LIT:E>', '<STR_LIT:I>', '<STR_LIT:O>', '<STR_LIT>'}:<EOL><INDENT>lname = '<STR_LIT:A>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:2>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = '<STR_LIT>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:2>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = '<STR_LIT:S>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:3>] == '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:1>] == '<STR_LIT:C>' and lname[:<NUM_LIT:2>] != '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>if lname[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT:N>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>lname = '<STR_LIT:F>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>elif lname[:<NUM_LIT:3>] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = '<STR_LIT>' + lname[<NUM_LIT:1>:]<EOL><DEDENT>if german and lname[:<NUM_LIT:1>] in {'<STR_LIT>', '<STR_LIT:M>', '<STR_LIT:Y>', '<STR_LIT>'}:<EOL><INDENT>lname = {'<STR_LIT>': '<STR_LIT>', '<STR_LIT:M>': '<STR_LIT:N>', '<STR_LIT:Y>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT:S>'}[lname[<NUM_LIT:0>]] + lname[<EOL><NUM_LIT:1>:<EOL>]<EOL><DEDENT>code = lname[:<NUM_LIT:1>]<EOL>if german:  <EOL><INDENT>if lname[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:3>]<EOL><DEDENT>elif lname[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:2>]<EOL><DEDENT>if lname[-<NUM_LIT:3>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:3>]<EOL><DEDENT>elif lname[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:2>]<EOL><DEDENT>if lname[-<NUM_LIT:1>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:1>]<EOL><DEDENT>elif lname[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:2>]<EOL><DEDENT><DEDENT>if lname[-<NUM_LIT:1>:] == '<STR_LIT:R>':<EOL><INDENT>lname = lname[:-<NUM_LIT:1>] + '<STR_LIT:N>'<EOL><DEDENT>elif lname[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = lname[:-<NUM_LIT:2>]<EOL><DEDENT>if lname[-<NUM_LIT:2>:] == '<STR_LIT>':<EOL><INDENT>lname = lname[:-<NUM_LIT:2>]<EOL><DEDENT>elif lname[-<NUM_LIT:1>:] == '<STR_LIT:S>':<EOL><INDENT>lname = lname[:-<NUM_LIT:1>]<EOL><DEDENT>if not german:<EOL><INDENT>l5_repl = {'<STR_LIT>': '<STR_LIT>', '<STR_LIT>': '<STR_LIT>'}<EOL>l4_repl = {<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>}<EOL>if lname[-<NUM_LIT:5>:] in l5_repl:<EOL><INDENT>lname = lname[:-<NUM_LIT:5>] + l5_repl[lname[-<NUM_LIT:5>:]]<EOL><DEDENT>elif lname[-<NUM_LIT:4>:] in l4_repl:<EOL><INDENT>lname = lname[:-<NUM_LIT:4>] + l4_repl[lname[-<NUM_LIT:4>:]]<EOL><DEDENT><DEDENT>if lname[-<NUM_LIT:2>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = lname[:-<NUM_LIT:1>]<EOL><DEDENT>if not german and lname[-<NUM_LIT:3>:] in {'<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>lname = lname[:-<NUM_LIT:3>] + '<STR_LIT:A>' + lname[-<NUM_LIT:2>:]<EOL><DEDENT>lname = lname.replace('<STR_LIT>', '<STR_LIT:C>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:S>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:T>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:N>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:N>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:M>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT:M>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT>')<EOL>lname = lname.replace('<STR_LIT>', '<STR_LIT>')<EOL>lname = lname.translate(self._trans)<EOL>lname = self._delete_consecutive_repeats(lname)<EOL>code += lname[<NUM_LIT:1>:]<EOL>code = code.replace('<STR_LIT:0>', '<STR_LIT>')  <EOL>if max_length != -<NUM_LIT:1>:<EOL><INDENT>if len(code) < max_length:<EOL><INDENT>code += '<STR_LIT:0>' * (max_length - len(code))<EOL><DEDENT>else:<EOL><INDENT>code = code[:max_length]<EOL><DEDENT><DEDENT>return code<EOL>

Calculate the PSHP Soundex/Viewex Coding of a last name.

        Parameters
        ----------
        lname : str
            The last name to encode
        max_length : int
            The length of the code returned (defaults to 4)
        german : bool
            Set to True if the name is German (different rules apply)

        Returns
        -------
        str
            The PSHP Soundex/Viewex Coding

        Examples
        --------
        >>> pe = PSHPSoundexLast()
        >>> pe.encode('Smith')
        'S530'
        >>> pe.encode('Waters')
        'W350'
        >>> pe.encode('James')
        'J500'
        >>> pe.encode('Schmidt')
        'S530'
        >>> pe.encode('Ashcroft')
        'A225'


def phonet(word, mode=<NUM_LIT:1>, lang='<STR_LIT>'):

return Phonet().encode(word, mode, lang)<EOL>

Return the phonet code for a word.

    This is a wrapper for :py:meth:`Phonet.encode`.

    Parameters
    ----------
    word : str
        The word to transform
    mode : int
        The ponet variant to employ (1 or 2)
    lang : str
        ``de`` (default) for German, ``none`` for no language

    Returns
    -------
    str
        The phonet value

    Examples
    --------
    >>> phonet('Christopher')
    'KRISTOFA'
    >>> phonet('Niall')
    'NIAL'
    >>> phonet('Smith')
    'SMIT'
    >>> phonet('Schmidt')
    'SHMIT'

    >>> phonet('Christopher', mode=2)
    'KRIZTUFA'
    >>> phonet('Niall', mode=2)
    'NIAL'
    >>> phonet('Smith', mode=2)
    'ZNIT'
    >>> phonet('Schmidt', mode=2)
    'ZNIT'

    >>> phonet('Christopher', lang='none')
    'CHRISTOPHER'
    >>> phonet('Niall', lang='none')
    'NIAL'
    >>> phonet('Smith', lang='none')
    'SMITH'
    >>> phonet('Schmidt', lang='none')
    'SCHMIDT'