我目前有熊猫数据框的文本数据。我想使用Spacy库做词性标签。但是我不知道如何从熊猫导入负载数据到Spacy。
有人知道如何将数据从熊猫数据框加载到Spacy吗?谢谢!
这是我的数据集:
df = pd.concat([jsons_data,label],axis=1)
text title authors label
0 On Saturday, September 17 at 8:30 pm EST, an e... Another Terrorist Attack in NYC…Why Are we STI... [View All Posts, Leonora Cravotta] Real
1 Story highlights "This, though, is certain: to... Hillary Clinton on police shootings: 'too many... [Mj Lee, Cnn National Politics Reporter] Real
2 Critical Counties is a CNN series exploring 11... Critical counties: Wake County, NC, could put ... [Joyce Tseng, Eli Watkins] Real
3 McCain Criticized Trump for Arpaio’s Pardon… S... NFL Superstar Unleashes 4 Word Bombshell on Re... [] Real
4 Story highlights Obams reaffirms US commitment... Obama in NYC: 'We all have a role to play' in ... [Kevin Liptak, Cnn White House Producer] Real
5 Obama weighs in on the debate\n\nPresident Bar... Obama weighs in on the debate [Brianna Ehley, Jack Shafer]
这是我的代码,用于将数据加载到Spacy:
import spacy
from dframcy import DframCy
nlp = spacy.load('en_core_web_sm')
dframcy = DframCy(nlp)
doc = dframcy.nlp(df)
annotation_dataframe = dframcy.to_dataframe(doc)
TypeError: Argument 'string' has incorrect type (expected str, got DataFrame)