I am working on part-of-speech tagging. I am new to Spacy. I receive such an error.
AttributeError: 'spacy.tokens.doc.Doc' object has no attribute 'pos_'
I have checked that the data type is string, so the code should work. Where I am mistaken?
The full code is right above.
import pandas as pd
df = pd.read_excel('combined_file.xlsx', engine='openpyxl', index_col=None)
import spacy
df['body_string'] = df.body.astype('string')
sp = spacy.load('en_core_web_sm')
doc = df["body_string"].apply(sp)
for word in doc:
print(word.text, word.pos_, word.dep_)
The link to the excel file is here: https://www.dropbox.com/scl/fi/43nu0yf45obbyzprzc86n/combined_file.xlsx?dl=0&rlkey=7j959kz0urjxflf6r536brppt