class WordCoherencyDataLoader {

  public Map<String, Set<String>> loadWords(String path) {<FILL_FUNCTION_BODY>}

}

    InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path);
    Map<String, Set<String>> map = new Object2ObjectOpenHashMap<>();
    try (
      InputStreamReader reader = new InputStreamReader(stream, StandardCharsets.UTF_8);
      BufferedReader br = new BufferedReader(reader)
    ) {
      String line;
      while ((line = br.readLine()) != null) {
        if (line.isEmpty() || line.charAt(0) == '#') {   // ignore comments
          continue;
        }
        String[] parts = line.split(";");
        if (parts.length != 2) {
          throw new IOException("Format error in file " + path + ", line: " + line);
        }
        if(map.containsKey(parts[0])) {
          map.get(parts[0]).add(parts[1]);
        } else {
          map.put(parts[0], Stream.of(parts[1]).collect(Collectors.toCollection(ObjectOpenHashSet::new)));
        }
        if(map.containsKey(parts[1])) {
          map.get(parts[1]).add(parts[0]);
        } else {
          map.put(parts[1], Stream.of(parts[0]).collect(Collectors.toCollection(ObjectOpenHashSet::new)));
        }
      }
    } catch (IOException e) {
      throw new RuntimeException("Could not load coherency data from " + path, e);
    }
    return Collections.unmodifiableMap(map);
  
<no_super_class>