onmt.Translator

[src]

onmt.Translator:translate(src, gold)

Translate a batch of source sequences.

Parameters:

  • src - a batch of tables containing:
    • words: the table of source words
    • features: the table of feaures sequences (src.features[i][j] is the value of the ith feature of the jth token)
  • gold - gold data to compute confidence score (same format as src)

Returns:

  • results - a batch of tables containing:
    • goldScore: if gold was given, this is the confidence score
    • preds: an array of opt.n_best tables containing:
    • words: the table of target words
    • features: the table of target features sequences
    • attention: the attention vectors of each target word over the source words
    • score: the confidence score of the prediction

Undocumented methods

* onmt.Translator.declareOpts(cmd) * onmt.Translator(args) * onmt.Translator:buildInput(tokens) * onmt.Translator:buildOutput(data) * onmt.Translator:buildData(src, gold) * onmt.Translator:buildTargetWords(pred, src, attn) * onmt.Translator:buildTargetFeatures(predFeats) * onmt.Translator:translateBatch(batch)