{"record":{"id":"267716c7a3a6a4ed","repo":"stanfordnlp/CoreNLP","slug":"not-yet-implemented-267716","errorCode":null,"errorMessage":"Not yet implemented","messagePattern":"Not yet implemented","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/sentiment/SentimentModel.java","lineNumber":303,"sourceCode":"      this.numHid = op.numHid;\n    } else {\n      int size = 0;\n      for (SimpleMatrix vector : wordVectors.values()) {\n        size = vector.getNumElements();\n        break;\n      }\n      this.numHid = size;\n    }\n\n    TwoDimensionalSet<String, String> binaryProductions = TwoDimensionalSet.hashSet();\n    if (op.simplifiedModel) {\n      binaryProductions.add(\"\", \"\");\n    } else {\n      // TODO\n      // figure out what binary productions we have in these trees\n      // Note: the current sentiment training data does not actually\n      // have any constituent labels\n      throw new UnsupportedOperationException(\"Not yet implemented\");\n    }\n\n    Set<String> unaryProductions = Generics.newHashSet();\n    if (op.simplifiedModel) {\n      unaryProductions.add(\"\");\n    } else {\n      // TODO\n      // figure out what unary productions we have in these trees (preterminals only, after the collapsing)\n      throw new UnsupportedOperationException(\"Not yet implemented\");\n    }\n\n    this.numClasses = op.numClasses;\n\n    identity = SimpleMatrix.identity(numHid);\n\n    binaryTransform = TwoDimensionalMap.treeMap();\n    binaryTensors = TwoDimensionalMap.treeMap();\n    binaryClassification = TwoDimensionalMap.treeMap();","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/sentiment/SentimentModel.java#L285-L321","documentation":"The SentimentModel constructor derives binary grammar productions from the options. When op.simplifiedModel is false, the constructor is supposed to scan the training trees for actual constituent labels, but that logic was never implemented, so it throws UnsupportedOperationException.","triggerScenarios":"Constructing a SentimentModel (via new SentimentModel(op, trainingTrees) or similar) with RNNOptions.simplifiedModel set to false.","commonSituations":"Running sentiment training on custom data with non-simplified options, expecting constituent-label support that the sentiment model never implemented; adapting the model to constituency-labelled trees.","solutions":["Set op.simplifiedModel = true so the constructor uses the single \"\" binary production","Implement the missing logic yourself (extract binary productions from the trees) if non-simplified mode is required"],"exampleFix":"// before\nRNNOptions op = new RNNOptions();\nop.simplifiedModel = false;\nSentimentModel model = new SentimentModel(op, trainingTrees); // throws\n// after\nRNNOptions op = new RNNOptions();\nop.simplifiedModel = true;\nSentimentModel model = new SentimentModel(op, trainingTrees);","handlingStrategy":"validation","validationCode":"if (!op.simplifiedModel) {\n  throw new IllegalStateException(\"SentimentModel constructor only supports simplifiedModel=true\");\n}\nSentimentModel model = new SentimentModel(op, trainingTrees);","typeGuard":null,"tryCatchPattern":"try {\n  model = new SentimentModel(op, trainingTrees);\n} catch (UnsupportedOperationException e) {\n  op.simplifiedModel = true;\n  model = new SentimentModel(op, trainingTrees);\n}","preventionTips":["Keep op.simplifiedModel = true for sentiment models","Read the TODO comments in SentimentModel before enabling non-simplified modes","Treat non-simplified sentiment options as unsupported; enforce in your config loader"],"tags":["java","stanford-nlp","sentiment","unimplemented"],"backgroundTag":"method-not-implemented","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}