Reputation: 51
I was getting the following error while i was trying to read a txt file in spacy.
TypeError: Argument 'string' has incorrect type (expected unicode, got str)
Here is the code below
from __future__ import unicode_literals
import spacy
nlp= spacy.load('en')
doc_file = nlp(open("example.txt").read())
Upvotes: 5
Views: 4886
Reputation: 528
you should use nlp= spacy.blank('en') instead of spacy.load('en').
nlp= spacy.blank('en')
doc_file = nlp(open("example.txt").read())
Upvotes: 1