{"record":{"id":"61e77bcb64fab6a3","repo":"languagetool-org/languagetool","slug":"file-with-example-sentences-not-found-61e77b","errorCode":null,"errorMessage":"File with example sentences not found: ","messagePattern":"File with example sentences not found: ","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"languagetool-dev/src/main/java/org/languagetool/dev/bigdata/ProhibitedCompoundRuleEvaluator.java","lineNumber":204,"sourceCode":"        //System.out.printf(ENGLISH, \"Recall:       %.3f (%d false negatives)\\n\", recall, evalValues.falseNegatives);\n        //double fMeasure = FMeasure.getWeightedFMeasure(precision, recall);\n        //System.out.printf(ENGLISH, \"F-measure:    %.3f (beta=0.5)\\n\", fMeasure);\n        //System.out.printf(ENGLISH, \"Good Matches: %d (true positives)\\n\", evalValues.truePositives);\n        //System.out.printf(ENGLISH, \"All matches:  %d\\n\", evalValues.truePositives + evalValues.falsePositives);\n        System.out.printf(summary + \"\\n\");\n      }\n    }\n    return results;\n  }\n\n  // TODO deduplicate / delegate\n  private List<Map.Entry<Sentence, Map.Entry<Integer, Integer>>> getRelevantSentences(List<String> inputs, String token, int maxSentences) throws IOException {\n    List<Map.Entry<Sentence, Map.Entry<Integer, Integer>>> sentences = new ArrayList<>();\n    for (String input : inputs) {\n      if (new File(input).isDirectory()) {\n        File file = new File(input, token + \".txt\");\n        if (!file.exists()) {\n          throw new RuntimeException(\"File with example sentences not found: \" + file);\n        }\n        try (FileInputStream fis = new FileInputStream(file)) {\n          SentenceSource sentenceSource = new PlainTextSentenceSource(fis, language);\n          sentences = getSentencesFromSource(inputs, token, maxSentences, sentenceSource);\n        }\n      } else {\n        SentenceSource sentenceSource = MixingSentenceSource.create(inputs, language);\n        sentences = getSentencesFromSource(inputs, token, maxSentences, sentenceSource);\n      }\n    }\n    return sentences;\n  }\n\n  private List<Map.Entry<Sentence, Map.Entry<Integer, Integer>>> getSentencesFromSource(List<String> inputs, String token, int maxSentences, SentenceSource sentenceSource) {\n    List<Map.Entry<Sentence, Map.Entry<Integer, Integer>>> sentences = new ArrayList<>();\n    Pattern pattern = Pattern.compile(\"(?iu)\\\\b(\" + token.toLowerCase() + \")\\\\p{Alpha}+\\\\b|\\\\b\\\\p{Alpha}+(\" + token.toLowerCase() + \")\\\\b\");\n    while (sentenceSource.hasNext()) {\n      Sentence sentence = sentenceSource.next();","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-dev/src/main/java/org/languagetool/dev/bigdata/ProhibitedCompoundRuleEvaluator.java#L186-L222","documentation":"ProhibitedCompoundRuleEvaluator.getRelevantSentences requires a per-token corpus file <token>.txt inside each input directory; if absent it throws this RuntimeException. Same pattern as ConfusionRuleEvaluator: the tool cannot collect example sentences for the compound word without its file.","triggerScenarios":"Running the evaluator with input directories missing a <token>.txt for one of the compound-word tokens; filename case mismatch; corpus generated for a different word list.","commonSituations":"Partial corpus generation; compound tokens with characters altered by filename sanitization; wrong input directory passed for the language.","solutions":["Generate/place the missing <token>.txt file in the input directory","Verify token names match filenames exactly (case-sensitive)","Confirm the correct input directories were passed on the command line","Catch and skip tokens without files if partial runs are acceptable"],"exampleFix":"// before\njava ProhibitedCompoundRuleEvaluator de-DE /data/compounds pairs.txt\n// /data/compounds/Haustuer/Haustuer.txt missing\n// after\n./generate_sentences.sh Haustür > /data/compounds/Haustuer/Haustuer.txt","handlingStrategy":"validation","validationCode":"for (String token : tokens) {\n  for (String input : inputs) {\n    if (new File(input).isDirectory() && !new File(input, token + \".txt\").exists()) {\n      throw new IllegalStateException(\"Missing corpus file for \" + token + \" in \" + input);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-generate <token>.txt files for the full compound word list","Add a dry-run mode that lists missing corpus files before evaluation","Keep filenames derived programmatically from tokens to avoid mismatches"],"tags":["file-not-found","corpus","dev-tooling"],"backgroundTag":"file-not-found","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}