Skip to content Skip to sidebar Skip to footer

Applying Spacy's Entityrecognizer To A Column Within A Pandas Dataframe

I have a text based dataset where I am looking to apply SpaCy's EntityRecognizer to each row for a specific column. I can apply the general spaCy pipeline by doing something like t

Solution 1:

In Spacy a doc have a attribute .ents witch return a generator on its named entities.

So you can use :

df['new_col'] = df['col'].apply(lambda x: list(nlp(x).ents))

Post a Comment for "Applying Spacy's Entityrecognizer To A Column Within A Pandas Dataframe"