public static void main(String[] args) throws Exception {

        Path commonTokensDir = Paths.get(args[0]);
        Path tableFileDir = Paths.get(args[1]);
        Map<String, List<Path>> langFiles = LeipzigHelper.getFiles(tableFileDir);

        for (Map.Entry<String, List<Path>> e : langFiles.entrySet()) {

            String[] cmd = new String[e
                    .getValue()
                    .size() + 1];
            Path commonTokensFile = commonTokensDir.resolve(e.getKey());
            cmd[0] = ProcessUtils.escapeCommandLine(commonTokensFile
                    .toAbsolutePath()
                    .toString());
            for (int i = 0; i < e
                    .getValue()
                    .size(); i++) {
                cmd[i + 1] = ProcessUtils.escapeCommandLine(e
                        .getValue()
                        .get(i)
                        .toAbsolutePath()
                        .toString());
            }
            TopCommonTokenCounter.main(cmd);
        }
    }
Utility class that runs TopCommonTokenCounter against a directory
of table files (named {lang}_table.gz or leipzip-like afr_...-sentences.txt)
and outputs common tokens files for each input table file in the output directory.
tika-eval/tika-eval-app/src/main/java/org/apache/tika/eval/app/tools/BatchTopCommonTokenCounter.java