{"record":{"id":"cf3f375953c7d455","repo":"stanfordnlp/CoreNLP","slug":"invalid-morphology-string","errorCode":null,"errorMessage":"Invalid morphology string: ","messagePattern":"Invalid morphology string: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/morph/MorphoFeatureSpecification.java","lineNumber":63,"sourceCode":"    activeFeatures.add(feat);\n  }\n  \n  public boolean isActive(MorphoFeatureType feat) { return activeFeatures.contains(feat); }\n  \n  public abstract List<String> getValues(MorphoFeatureType feat);\n  \n  public abstract MorphoFeatures strToFeatures(String spec);\n  \n  /**\n   * Returns the lemma as pair.first() and the morph analysis as pair.second().\n   */\n  public static Pair<String,String> splitMorphString(String word, String morphStr) {\n    if (morphStr == null || morphStr.trim().equals(\"\")) {\n      return new Pair<>(word, NO_ANALYSIS);\n    }\n    String[] toks = morphStr.split(Pattern.quote(LEMMA_MARK));\n    if (toks.length != 2) {\n      throw new RuntimeException(\"Invalid morphology string: \" + morphStr);\n    }\n    return new Pair<>(toks[0], toks[1]);\n  }\n  \n  \n  @Override\n  public String toString() { return activeFeatures.toString(); }\n}\n","sourceCodeStart":45,"sourceCodeEnd":72,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/morph/MorphoFeatureSpecification.java#L45-L72","documentation":"MorphoFeatureSpecification.splitMorphString expects a morphological string of the form 'lemma^featureString' (split on the LEMMA_MARK separator '^'). It throws a RuntimeException when the string is non-empty but does not split into exactly two parts, i.e. the separator is missing or appears more than once.","triggerScenarios":"Calling splitMorphString (directly or via addMorphologicalFeatures processing) with a morph string lacking the '^' separator, containing multiple '^', or being whitespace-with-content other than expected.","commonSituations":"Misformatted morphological analysis files where lemma and features are separated by a different character; hand-edited entries; preprocessed files that stripped the '^' character.","solutions":["Ensure each morph string uses the '^' separator exactly once: 'lemma^features'","Fix malformed entries in the morpho input file","Pre-validate lines before calling splitMorphString","Check which LEMMA_MARK constant the loaded specification uses and match it in your data"],"exampleFix":"// before\nsplitMorphString(word, \"courir VER:pres\");\n// after\nsplitMorphString(word, \"courir^VER:pres\");","handlingStrategy":"validation","validationCode":"if (morphStr != null && !morphStr.trim().isEmpty() && morphStr.split(\"\\\\^\").length != 2) throw new IllegalArgumentException(\"Expected 'lemma^features': \" + morphStr);","typeGuard":"boolean isValidMorphString(String s) { return s == null || s.trim().isEmpty() || s.split(\"\\\\^\").length == 2; }","tryCatchPattern":"try { pair = MorphoFeatureSpecification.splitMorphString(word, morphStr); } catch (RuntimeException e) { log.warn(\"Bad morph string, using NO_ANALYSIS: \" + morphStr); pair = new Pair<>(word, MorphoFeatureSpecification.NO_ANALYSIS); }","preventionTips":["Always emit morph entries as 'lemma^features' with exactly one '^'","Pre-validate morpho files during corpus preparation","Fall back to NO_ANALYSIS for recoverable malformed entries"],"tags":["morphology","format","parsing"],"backgroundTag":"invalid-argument-format","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"}