Joshua
open source statistical hierarchical phrase-based machine translation system
|
Public Member Functions | |
Translations (TranslationRequest request) | |
void | finish () |
void | record (Translation translation) |
Translation | next () |
Private Attributes | |
TranslationRequest | request = null |
int | currentID = 0 |
LinkedList< Translation > | translations = null |
boolean | spent = false |
This class represents a streaming sequence of translations. It is returned by the main entry point to the Decoder object, the call to decodeAll. The translations here are parallel to the input sentences in the corresponding TranslationRequest object. Because of parallelization, the translated sentences might be computed out of order. Each Translation is sent to this Translations object by a DecoderThreadRunner via the record() function, which places the Translation in the right place. When the next translation in a sequence is available, next() is notified.
void joshua.decoder.Translations.finish | ( | ) |
This is called when null is received from the TranslationRequest, indicating that there are no more input sentences to translated. That in turn means that the request size will no longer grow. We then notify any waiting thread if the last ID we've processed is the last one, period.
Returns the next Translation, blocking if necessary until it's available, since the next Translation might not have been produced yet.
void joshua.decoder.Translations.record | ( | Translation | translation | ) |
This is called whenever a translation is completed by one of the decoder threads. There may be a current output thread waiting for the current translation, which is determined by checking if the ID of the translation is the same as the one being waited for (currentID). If so, the thread waiting for it is notified.
translation |
int joshua.decoder.Translations.currentID = 0 [private] |
TranslationRequest joshua.decoder.Translations.request = null [private] |
boolean joshua.decoder.Translations.spent = false [private] |
LinkedList<Translation> joshua.decoder.Translations.translations = null [private] |