Parts Of Speech Tagging are for the grammar of any language.
We already know all the English words.
You can do this by using NLTK (Natural Language Tool Kit).
Install NLTK
pip install nltk
Here is a simple POS Tagging code you can play around →
import nltk
from nltk.tokenize import word_tokenize
from nltk import pos_tag
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
sentence = "The quick brown fox jumps over the lazy dog."
tokens = word_tokenize(sentence)
tagged_tokens = pos_tag(tokens)
print(tagged_tokens)
Following will be the output →
[('The', 'DT'), ('quick', 'JJ'), ('brown', 'JJ'), ('fox', 'NN'),
('jumps', 'VBZ'), ('over', 'IN'), ('the', 'DT'), ('lazy', 'JJ'),
('dog', 'NN')]