Joshua
open source statistical hierarchical phrase-based machine translation system
|
Public Member Functions | |
TranslationRequest (InputStream in, JoshuaConfiguration joshuaConfiguration) | |
int | size () |
synchronized Sentence | next () |
void | shutdown () |
Private Attributes | |
final JoshuaConfiguration | joshuaConfiguration |
BufferedReader | reader = null |
int | sentenceNo = -1 |
Sentence | nextSentence = null |
boolean | isShutDown = false |
Static Private Attributes | |
static final Charset | FILE_ENCODING = Charset.forName("UTF-8") |
This class is an iterator over inputs, which are turned into Sentence objects.
joshua.decoder.io.TranslationRequest.TranslationRequest | ( | InputStream | in, |
JoshuaConfiguration | joshuaConfiguration | ||
) |
synchronized Sentence joshua.decoder.io.TranslationRequest.next | ( | ) |
When the client socket is interrupted, we need to shut things down. On the source side, the TranslationRequest could easily have buffered a lot of lines and so will keep discovering sentences to translate, but the output Translation objects will start throwing exceptions when trying to print to the closed socket. When that happens, we call this function() so that we can tell next() to stop returning translations, which in turn will cause it to stop asking for them.
Note that we don't go to the trouble of shutting down existing DecoderThreads. This would be good to do, but for the moment would require more bookkeeping than we want to do.
final Charset joshua.decoder.io.TranslationRequest.FILE_ENCODING = Charset.forName("UTF-8") [static, private] |
boolean joshua.decoder.io.TranslationRequest.isShutDown = false [private] |
Sentence joshua.decoder.io.TranslationRequest.nextSentence = null [private] |
BufferedReader joshua.decoder.io.TranslationRequest.reader = null [private] |
int joshua.decoder.io.TranslationRequest.sentenceNo = -1 [private] |