stanfordnlp/CoreNLP · error · IllegalArgumentException
ChineseUtils: Unsupported parameter option: ascii=
Error message
ChineseUtils: Unsupported parameter option: ascii=
What it means
Inside ChineseUtils.normalizeBMP, the per-codepoint conversion switches on the ascii option; any value not matching a known case (LEAVE/ASCII/FULLWIDTH etc.) reaches the default branch and throws this IllegalArgumentException. It means the ascii normalization mode is a constant the BMP normalizer does not implement — a legal-but-unknown constant passes normalize's range check and only fails here.
Solutions
- Pass one of the documented ascii constants from ChineseUtils (e.g. ASCII, FULLWIDTH, LEAVE) instead of a raw int
- Log the ascii value at the failure point to identify the bad constant in your caller
- Upgrade/synchronize your code and Stanford ChineseUtils versions so constants match
Example fix
// before int asciiMode = 3; // unknown to the switch String norm = ChineseUtils.normalize(in, asciiMode, spaceChar, midDot); // after String norm = ChineseUtils.normalize(in, ChineseUtils.FULLWIDTH, spaceChar, midDot);
Defensive patterns
Strategy: validation
Validate before calling
Set<Integer> legalAscii = Set.of(ChineseUtils.LEAVE, ChineseUtils.ASCII, ChineseUtils.FULLWIDTH);
if (!legalAscii.contains(asciiMode)) throw new IllegalArgumentException("unknown ascii mode: " + asciiMode); Try / catch
try {
String norm = ChineseUtils.normalize(in, asciiMode, spaceChar, midDot);
} catch (IllegalArgumentException e) {
if (!e.getMessage().contains("ascii=")) throw e;
norm = ChineseUtils.normalize(in, ChineseUtils.LEAVE, spaceChar, midDot);
} Prevention
- Use ChineseUtils' named constants exclusively
- Avoid hardcoding mode ints copied from older scripts
- Re-check constants when upgrading the Stanford parser library
When it happens
Trigger: Calling ChineseUtils.normalize (or normalizeBMP directly) with an ascii value that is within [0, MAX_LEGAL] but not one of the recognized mode constants, so the switch falls through to default.
Common situations: Passing a raw integer that passes the range guard but maps to no case in the switch, or constants mixed from different library versions.
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
- ChineseUtils: Unknown parameter option
- ChineseUtils: Unsupported parameter option: midDot=
- We need at least 2 extractors for ExtractorMerger to make se
- Too many columns: <columnI>/<numColumns> (offset: <offset>)
- Too few columns: <columnI>/<numColumns> (offset: <offset>)
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/9aa13ede9dbf9ba0.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/trees/international/pennchinese/ChineseUtils.java:142
cub == Character.UnicodeBlock.SUPPLEMENTARY_PRIVATE_USE_AREA_B) {
EncodingPrintWriter.err.println("ChineseUtils.normalize warning: private use area codepoint U+" + Integer.toHexString(cp) + " in " + in);
}
boolean delete = false;
switch (ascii) {
case LEAVE:
break;
case ASCII:
if (cp >= '\uFF01' && cp <= '\uFF5E') {
cp -= (0xFF00 - 0x0020);
}
break;
case FULLWIDTH:
if (cp >= '\u0021' && cp <= '\u007E') {
cp += (0xFF00 - 0x0020);
}
break;
default:
throw new IllegalArgumentException("ChineseUtils: Unsupported parameter option: ascii=" + ascii);
}
switch (spaceChar) {
case LEAVE:
break;
case ASCII:
if (Character.isSpaceChar(cp)) {
cp = ' ';
}
break;
case FULLWIDTH:
if (Character.isSpaceChar(cp)) {
cp = '\u3000';
}
break;
case DELETE:
if (Character.isSpaceChar(cp)) {
delete = true;
}View on GitHub (pinned to 1b7edd19c4)