Training a parts-of-speech tagger
We will use a Haskell library, sequor, to train our own parts of speech tagger. Then we can use this newly trained model on our own input.
Getting ready
Please refer to the Getting ready section of the previous recipe.
How to do it…
In a new file, which we name Main.hs
, enter the following source code:
Use the
sequor
executable to train the parts of speech tagger:The first argument to
sequor
will betrain
, to indicate that we are about to train a taggerThe next argument is the template-file,
data/all.features
Then we provide the train-file,
data/train.conll
The last file path we need to provide is the location of where to save the trained model
We can specify a learning rate using the
-rate
flagThe beam size can be modified using the
-beam
flagChange the number of iterations using the
-iter
flagUse hashing instead of a feature dictionary using the
-hash
flagProvide a path to the held out data using the
-heldout
flagAn example of the sequor command in use is as...