class ConfidenceMapLoader {

  private static final Logger logger = LoggerFactory.getLogger(ConfidenceMapLoader.class);

  Map<ConfidenceKey,Float> load(File filePattern) throws IOException {<FILL_FUNCTION_BODY>}

}

    if (!filePattern.toString().contains("{lang}")) {
      throw new RuntimeException("The 'ruleIdToConfidenceFile' parameter must contain '{lang}' as a placeholder for the language code");
    }
    Map<ConfidenceKey,Float> confMap = new HashMap<>();
    for (Language lang : Languages.get()) {
      int loadCount = 0;
      String fileName = filePattern.getAbsolutePath().replace("{lang}", lang.getShortCode());
      if (!Paths.get(fileName).toFile().exists()) {
        continue;
      }
      List<String> lines = Files.readAllLines(Paths.get(fileName), UTF_8);
      for (String line : lines) {
        if (line.startsWith("#")) {
          continue;
        }
        String[] parts = line.split(",");
        if (parts.length >= 2) {   // there might be more columns for better debugging, but we don't use them here
          try {
            float confidence = Float.parseFloat(parts[1]);
            confMap.put(new ConfidenceKey(lang, parts[0]), confidence);
            loadCount++;
          } catch (NumberFormatException e) {
            throw new RuntimeException("Invalid confidence float value in " + fileName + ", expected 'RULE_ID,float_value[,...]': " + line);
          }
        } else {
          throw new RuntimeException("Invalid line in " + fileName + ", expected 'RULE_ID,float_value[,...]': " + line);
        }
      }
      logger.info("Loaded " + loadCount + " mappings for " + lang + " from confidence map for rules from " + fileName);
    }
    if (confMap.size() == 0) {
      throw new RuntimeException("No confidence values could be loaded for " + filePattern +
        " -- please check there are actually files that match this pattern");
    }
    return confMap;
  
<no_super_class>