stanfordnlp/CoreNLP · error · IllegalArgumentException

French does not support feature type:

Error message

French does not support feature type: 

What it means

FrenchMorphoFeatureSpecification.getValues returns the possible value set for a morphological feature. French morphology support covers only a subset of features (gender, number, person, tense, POS etc.); requesting values for an unsupported MorphoFeatureType throws IllegalArgumentException('French does not support feature type: ...').

Solutions

  1. Only request feature values for features the French spec supports (GEND, NUM, PER, TENSE, etc.)
  2. Check feature support before calling: iterate only over the spec's enabled features
  3. Use the language-appropriate MorphoFeatureSpecification subclass for the features you need
  4. Extend FrenchMorphoFeatureSpecification with value arrays if the feature must be supported

Example fix

// before
List<String> vals = spec.getValues(MorphoFeatureType.CASE); // throws for French
// after
MorphoFeatureType feat = MorphoFeatureType.CASE;
if (feat == MorphoFeatureType.GEND || feat == MorphoFeatureType.NUM || feat == MorphoFeatureType.PER || feat == MorphoFeatureType.TENSE) {
  List<String> vals = spec.getValues(feat);
}
Defensive patterns

Strategy: validation

Validate before calling

boolean frenchSupported = feat == MorphoFeatureType.GEND || feat == MorphoFeatureType.NUM
  || feat == MorphoFeatureType.PER || feat == MorphoFeatureType.TENSE;
if (!frenchSupported) throw new IllegalStateException("Feature not supported for French: " + feat);

Try / catch

try { spec.getValues(feat); } catch (IllegalArgumentException e) { /* fall back to language-specific spec */ }

Prevention

When it happens

Trigger: Calling getValues(feat) with a MorphoFeatureType that the French specification did not register (e.g. CASE or other features supported for other languages like German/Arabic but not French), typically during morphological analysis or tag-building of the French treebank pipeline.

Common situations: Reusing a MorphoFeatureSpecification config (morph feature selection) from another language for French; requesting the full universal feature inventory from the French spec.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/international/french/FrenchMorphoFeatureSpecification.java:45

  private static Redwood.RedwoodChannels log = Redwood.channels(FrenchMorphoFeatureSpecification.class);

  private static final long serialVersionUID = -58379347760106784L;

  public static final String[] genVals = {"M","F"};
  public static final String[] numVals = {"SG","PL"};
  public static final String[] perVals = {"1","2","3"};


  @Override
  public List<String> getValues(MorphoFeatureType feat) {
    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
      throw new IllegalArgumentException("French does not support feature type: " + feat.toString());
  }

  @Override
  public MorphoFeatures strToFeatures(String spec) {
    MorphoFeatures feats = new MorphoFeatures();

    //Usually this is the boundary symbol
    if(spec == null || spec.equals(""))
      return feats;

    boolean isOtherActive = isActive(MorphoFeatureType.OTHER);
    
    if(spec.startsWith("ADV")) {
      feats.setAltTag("ADV");
      if(spec.contains("int")) {
        if (isOtherActive) {
          feats.addFeature(MorphoFeatureType.OTHER, "advint");
        }

View on GitHub (pinned to 1b7edd19c4)