text.py 文件源码

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

项目:robocup-soccer 作者: kengz 项目源码 文件源码
def score(self, ciphertext, code):
        """Score is product of word scores, unigram scores, and bigram scores.
        This can get very small, so we use logs and exp."""
        text = decode(ciphertext, code)
        logP = (sum([log(self.Pwords[word]) for word in words(text)]) +
                sum([log(self.P1[c]) for c in text]) +
                sum([log(self.P2[b]) for b in bigrams(text)]))
        return exp(logP)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号