{"record":{"id":"fcdb6518c2d2c812","repo":"stanfordnlp/CoreNLP","slug":"invalid-contraction-provided-to-processcontraction-fcdb65","errorCode":null,"errorMessage":"Invalid contraction provided to processContraction","messagePattern":"Invalid contraction provided to processContraction","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/spanish/process/SpanishTokenizer.java","lineNumber":181,"sourceCode":"        else second = \"EL\";\n        secondOffset = 1;\n        secondLength = lowered.length() - 1;\n        break;\n      case \"conmigo\":\n      case \"consigo\":\n        first = word.substring(0, 3);\n        second = word.charAt(3) + \"í\";\n        secondOffset = 3;\n        secondLength = 4;\n        break;\n      case \"contigo\":\n        first = word.substring(0, 3);\n        second = word.substring(3, 5);\n        secondOffset = 3;\n        secondLength = 4;\n        break;\n      default:\n        throw new IllegalArgumentException(\"Invalid contraction provided to processContraction\");\n    }\n\n    int secondStart = cl.beginPosition() + secondOffset;\n    int secondEnd = secondStart + secondLength;\n    compoundBuffer.add(copyCoreLabel(cl, second, secondStart, secondEnd));\n    return copyCoreLabel(cl, first, cl.beginPosition(), secondStart);\n  }\n\n  /**\n   * Handles verbs with attached suffixes, marked by the lexer:\n   *\n   * Escribamosela =&gt; Escribamo + se + la =&gt; escribamos + se + la\n   * Sentaos =&gt; senta + os =&gt; sentad + os\n   * Damelo =&gt; da + me + lo\n   *\n   */\n  private CoreLabel processVerb(CoreLabel cl) {\n    cl.remove(ParentAnnotation.class);","sourceCodeStart":163,"sourceCodeEnd":199,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/spanish/process/SpanishTokenizer.java#L163-L199","documentation":"SpanishTokenizer.processContraction splits known Spanish contractions (e.g. 'del', 'al', compound forms with'+word) into two tokens. The switch on the contraction's word length/shape has no case matching the input, so the method throws this IllegalArgumentException. It indicates the token routed to contraction splitting is not one of the recognized contraction forms.","triggerScenarios":"getNext identifies a word as a contraction candidate and calls processContraction, but the word does not match any expected contraction pattern in the switch (default branch). Typically caused by an unexpected surface form that passed an earlier heuristic, or by feeding text where SpanishTokenizer-specific contraction rules do not apply to the token shape.","commonSituations":"Processing text containing apostrophe/clitic sequences that resemble contractions but are not among the handled forms; running with spanishTokenization options that enable contraction splitting on edge-case inputs; version mismatches where the caller's candidate list and processContraction's cases diverge.","solutions":["Inspect the offending word in the input text and confirm it is a valid Spanish contraction handled by the tokenizer.","Adjust tokenization options (e.g. disable splitVerbs/contraction splitting) if the text legitimately contains forms the splitter does not handle.","Pre-normalize the input (strip stray apostrophes/quotes) so the contraction matcher only sees genuine contractions.","Upgrade or patch CoreNLP so the contraction candidate check in getNext matches the cases in processContraction."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  CoreLabel tok = tokenizer.next();\n  buffer.add(tok);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"processContraction\")) {\n    log.warn(\"Skipping token that failed contraction splitting\");\n  } else throw e;\n}","preventionTips":["Pre-normalize apostrophes and quotes in Spanish text before tokenizing.","Test the tokenizer on your corpus sample before large batch runs to catch odd contraction forms.","Pin the CoreNLP version and re-run corpus smoke tests after upgrades, since contraction rules can change."],"tags":["tokenizer","spanish","contraction"],"backgroundTag":"invalid-argument-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}