first, tokenize the words word_tokenize (string) then use pos_tag from nltk.
import nltk from nltk import* string="Have a seat in that chair." words=nltk.word_tokenize(string) nltk.pos_tag(words)
This has not been tested, but I think it can almost look like this.
source share