For the code example, we will use the pomegranate library to build an HMM for POS tagging. Pomegranate can be installed by running the following on the command line:
pip install pomegranate
In this example, we will not go into the details of the statistical POS tagger. The data we are using is a copy of the Brown corpus. The Brown corpus contains 500 samples of English-language text, totaling roughly 1,000,000 words, compiled from works published in the United States in 1961.