|
ModErn Text Analysis
META Enumerates Textual Applications
|
A greedy averaged perceptron tagger. More...
#include <perceptron.h>
Classes | |
| struct | training_options |
| Training options required for learning a tagger. More... | |
Public Member Functions | |
| perceptron () | |
| Default constructor. | |
| perceptron (const std::string &prefix) | |
| Loads a perceptron tagger from a given prefix. More... | |
| void | tag (sequence &seq) const |
| Tags a sequence. More... | |
| void | train (std::vector< sequence > &sequences, const training_options &options) |
| Trains the tagger on a set of sequences using the given options. More... | |
| void | save (const std::string &prefix) const |
| Saves the model to the folder specified by prefix. More... | |
Private Attributes | |
| sequence_analyzer | analyzer_ |
| The analyzer used for feature generation. | |
| classify::linear_model< feature_id, double, label_id > | model_ |
| The model storage. | |
A greedy averaged perceptron tagger.
| meta::sequence::perceptron::perceptron | ( | const std::string & | prefix | ) |
Loads a perceptron tagger from a given prefix.
| prefix | The folder that contains the tagger model |
| void meta::sequence::perceptron::tag | ( | sequence & | seq | ) | const |
Tags a sequence.
This sets both the label and tag of the sequence's observations.
| seq | The sequence to be tagged |
| void meta::sequence::perceptron::train | ( | std::vector< sequence > & | sequences, |
| const training_options & | options | ||
| ) |
Trains the tagger on a set of sequences using the given options.
The sequences given for training will be analyzed by the tagger internally, so they do not need to be analyzed ahead of time.
| sequences | The training data |
| options | THe training options |
| void meta::sequence::perceptron::save | ( | const std::string & | prefix | ) | const |
Saves the model to the folder specified by prefix.
Both the tagger and its analyzer are serialized.
| prefix | The folder to save the model to |
1.8.9.1