stanfordnlp/CoreNLP · error · RuntimeException
Please specify coref.algorithm.class
Error message
Please specify coref.algorithm.class
What it means
CorefAlgorithm.fromProps dispatches on coref.algorithm (clustering/statistical/neural/fastneural); this error fires when the property coref.algorithm.class is missing and no built-in algorithm type matches, so the factory cannot instantiate a coreference algorithm.
Solutions
- Set -coref.algorithm.class to a CorefAlgorithm implementation class name
- Or choose a built-in algorithm (statistical, neural, fastneural, clustering) via coref.algorithm
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/edu/stanford/nlp/coref/CorefAlgorithm.java:42 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/4eb13ae0f6604697.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/coref/CorefAlgorithm.java:42
static CorefAlgorithm fromProps(Properties props, Dictionaries dictionaries) {
CorefAlgorithmType algorithm = CorefProperties.algorithm(props);
if (algorithm == CorefAlgorithmType.CLUSTERING) {
return new ClusteringCorefAlgorithm(props, dictionaries);
} else if (algorithm == CorefAlgorithmType.STATISTICAL) {
return new StatisticalCorefAlgorithm(props, dictionaries);
} else if (algorithm == CorefAlgorithmType.NEURAL) {
return new NeuralCorefAlgorithm(props, dictionaries);
} else if (algorithm == CorefAlgorithmType.FASTNEURAL) {
return new FastNeuralCorefAlgorithm(props, dictionaries);
} else if (algorithm == CorefAlgorithmType.CUSTOM) {
String classname = PropertiesUtils.getString(props, "coref.algorithm.class", null);
try {
if (classname != null) {
Class clazz = Class.forName(classname);
return (CorefAlgorithm) clazz.getConstructor(Properties.class, Dictionaries.class).newInstance(props, dictionaries);
} else {
throw new RuntimeException("Please specify coref.algorithm.class");
}
} catch (Exception e) {
throw new RuntimeException("Error creating custom coref system", e);
}
} else {
try {
return new HybridCorefSystem(props, dictionaries);
} catch (Exception e) {
throw new RuntimeException("Error creating hybrid coref system", e);
}
}
}
}
View on GitHub (pinned to 1b7edd19c4)