class documentation

class _Stack(object): (source)

Constructor: _Stack(max_size, beam_threshold)

View In Hierarchy

Collection of _Hypothesis objects

Method __bool__ Undocumented
Method __contains__ Undocumented
Method __init__ No summary
Method __iter__ Undocumented
Method best No summary
Method push Add hypothesis to the stack. Removes lowest scoring hypothesis if the stack is full. After insertion, hypotheses that score less than beam_threshold times the score of the best hypothesis are removed.
Method threshold_prune Undocumented
Instance Variable items Undocumented
Instance Variable max_size Undocumented
Instance Variable __log_beam_threshold Undocumented
def __bool__(self): (source)

Undocumented

def __contains__(self, hypothesis): (source)

Undocumented

def __init__(self, max_size=100, beam_threshold=0.0): (source)
Parameters
max_sizeUndocumented
beam_threshold:floatHypotheses that score less than this factor of the best hypothesis are discarded from the stack. Value must be between 0.0 and 1.0.
def __iter__(self): (source)

Undocumented

def best(self): (source)
Returns
_HypothesisHypothesis with the highest score in the stack
def push(self, hypothesis): (source)

Add hypothesis to the stack. Removes lowest scoring hypothesis if the stack is full. After insertion, hypotheses that score less than beam_threshold times the score of the best hypothesis are removed.

def threshold_prune(self): (source)

Undocumented

items: list = (source)

Undocumented

max_size = (source)

Undocumented

__log_beam_threshold = (source)

Undocumented