def encode(self, word, max_length=<NUM_LIT:4>):
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:2>] in {'<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>'}:<EOL><INDENT>word = word[<NUM_LIT:1>:]<EOL><DEDENT>elif word[:<NUM_LIT:1>] == '<STR_LIT:X>':<EOL><INDENT>word = '<STR_LIT:S>' + word[<NUM_LIT:1>:]<EOL><DEDENT>elif word[:<NUM_LIT:2>] == '<STR_LIT>':<EOL><INDENT>word = '<STR_LIT>' + word[<NUM_LIT:2>:]<EOL><DEDENT>word = (<EOL>word.replace('<STR_LIT>', '<STR_LIT>').replace('<STR_LIT>', '<STR_LIT>').replace('<STR_LIT>', '<STR_LIT:0>')<EOL>)<EOL>word = word.translate(self._trans)<EOL>word = self._delete_consecutive_repeats(word)<EOL>word = word.replace('<STR_LIT:0>', '<STR_LIT>')<EOL>if max_length != -<NUM_LIT:1>:<EOL><INDENT>if len(word) < max_length:<EOL><INDENT>word += '<STR_LIT:0>' * (max_length - len(word))<EOL><DEDENT>else:<EOL><INDENT>word = word[:max_length]<EOL><DEDENT><DEDENT>return word<EOL>
Return the SoundD code.

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

        Returns
        -------
        str
            The SoundD code

        Examples
        --------
        >>> sound_d('Gough')
        '2000'
        >>> sound_d('pneuma')
        '5500'
        >>> sound_d('knight')
        '5300'
        >>> sound_d('trice')
        '3620'
        >>> sound_d('judge')
        '2200'