----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: https://reviews.apache.org/r/24506/ -----------------------------------------------------------
(Updated Aug. 8, 2014, 5:38 p.m.) Review request for tika and Chris Mattmann. Repository: tika Description ------- This patch includes an ExternalTranslator, MosesTranslator, a Moses properties file, and a unit test. The ExternalTranslator is an abstract class which implements Translator. It provides a default implementation of the translate(String text, String targetLanguage) -- use the Tika LanguageIdentifier to figure out the source language. There is also a runAndGetOutput(String command, String[] env, File workingDirectory). This is not needed for the MosesTranslator, but it may be useful for others. The ExternalTranslator.checkCommand(String command, int... successCodes) may be used to check that the given command returns one of the specified return codes. The MosesTranslator writes the provided text to a temporary file, calls the Moses translator, retrieves the translated text from the newly created file, deletes the two files, and returns the text. I don't think this is a complete solution yet, so I am happy to refactor/change/iterate. :) All comments are welcome! Thanks, Tyler Diffs ----- trunk/tika-translate/src/main/java/org/apache/tika/language/translate/ExternalTranslator.java PRE-CREATION trunk/tika-translate/src/main/java/org/apache/tika/language/translate/MosesTranslator.java PRE-CREATION trunk/tika-translate/src/main/resources/org/apache/tika/language/translate/translator.moses.properties PRE-CREATION trunk/tika-translate/src/test/java/org/apache/tika/language/translate/MosesTranslatorTest.java PRE-CREATION Diff: https://reviews.apache.org/r/24506/diff/ Testing ------- Simple unit test to make sure translation works. Thanks, Tyler Palsulich
