def evaluate(self, ref, hyp, desc=None): try: from xnmt.cython import xnmt_cython except: logger.error("BLEU evaluate fast requires xnmt cython installation step." "please check the documentation.") raise return xnmt_cython.bleu_sentence(self.ngram, self.smooth, ref, hyp)
def evaluate_fast(self, ref, hyp): try: from xnmt.cython import xnmt_cython except: print("BLEU evaluate fast requires xnmt cython installation step.", "please check the documentation.") raise return xnmt_cython.bleu_sentence(self.ngram, self.smooth, ref, hyp)
def evaluate_one_sent(self, ref, hyp): try: from xnmt.cython import xnmt_cython except: logger.error("BLEU evaluate fast requires xnmt cython installation step." "please check the documentation.") raise if len(ref) == 0 or len(hyp) == 0: return 0 return xnmt_cython.bleu_sentence(self.ngram, self.smooth, ref, hyp)