private String replaceWord(String word,
                             Map<String, String> replaceMap,
                             Map<String, String> keepMap,
                             List<? extends Map.Entry<Pattern, String>> rules) {
    if (Strings.isEmpty(word)) return word;

    // Get the correct token and case restoration functions.
    // Check against the keep object map.
    if (keepMap.containsKey(word)) return word;

    // Check against the replacement map for a direct word replacement.
    String replacement = replaceMap.get(word);
    if (replacement != null) {
      return replacement;
    }

    // Run all the rules against the word.
    return sanitizeWord(word, rules);
  }
private String replaceWord(String word,
                             Map<String, String> replaceMap,
                             Map<String, String> keepMap,
                             List<? extends Map.Entry<Pattern, String>> rules)