code: function applyRules(rules, stem) {
  
    for (let i = 0, l = rules.length; i < l; i++) {
      const [min, pattern, replacement = ''] = rules[i];
  
      if (stem.slice(-pattern.length) === pattern) {
        const newStem = stem.slice(0, -pattern.length) + replacement,
              m = computeM(newStem);
  
        if (m <= min)
          continue;
  
        return newStem;
      }
    }
  
    return stem;
  }
docs: Function used to apply a set of rules to the current stem.
  
  @param  {string} stem - Target stem.
  @return {string}      - The resulting stem.