code: public static void validateDirectory(File topIndexDir) {
      if (!topIndexDir.exists() || !topIndexDir.isDirectory()) {
        throw new RuntimeException("Not found or is not a directory:\n" +
                topIndexDir + "\n" +
                "As ngram directory, please select the directory that has a subdirectory like 'en'\n" +
                "(or whatever language code you're using).");
      }
      List<String> dirs = new ArrayList<>();
      for (String name : topIndexDir.list()) {
        if (name.matches("[123]grams")) {
          dirs.add(name);
        }
      }
      if (dirs.isEmpty()) {
        throw new RuntimeException("Directory must contain at least '1grams', '2grams', and '3grams': " + topIndexDir.getAbsolutePath());
      }
      if (dirs.size() < 3) {
        throw new RuntimeException("Expected at least '1grams', '2grams', and '3grams' sub directories but only got " + dirs + " in " + topIndexDir.getAbsolutePath());
      }
    }
docs: Throw RuntimeException is the given directory does not seem to be a valid ngram top directory
  with sub directories {@code 1grams} etc.
  @since 3.0