class documentation
class _Hypothesis(object): (source)
Constructor: _Hypothesis(raw_score, src_phrase_span, trg_phrase, previous, future_score)
Partial solution to a translation.
Records the word positions of the phrase being translated, its translation, raw score, and the cost of the untranslated parts of the sentence. When the next phrase is selected to build upon the partial solution, a new _Hypothesis object is created, with a back pointer to the previous hypothesis.
To find out which words have been translated so far, look at the src_phrase_span in the hypothesis chain. Similarly, the translation output can be found by traversing up the chain.
Method | __init__ |
No summary |
Method | score |
Overall score of hypothesis after accounting for local and global features |
Method | total |
Undocumented |
Method | translated |
List of positions in the source sentence of words already translated. The list is not sorted. |
Method | translation |
Undocumented |
Method | untranslated |
Starting from each untranslated word, find the longest continuous span of untranslated positions |
Instance Variable | future |
Undocumented |
Instance Variable | previous |
Undocumented |
Instance Variable | raw |
Undocumented |
Instance Variable | src |
Undocumented |
Instance Variable | trg |
Undocumented |
Method | __build |
Undocumented |
def __init__(self, raw_score=0.0, src_phrase_span=(), trg_phrase=(), previous=None, future_score=0.0):
(source)
¶
Parameters | |
raw | Likelihood of hypothesis so far. Higher is better. Does not account for untranslated words. |
src | Span of word positions covered by the source phrase in this hypothesis expansion. For example, (2, 5) means that the phrase is from the second word up to, but not including the fifth word in the source sentence. |
trg | Translation of the source phrase in this hypothesis expansion |
previous:_Hypothesis | Previous hypothesis before expansion to this one |
future | Approximate score for translating the remaining words not covered by this hypothesis. Higher means that the remaining words are easier to translate. |
List of positions in the source sentence of words already translated. The list is not sorted.
Returns | |
list(int) | Undocumented |