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:

  1. Use the sequor executable to train the parts of speech tagger:
    • The first argument to sequor will be train, to indicate that we are about to train a tagger
    • The 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 flag
    • The beam size can be modified ...

Get Haskell Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.