Book Image

Haskell Data Analysis Cookbook

By : Nishant Shukla
Book Image

Haskell Data Analysis Cookbook

By: Nishant Shukla

Overview of this book

Table of Contents (19 chapters)
Haskell Data Analysis Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 using the -beam flag

    • Change the number of iterations using the -iter flag

    • Use hashing instead of a feature dictionary using the -hash flag

    • Provide a path to the held out data using the -heldout flag

    • An example of the sequor command in use is as...