def posTrigramsScore(trigrams,category,pos_tags_trigrams,labels):
#keep pos tags bigrams of specific category
trigrams_category = subList(pos_tags_trigrams,labels,category)
#initialize dictionary
d = {}
#calculate score for every bigram
for trigram in trigrams:
d[trigram] = score(trigram,category,trigrams_category,pos_tags_trigrams)
return d
#calculate bigram's f1 score
评论列表
文章目录