Struct Response

Struct Documentation

struct Response

Response holds AnnotatedText(s) of source-text and translated text, alignment information between source and target sub-words and sentences.

AnnotatedText provides an API to access markings of (sub)-word and sentences boundaries, which are required to interpret Quality and Alignment (s) at the moment.

Public Functions

const size_t size() const

Convenience function to obtain number of units translated.

Same as .source.numSentences() and .target.numSentences(). The processing of a text of into sentences are handled internally, and this information can be used to iterate through meaningful units of translation for which alignment and quality information are available.

const std::string &getOriginalText() const
const std::string &getTranslatedText() const

Public Members

AnnotatedText source

source text and annotations of (sub-)words and sentences.

AnnotatedText target

translated text and annotations of (sub-)words and sentences.

std::vector<Quality> qualityScores

-logprob of each word and negative log likelihood of sequence (sentence) normalized by length, for each sentence processed by the translator.

Indices correspond to ranges accessible through respective Annotation on source or target.

std::vector<Alignment> alignments

Alignments between source and target.

Each Alignment is a sparse matrix representation with indices corresponding to (sub-)words accessible through Annotation.