opennmt.utils.BeamSearch

class opennmt.utils.BeamSearch(beam_size, length_penalty=0, coverage_penalty=0)[source]

A beam search strategy.

Inherits from: opennmt.utils.DecodingStrategy

__init__(beam_size, length_penalty=0, coverage_penalty=0)[source]

Initializes the decoding strategy.

Parameters
property num_hypotheses

The number of hypotheses returned by this strategy.