Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/330.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
找到与主题对应的形容词-Python NLP_Python_Nlp - Fatal编程技术网

找到与主题对应的形容词-Python NLP

找到与主题对应的形容词-Python NLP,python,nlp,Python,Nlp,有没有一种有效的方法可以找到与主语相对应的形容词 def find_ADJ(NOUN, sentence): return (NOUN, ADJ) sentence = "I have a blue car that was a gift from my wife who is beautiful" INPUT: find_ADJ(car,sentence) OUTPUT: (car, blue) INPUT: find_ADJ(wife,sentenc

有没有一种有效的方法可以找到与主语相对应的形容词

def find_ADJ(NOUN, sentence):
    return (NOUN, ADJ)

sentence = "I have a blue car that was a gift from my wife who is beautiful"

INPUT: find_ADJ(car,sentence)
OUTPUT: (car, blue)
    
INPUT: find_ADJ(wife,sentence)
OUTPUT: (wife, beautiful)
*或者返回多个形容词

我试着用Spacy(pos_uu和dep_uu)做一些事情,但没有结果。有人知道我要找的图书馆或方法吗?
谢谢你

你可以试试corefrence解析库,比如斯坦福大学的corenlp或huggingface。我知道huggingface会显示相关单词

演示: