From what I understand so far, it is an instance of the 'Language' class in spacy, and can process text and perform a bunch of operations on it.
import spacy
nlp = spacy.blank("en")
# Process the text
doc = nlp(
"In 1990, more than 60% of people in East Asia were in extreme poverty. "
"Now less than 4% are."
)
print(doc[0])
//prints "In"
The question that bothers me is that how does an object accept an argument(a string in this case) like a class does? What is the process?
I tried the following code to check if an object can receive an argument..
class ABC:
def __init__(self,a=1):
self.a = a
def printa(self):
print(self.a)
abc = ABC()
abc(2)
abc.printa()
It gives me an error:
TypeError: 'ABC' object is not callable
spacy seems to be doing the same thing and it works..How?