stanfordnlp/CoreNLP · error · IllegalArgumentException

ChineseUtils: Unsupported parameter option: midDot=

Error message

ChineseUtils: Unsupported parameter option: midDot=

What it means

In ChineseUtils.normalizeBMP, the midDot option controls how the middle-dot character is treated (LEAVE, DELETE, etc.); an unrecognized value falls to the switch's default branch, throwing this IllegalArgumentException. It indicates an unsupported middle-dot handling mode rather than bad input text.

Solutions

  1. Use the named midDot constants from ChineseUtils (LEAVE, DELETE, etc.) instead of raw ints
  2. Verify your library version's constant set matches what your code passes
  3. Add an explicit check of midDot against known constants before calling normalize

Example fix

// before
String norm = ChineseUtils.normalize(in, ascii, spaceChar, 5);
// after
String norm = ChineseUtils.normalize(in, ascii, spaceChar, ChineseUtils.DELETE);
Defensive patterns

Strategy: validation

Validate before calling

Set<Integer> legalMidDot = Set.of(ChineseUtils.LEAVE, ChineseUtils.DELETE);
if (!legalMidDot.contains(midDotMode)) throw new IllegalArgumentException("unknown midDot mode: " + midDotMode);

Try / catch

try {
  String norm = ChineseUtils.normalize(in, ascii, spaceChar, midDotMode);
} catch (IllegalArgumentException e) {
  if (!e.getMessage().contains("midDot=")) throw e;
  norm = ChineseUtils.normalize(in, ascii, spaceChar, ChineseUtils.LEAVE);
}

Prevention

When it happens

Trigger: Calling ChineseUtils.normalize with a midDot argument that is within the legal range but not one of the constants normalizeBMP's switch handles, e.g. a raw int or a constant from an incompatible library version.

Common situations: Copy-pasted option integers from old scripts, constants renamed between library releases, or hardcoded midDot values instead of the named constants.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/5212c5078316e71a. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/trees/international/pennchinese/ChineseUtils.java:193

        case LEAVE:
          break;
        case NORMALIZE:
          if (isMidDot(cp)) {
            cp = '\u00B7';
          }
          break;
        case FULLWIDTH:
          if (isMidDot(cp)) {
            cp = '\u30FB';
          }
          break;
        case DELETE:
          if (isMidDot(cp)) {
            delete = true;
          }
          break;
        default:
          throw new IllegalArgumentException("ChineseUtils: Unsupported parameter option: midDot=" + midDot);
      }
      if ( ! delete) {
        out.append(cp);
      }
    } // end for
    return out.toString();
  }

  private static String normalizeUnicode(String in, int ascii, int spaceChar, int midDot) {
    StringBuilder out = new StringBuilder();
    int len = in.length();
    // Do it properly with codepoints, for non-BMP Unicode as well
    // int numCP = in.codePointCount(0, len);
    int cpp = 0; // previous codepoint
    for (int offset = 0, cp; offset < len; offset += Character.charCount(cp)) {
      // int offset = in.offsetByCodePoints(0, offset);
      cp = in.codePointAt(offset);
      Character.UnicodeBlock cub = Character.UnicodeBlock.of(cp);

View on GitHub (pinned to 1b7edd19c4)