stanfordnlp/CoreNLP · error · java.lang.RuntimeException

this.getClass().getName() + ": Case is presently…

Error message

this.getClass().getName() + ": Case is presently unsupported!"

What it means

ArabicMorphoFeatureSpecification.getValues throws this RuntimeException when asked for the values of MorphoFeatureType.CASE, because the Arabic morphological analyzer does not model case as a feature. The class defines value arrays for DEF, GEN, NUM, PER, VOICE, MOOD, and TENSE but deliberately leaves CASE unsupported rather than returning an empty list.

Solutions

  1. Do not request MorphoFeatureType.CASE when using the Arabic feature specification; filter it out of your feature loop.
  2. Guard with feat != MorphoFeatureType.CASE before calling getValues.
  3. If case analysis is required, use a language specification that supports it (e.g. the generic/English one) instead of the Arabic one.
  4. As a last resort, patch the class to return the (commented-out) caseVals list, accepting it is not linguistically grounded for Arabic.

Example fix

// before
for (MorphoFeatureType feat : MorphoFeatureType.values()) {
  List<String> vals = spec.getValues(feat);
  ...
}
// after
for (MorphoFeatureType feat : MorphoFeatureType.values()) {
  if (feat == MorphoFeatureType.CASE) continue;
  List<String> vals = spec.getValues(feat);
  ...
}
Defensive patterns

Strategy: type-guard

Validate before calling

// java: skip unsupported features before querying
static boolean isSupported(MorphoFeatureSpecification spec, MorphoFeatureType feat) {
  return !(spec instanceof ArabicMorphoFeatureSpecification) || feat != MorphoFeatureType.CASE;
}

Type guard

// java
if (feat == MorphoFeatureType.CASE && spec instanceof ArabicMorphoFeatureSpecification) {
  return Collections.emptyList(); // CASE unsupported for Arabic
}
List<String> vals = spec.getValues(feat);

Try / catch

try {
  vals = spec.getValues(feat);
} catch (RuntimeException e) {
  if (e.getMessage() != null && e.getMessage().endsWith("Case is presently unsupported!")) {
    vals = Collections.emptyList();
  } else throw e;
}

Prevention

When it happens

Trigger: Calling getValues(MorphoFeatureType.CASE) on an ArabicMorphoFeatureSpecification instance, typically when iterating all MorphoFeatureType values or running the morphological analyzer pipeline configured with Arabic features that includes CASE.

Common situations: Code written generically over languages (shared across English/Arabic pipelines) that requests every feature type including CASE; enabling case morphological analysis in Arabic tagging options where the Arabic specification cannot supply the value inventory.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/international/arabic/ArabicMorphoFeatureSpecification.java:54

  // Standard feature tuple (e.g., "3MS", "1P", etc.)
  private static final Pattern pFeatureTuple = Pattern.compile("(\\d\\p{Upper}\\p{Upper}?)");

  // Demonstrative pronouns do not have number
  private static final Pattern pDemPronounFeatures = Pattern.compile("DEM_PRON(.+)");

  //Verbal patterns
  private static final Pattern pVerbMood = Pattern.compile("MOOD|SUBJ");
  private static final Pattern pMood = Pattern.compile("_MOOD:([ISJ])");
  private static final Pattern pVerbTenseMarker = Pattern.compile("IV|PV|CV");
  private static final Pattern pNounNoMorph = Pattern.compile("PROP|QUANT");

  @Override
  public List<String> getValues(MorphoFeatureType feat) {
    if(feat == MorphoFeatureType.DEF)
      return Arrays.asList(defVals);
    else if(feat == MorphoFeatureType.CASE) {
      throw new RuntimeException(this.getClass().getName() + ": Case is presently unsupported!");
//      return Arrays.asList(caseVals);
    } else if(feat == MorphoFeatureType.GEN)
      return Arrays.asList(genVals);
    else if(feat == MorphoFeatureType.NUM)
      return Arrays.asList(numVals);
    else if(feat == MorphoFeatureType.PER)
      return Arrays.asList(perVals);
    else if(feat == MorphoFeatureType.POSS)
      return Arrays.asList(possVals);
    else if(feat == MorphoFeatureType.VOICE)
      return Arrays.asList(voiceVals);
    else if(feat == MorphoFeatureType.MOOD)
      return Arrays.asList(moodVals);
    else if(feat == MorphoFeatureType.TENSE)
      return Arrays.asList(tenseVals);
    else
      throw new IllegalArgumentException("Arabic does not support feature type: " + feat.toString());
  }

View on GitHub (pinned to 1b7edd19c4)