acceptability.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:trf 作者: aistairc 项目源码 文件源码
def _calc_unigram_scores(self) -> List[float]:

        unigram_scores = []
        for ts in self.tss:
            unigram_score = 0.0

            for t in ts:
                n = float(self.n_total_words)
                x = float(self.word_freq.get(t, self.word_freq['<unk/>']))
                unigram_score += math.log(x / n)

            unigram_scores.append(unigram_score)

        return unigram_scores
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号