{"record":{"id":"3b037f3d99c2d0a2","repo":"stanfordnlp/CoreNLP","slug":"does-not-support-parse-operation","errorCode":null,"errorMessage":": Does not support parse operation.","messagePattern":": Does not support parse operation\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/arabic/parsesegment/JointParsingModel.java","lineNumber":374,"sourceCode":"    }\n\n    @Override\n    public boolean oPossible(Hook hook) {\n      final Hook latticeHook = (Hook) convertItemSpan(new Hook(hook));\n\n      return pparser.oPossible(latticeHook) && dparser.oPossible(hook);\n    }\n\n    @Override\n    public boolean iPossible(Hook hook) {\n      final Hook latticeHook = (Hook) convertItemSpan(new Hook(hook));\n\n      return pparser.iPossible(latticeHook) && dparser.iPossible(hook);\n    }\n\n    @Override\n    public boolean parse(List<? extends HasWord> words) {\n      throw new UnsupportedOperationException(this.getClass().getName() + \": Does not support parse operation.\");\n    }\n  }\n\n}\n","sourceCodeStart":356,"sourceCodeEnd":379,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/arabic/parsesegment/JointParsingModel.java#L356-L379","documentation":"The inner scorer/hook class in JointParsingModel declares parse(List<? extends HasWord>) only to throw UnsupportedOperationException: this class supports lattice-based decoding through its hooks, not direct sentence parsing. Calling parse on it is an API misuse signaled deliberately.","triggerScenarios":"Calling parse(words) on the GenericLatticeScorer-backed hook/inner parser object instead of using the lattice interface (iPossible/parse with a lattice hook), or polymorphic code that treats every parser-like object as directly parsable.","commonSituations":"Generic pipeline code that invokes parse() uniformly on parser adapters; refactors that swapped a full parser for the joint lattice model without updating call sites; examples that use plain LexicalizedParser-style calls against the joint model's inner scorer.","solutions":["Use the lattice-based API: build the lattice hook and call iPossible/lattice parse methods instead of parse(words).","If you need plain sentence parsing, use the underlying LexicalizedParser (lp) directly rather than this wrapper.","Check the object's concrete type before calling parse in polymorphic code.","Update any pipeline code copied from standard-parser examples to the joint parse-segment workflow."],"exampleFix":"// before\nhook.parse(sentence); // UnsupportedOperationException\n// after\n// use the lattice-aware path\nboolean ok = hook.iPossible(latticeHook);\n// or parse with the real parser\nboolean parsed = lp.parse(sentence);","handlingStrategy":"type-guard","validationCode":"// java: detect the unsupported parse path before calling\nboolean supportsDirectParse = !(hook instanceof JointParsingModel.GenericLatticeScorer);\nif (supportsDirectParse) hook.parse(words);","typeGuard":"// java\nif (hook.getClass().getName().endsWith(\"GenericLatticeScorer\")) {\n  // direct parse not supported; use lattice hooks instead\n  return;\n}","tryCatchPattern":"try {\n  hook.parse(words);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage() != null && e.getMessage().endsWith(\"Does not support parse operation.\")) {\n    lp.parse(words); // fall back to the underlying LexicalizedParser\n  } else throw e;\n}","preventionTips":["Use the lattice-based API for the joint parse-segment model, not parse(words).","Avoid calling parse() polymorphically on parser wrappers; check the concrete type or interface.","Keep standard-parser examples and joint-model call sites separate."],"tags":["java","nlp","arabic","parser","unsupported-operation"],"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"}