snownlp-master 库手动下载地址 https://codeload.github.com/isnowfy/snownlp/zip/refs/heads/master
pip install https://codeload.github.com/isnowfy/snownlp/zip/refs/heads/master
from snownlp import SnowNLP
sentence = "我爱你!"
s = SnowNLP(sentence)
# 2.词性标注
txt = list(map(list, s.tags))
for i in txt:
print(i[0])
print(i[1])
# n/名词 np/人名 ns/地名 ni/机构名 nz/其它专名
# m/数词 q/量词 mq/数量词 t/时间词 f/方位词 s/处所词
# v/动词 a/形容词 d/副词 h/前接成分 k/后接成分 i/习语
# j/简称 r/代词 c/连词 p/介词 u/助词 y/语气助词
# e/叹词 o/拟声词 g/语素 w/标点 x/其它