Class JoshuaNetworkTranslator

  • All Implemented Interfaces:
    Translator

    public class JoshuaNetworkTranslator
    extends AbstractTranslator

    This translator is designed to work with a TCP-IP available Joshua translation server, specifically the REST-based Joshua server.

    If you were to interact with the server via curl a request would look as follows

     {code
     curl http://localhost:5000/joshua/translate/english \
       -i -H "Content-Type: application/json" \
       -X POST -d '{"inputLanguage": "Spanish", "inputText": "vuelo"}' -v
     }
     
    Joshua requires input to be pre-formatted into sentences, one per line, so this translation implementation takes care of that.
    • Constructor Detail

      • JoshuaNetworkTranslator

        public JoshuaNetworkTranslator()
        Default constructor which first checks for the presence of the translator.joshua.properties file. We check if the remote server is available on each translation process. This check is not a remote call, but instead a check for null value within of a local variable represetning the value for joshua.server.url, which should be populated within the translator.joshua.properties file.