【发布时间】:2019-03-24 18:19:11
【问题描述】:
到目前为止,我在下面有这段代码
from textblob import TextBlob
class BrinBot:
def __init__(self, message): #Accepts the message from the user as the argument
parse(message)
class parse:
def __init__(self, message):
self.message = message
blob = TextBlob(self.message)
print(blob.tags)
BrinBot("Handsome Bob's dog is a beautiful Chihuahua")
这是输出:
[('Handsome', 'NNP'), ('Bob', 'NNP'), ("'s", 'POS'), ('dog', 'NN'), ('is', 'VBZ'), ('a', 'DT'), ('beautiful', 'JJ'), ('Chihuahua', 'NNP')]
我的问题是 TextBlob 显然认为“Handsome”是一个单数专有名词,这是不正确的,因为“Handsome”应该是一个形容词。有没有办法解决这个问题,我也在 NLTK 上尝试过,但得到了相同的结果。
【问题讨论】:
标签: python python-3.x nlp nltk textblob