求解Python如何统计文本中各词性的数量

求解Python如何统计文本中各词性的数量求解 如图 标注完词性之后要统计各不同词性的数量该怎么办………

import re
File=open('文本.txt',encoding='utf-8')
#读取全部内容
s=File.readlines()
#转化成字符串
s=str(s)
#统计'NN'的数量
NN=len(re.findall(r"'NN'",s))
print(NN)
温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-12-22
可以尝试用 pandas 模块处理。
第2个回答  2017-12-22
from collections import Counter
help(Counter)

相似回答