mbrs.decoders.mbr module#
- class mbrs.decoders.mbr.DecoderMBR(cfg: ~mbrs.decoders.base.DecoderBase.Config, metric: ~mbrs.metrics.base.MetricBase, selector: ~mbrs.selectors.base.Selector = <mbrs.selectors.nbest.SelectorNbest object>)[source]#
Bases:
DecoderReferenceBasedNaive MBR decoder class.
Time complexity: O(N^2)
Space complexity: O(N^2)
References
S. Kumar and W. Byrne, 2004, “Minimum Bayes-Risk Decoding for Statistical Machine Translation”. https://aclanthology.org/N04-1022
B. Eikema and W. Aziz, 2020, “Is MAP Decoding All You Need? The Inadequacy of the Mode in Neural Machine Translation”. https://aclanthology.org/2020.coling-main.398
- decode(hypotheses: list[str], references: list[str], source: str | None = None, nbest: int = 1, reference_lprobs: Tensor | None = None) Output[source]#
Select the n-best hypotheses based on the strategy.
- Parameters:
- Returns:
The n-best hypotheses.
- Return type:
DecoderMBR.Output