process (word, codeLength) {
    codeLength = codeLength || 6
    word = word.toUpperCase()
    let output = ''

    let pos = 0; let lastCode = -1
    while (pos < word.length) {
      const substr = word.slice(pos)
      const rules = this.findRules(substr)

      let code
      if (pos === 0) {
        // at the beginning of the word
        code = rules.mapping[0]
      } else if (substr[rules.length] && this.findRules(substr[rules.length]).mapping[0] === 0) {
        // before a vowel
        code = rules.mapping[1]
      } else {
        // any other situation
        code = rules.mapping[2]
      }

      if ((code !== -1) && (code !== lastCode)) output += code
      lastCode = code
      pos += rules.length
    }

    return this.normalizeLength(output, codeLength)
  }
D-M transformation table in the form of finite-state machine.
Every element of the table having member with zero index represents
legal FSM state; every non-zero key is the transition rule.

Every legal state comprises tree values chosen according to the position
of the letter combination in the word:
  0: start of a word;
  1: before a vowel;
  2: any other situation.