我正在对给定的文档进行情绪分析。我的目标是找出与我的句子中的目标短语最接近或周围的形容词。我确实知道如何提取与目标短语相关的周围单词。但是我如何找到相对于目标短语相对接近或最接近的形容词或NNP或VBN或其他词性标签?
这是关于我如何获得与目标短语相关的周围单词的草图想法。
sentence_List = {
"Obviously one of the most important features of any computer is the human interface.",
"Good for everyday computing and web browsing.",
"My problem was with DELL Customer Service",
"I play a lot of casual games online[comma] and the touchpad is very responsive"
}
target_phraseList = {
"human interface",
"everyday computing",
"DELL Customer Service",
"touchpad"
}
请注意,我的原始数据集是作为 DataFrame 给出的,其中给出了句子列表和相应的目标短语。这里我只是模拟数据如下:
import pandas as pd
df=pd.Series(sentence_List, target_phraseList)
df=pd.DataFrame(df)
在这里,我将句子标记如下:
from nltk.tokenize import word_tokenize
tokenized_sents = [word_tokenize(i) for i in sentence_List]
tokenized=[i for i in tokenized_sents]
然后我尝试通过使用这里的战利品来找出与我的目标短语相关的周围单词。但是,我想找出相对更接近或最接近adjective的,或verbs相VBN对于我的目标短语。
我怎样才能做到这一点?有什么想法可以完成吗?谢谢