You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tika.apache.org by Tyler Palsulich <tp...@gmail.com> on 2014/08/08 19:38:57 UTC

Re: Review Request 24506: Create an ExternalTranslator and a MosesTranslator

-----------------------------------------------------------
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


Re: Review Request 24506: Create an ExternalTranslator and a MosesTranslator

Posted by Chris Mattmann <ma...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24506/#review50050
-----------------------------------------------------------

Ship it!


Ship It!

- Chris Mattmann


On Aug. 8, 2014, 5:40 p.m., Tyler Palsulich wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/24506/
> -----------------------------------------------------------
> 
> (Updated Aug. 8, 2014, 5:40 p.m.)
> 
> 
> Review request for tika and Chris Mattmann.
> 
> 
> Bugs: TIKA-1385
>     https://issues.apache.org/jira/browse/TIKA-1385
> 
> 
> 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
> 
>


Re: Review Request 24506: Create an ExternalTranslator and a MosesTranslator

Posted by Tyler Palsulich <tp...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/24506/
-----------------------------------------------------------

(Updated Aug. 8, 2014, 5:40 p.m.)


Review request for tika and Chris Mattmann.


Bugs: TIKA-1385
    https://issues.apache.org/jira/browse/TIKA-1385


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