DEV Community

Cover image for spaCy and grammar go hand in hand!!! What do you think of it??
Adityaberi
Adityaberi

Posted on

spaCy and grammar go hand in hand!!! What do you think of it??

Wow I was studying spaCy and found out how brilliantly it understands the difference between read in two differnt tenses

doc = nlp(u'I read books on NLP.')
r = doc[1]

print(f'{r.text:{10}} {r.pos_:{8}} {r.tag_:{6}} {spacy.explain(r.tag_)}')

Output-read VERB VBP verb, non-3rd person singular present

doc = nlp(u'I read a book on NLP.')
r = doc[1]

print(f'{r.text:{10}} {r.pos_:{8}} {r.tag_:{6}} {spacy.explain(r.tag_)}')

Output-read VERB VBD verb, past tense

In the first example, with no other cues to work from, spaCy assumed that read was present tense.

In the second example the present tense form would be I am reading a book, so spaCy assigned the past tense.

Wow that is something incredible I guess!!

What is your story of spaCy and what brilliance did you experience do let me know????

Top comments (0)