private void processWithLocalMarian(String configPath, File sourceFile, File targetFile)
            throws IOException, InterruptedException {
        ProcessBuilder builder = new ProcessBuilder();
        String device = config.getProperty("translator.marian.device", "cpu");
        builder.command(buildMarianCommand(configPath, sourceFile, targetFile, device));
        builder.directory(new File(configPath).getParentFile());
        builder.redirectErrorStream(true);
        Process process = builder.start();

        try (BufferedReader stdOutReader = new BufferedReader(
                new InputStreamReader(process.getInputStream(), Charset.defaultCharset()))) {
            stdOutReader.lines().forEach(LOG::debug);
        }

        process.waitFor();
    }
Process the translation request using a local instance of Marian - i.e. either </i>marian-decoder</i>
or <i>marian</i> command line applications.

@param configPath the path of the configuaration to use.
@param sourceFile the file containing the source text to read from.
@param targetFile the file to write the translated text to.
@throws IOException          on any I/O error.
@throws InterruptedException on any process error.
tika-translate/src/main/java/org/apache/tika/language/translate/impl/MarianTranslator.java