Class MarianTranslator.MarianServerClient

  • Enclosing class:
    MarianTranslator

    public static class MarianTranslator.MarianServerClient
    extends Object
    Internal Client for marian-server Web Socket Server.
    • Constructor Detail

      • MarianServerClient

        public MarianServerClient​(URI endpointURI,
                                  File file)
                           throws TikaException
        Marian Server Web Socket Client.
        Parameters:
        endpointURI - the endpoint URI for the Marian Server instance.
        file - the location of the file to write the translation response to.
        Throws:
        TikaException
    • Method Detail

      • onOpen

        public void onOpen​(jakarta.websocket.Session session)
      • onClose

        public void onClose​(jakarta.websocket.Session session)
      • translate

        public void translate​(String sourceText)
                       throws IOException
        Translate the passed text using the Marian Server.
        Parameters:
        sourceText - the source text to translate.
        Throws:
        IOException - on any I/O error calling the server.
      • close

        public void close()
                   throws IOException
        Close the connection to the Marian Server.
        Throws:
        IOException - on any I/O error calling the server.