/**
   * Fix all words that should be capitalized upon preceding a certain string.
   *
   * @param line line to fix
   * @param so {@link SubtitleObject}
   * @return fixed line
   */
  private static String fixPrecedingShouldCapitalize(String line, SubtitleObject so) {
    String[] split = so.split(RegexEnum.SPACE, line);
    String prevPrev = null, prev = null, current = null;
    boolean shouldCapitalize = false;
    for (int i = 0; i < split.length; ++i) {
      prevPrev = prev;
      prev = current;
      current = split[i];
      if (prev != null && PRECEDING_SHOULD_CAPITALIZE.contains(prev)) {
        shouldCapitalize = true;
        if (prev.equals(".") && prevPrev != null && prevPrev.equals(".")) { // ellipses
          shouldCapitalize = false;
        } else if (!current.equals("\"")
            && !RegexUtil.matches(RegexEnum.MATCH_DIGIT_AND_S, current)) {
          if (!StringUtil.startsUpperCase(current)) {
            split[i] = StringUtil.capitalize(current);
          }
          shouldCapitalize = false;
        }
      } else if (shouldCapitalize) {
        if (!StringUtil.isPunctuation(current)) {
          split[i] = StringUtil.capitalize(current);
          shouldCapitalize = false;
        }
      }
    }

    return String.join(" ", split);
  }
  /**
   * Fix all proper nouns.
   *
   * @param line line to fix
   * @param so {@link SubtitleObject}
   * @return fixed line
   */
  private static String fixProperNouns(String line, SubtitleObject so) {
    String[] split = so.split(RegexEnum.SPACE, line);
    String current = null;
    for (int i = 0; i < split.length; ++i) {
      current = split[i];
      if (!StringUtil.isPunctuation(current) && !StringUtil.containsLettersAndNumbers(current)) {
        if (StringUtil.startsUpperCase(current)
            && current.length() > 1
            && StringUtil.countUppercase(current) == 1) {
          if (!PROPER_NOUNS.contains(current) && !POTENTIAL_PROPER_NOUNS.contains(current)) {
            split[i] = current.toLowerCase();
          }
        } else {
          if (PROPER_NOUNS.contains(current)) {
            split[i] = StringUtil.capitalize(current);
          }
        }
      }
    }

    return String.join(" ", split);
  }