{"record":{"id":"8b9ac92040362fb9","repo":"stanfordnlp/CoreNLP","slug":"bad-wordshapeclassifier","errorCode":null,"errorMessage":"Bad WordShapeClassifier","messagePattern":"Bad WordShapeClassifier","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/process/WordShapeClassifier.java","lineNumber":194,"sourceCode":"        return wordShapeJenny1(inStr, knownLCWords);\n      case WORDSHAPECHRIS2:\n        return wordShapeChris2(inStr, false, knownLCWords);\n      case WORDSHAPECHRIS2USELC:\n        return wordShapeChris2(inStr, false, knownLCWords);\n      case WORDSHAPECHRIS3:\n        return wordShapeChris2(inStr, true, knownLCWords);\n      case WORDSHAPECHRIS3USELC:\n        return wordShapeChris2(inStr, true, knownLCWords);\n      case WORDSHAPECHRIS4:\n        return wordShapeChris4(inStr, false, knownLCWords);\n      case WORDSHAPEDIGITS:\n        return wordShapeDigits(inStr);\n      case WORDSHAPECHINESE:\n        return wordShapeChinese(inStr);\n      case WORDSHAPECLUSTER1:\n        return wordShapeCluster1(inStr);\n      default:\n        throw new IllegalStateException(\"Bad WordShapeClassifier\");\n    }\n  }\n\n  /**\n   * A fairly basic 5-way classifier, that notes digits, and upper\n   * and lower case, mixed, and non-alphanumeric.\n   *\n   * @param s String to find word shape of\n   * @return Its word shape: a 5 way classification\n   */\n  private static String wordShapeDan1(String s) {\n    boolean digit = true;\n    boolean upper = true;\n    boolean lower = true;\n    boolean mixed = true;\n    for (int i = 0; i < s.length(); i++) {\n      char c = s.charAt(i);\n      if (!Character.isDigit(c)) {","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/process/WordShapeClassifier.java#L176-L212","documentation":"WordShapeClassifier.wordShape switches on the named shaper; if the shape classifier name does not map to any known scheme (DIGITS, CHINESE, CLUSTER1, etc.), the default branch throws IllegalStateException. It indicates an unknown/unsupported word-shaping scheme name was passed.","triggerScenarios":"Calling wordShape(str, shapeName) with a name not registered in the classifier lookup, e.g. a typo or a shaper name from a different model/props file (like a feature config specifying wordShape=foo).","commonSituations":"Typo in the wordShape property of an NER/CRF classifier config; using a shaper name valid in a newer/older Stanford CoreNLP version; passing a raw option string without normalization.","solutions":["Check the spelling of the shape classifier name against WordShapeClassifier's documented constants (e.g. \"chinese\", \"cluster1\", \"digits\")","Remove or correct the wordShape entry in your properties file","Use a known default like \"dutch\"/\"chinese\" only as documented; otherwise omit wordShape","Upgrade CoreNLP if the shaper name is from a newer version"],"exampleFix":"// before\nprops.setProperty(\"wordShape\", \"brad\");\n// after\nprops.setProperty(\"wordShape\", \"chinese\");","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"chinese\",\"cluster1\",\"digits\");\nif (!valid.contains(shapeName)) throw new IllegalArgumentException(\"unknown wordShape: \" + shapeName);","typeGuard":null,"tryCatchPattern":"try {\n  shape = WordShapeClassifier.wordShape(word, shapeName);\n} catch (IllegalStateException e) {\n  shape = WordShapeClassifier.wordShape(word, \"chinese\");\n}","preventionTips":["Copy shaper names only from documented WordShapeClassifier constants","Lowercase the shape option before use","Pin CoreNLP version so property files match supported names"],"tags":["java","illegal-state","wordshape","config"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}