我目前正在尝试理解这种形式的句子:
The problem was more with the set-top box than the television. Restarting the set-top box solved the problem.
我是自然语言处理的新手,并开始使用Python的NLTK包来弄脏我的手.但是,我想知道是否有人能够概述实现这一目标所涉及的高级步骤.
我要做的是在这种情况下确定问题是什么,set-top box以及在这种情况下所采取的操作是否解决了问题,yes因为重新启动修复了问题.因此,如果所有句子都是这种形式,我的生活会更容易,但因为它是自然语言,句子也可以是以下形式:
I took a look at the car and found nothing wrong with it. However, I suspect there is something wrong with the engine
所以在这种情况下,问题在于car.由于存在这个词,所采取的行动并没有解决问题suspect.潜在的问题可能在于engine.
我不是在寻找一个绝对的答案,因为我怀疑这是非常复杂的.我正在寻找的更多是一个高级概述,它将指引我朝着正确的方向发展.如果有一种更容易/替代的方法来做到这一点,那也是受欢迎的.
我只是在用 Python 对 NLP 进行一些研究,我发现了一些奇怪的东西。
关于以下负面推文的审查:
neg_tweets = [('I do not like this car', 'negative'),
('This view is horrible', 'negative'),
('I feel tired this morning', 'negative'),
('I am not looking forward to the concert', 'negative'),<---
('He is my enemy', 'negative')]
Run Code Online (Sandbox Code Playgroud)
并通过删除停用词进行一些处理。
clean_data = []
stop_words = set(stopwords.words("english"))
for (words, sentiment) in pos_tweets + neg_tweets:
words_filtered = [e.lower() for e in words.split() if e not in stop_words]
clean_data.append((words_filtered, sentiment))
Run Code Online (Sandbox Code Playgroud)
部分输出是:
(['i', 'looking', 'forward', 'concert'], 'negative')
Run Code Online (Sandbox Code Playgroud)
我正在努力理解为什么停用词包括“不”,这会影响推文的情绪。
我的理解是停用词在情感方面没有价值。
所以,我的问题是为什么“不”包含在停用词列表中?