标签: python nlp nltk n-gram perplexity
我训练bgram,trigram:
bgram = bigrams(sentences) trigram = trigrams(sentences)
并要计算困惑度:
p = bgram.perplexity
但是出现错误:
AttributeError:“发电机”对象没有属性“困惑”
应该如何计算困惑?