This is a tool meant for tagging words with their part-of-speech, a grammatical category based on their function within a sentence, such as noun, adjective, verb, and so forth.
You can also see Cython, Java, C++, C, Swift, Js, or C# repository.
To check if you have a compatible version of Python installed, use the following command:
python -V
You can find the latest version of Python here.
Install the latest version of Git.
pip3 install NlpToolkit-PosTagger
In order to work on code, create a fork from GitHub page. Use Git for cloning the code to your local or below line for Ubuntu:
git clone <your-fork-git-link>
A directory called EnglishPosTagger will be created. Or you can use below link for exploring the code:
git clone https://github.com/starlangsoftware/EnglishPosTagger-Py.git
Steps for opening the cloned project:
- Start IDE
- Select File | Open from main menu
- Choose
EnglishPosTagger-Py
file - Select open as project option
- Couple of seconds, dependencies will be downloaded.
To train the PosTagger which is used for English pos tagging
train(self, corpus: PosTaggedCorpus)
To save the trained PosTagger model
saveModel(self)
To load an already trained PosTagger model
loadModel(self)
To tag a sentence, using a newly trained or loaded PosTagger model
posTag(self, sentence: Sentence) -> Sentence
3 different PosTagger models are supported: The one that is used to tag the sentences with a random tag
DummyPosTagger
the one that tags the word with the most used tag for a given word
NaivePosTagger
the one that does an Hmm based training and tags the words accordingly
HmmPosTagger