mbrs.decoders.aggregate_mbr module#
- class mbrs.decoders.aggregate_mbr.DecoderAggregateMBR(cfg: ~mbrs.decoders.base.DecoderBase.Config, metric: ~mbrs.metrics.base.MetricBase, selector: ~mbrs.selectors.base.Selector = <mbrs.selectors.nbest.SelectorNbest object>)[source]#
Bases:
DecoderMBRMBR decoding with reference aggregation.
Time complexity: O(N)
Space complexity: O(N)
References
J. DeNero et al., 2009, “Fast Consensus Decoding over Translation Forests”. https://aclanthology.org/P09-1064/
J. Vamvas and R. Sennrich, 2024, “Linear-time Minimum Bayes Risk Decoding with Reference Aggregation”. https://arxiv.org/abs/2402.04251
- 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:
DecoderAggregateMBR.Output