(self, beam, logprobs)
return normalized_probs
Rescores a prediction based on penalty functions
Rescores a prediction based on penalty functions
Rescores a prediction based on penalty functions
def score(self, beam, logprobs):
        """
        Rescores a prediction based on penalty functions
        """
        normalized_probs = self.length_penalty(beam,
                                               logprobs,
                                               self.alpha)
        if not beam.stepwise_penalty:
            penalty = self.cov_penalty(beam,
                                       beam.global_state["coverage"],
                                       self.beta)
            normalized_probs -= penalty

        return normalized_probs
def score ( self , beam , logprobs ) : normalized_probs = self . length_penalty ( beam , logprobs , self . alpha ) if not beam . stepwise_penalty : penalty = self . cov_penalty ( beam , beam . global_state [ "coverage" ] , self . beta ) normalized_probs -= penalty return normalized_probs