NAME

Treex::Tool::Parser::MSTperl::ModelBase

VERSION

version 0.11306

DESCRIPTION

This is a base class for an in-memory represenation of a parsing or labelling model.

FIELDS

config

Instance of Treex::Tool::Parser::MSTperl::Config containing settings to be used for the model.

featuresControl

Provides access to features, especially enabling their computation. Intance of Treex::Tool::Parser::MSTperl::FeaturesControl.

METHODS

Loading and storing

$model->load('modelfile.model');

Loads model from file in Data::Dumper format, eg.:

$VAR1 = {
    '0:být|VB' => '0.0042',
    '1:pes|N1' => '0.0021',
    ...
};

The feature codes are represented by their indexes (see "simple_feature_codes" in Treex::Tool::Parser::MSTperl::FeaturesControl).

$model->load_tsv('modelfile.tsv');

Loads model from file in TSV (tab separated values) format, eg.:

L|T:být|VB [tab] 0.0042
l|t:pes|N1 [tab] 0.0021
...

The feature codes are written as text.

$model->store('modelfile.model');

Stores model into file in Data::Dumper format.

$model->store_tsv('modelfile.tsv');

Stores model into file in TSV format:

Method stubs to be overridden in extending packages.

$data = get_data_to_store(), $data = get_data_to_store_tsv()

Returns the data that form the model to be saved to a model file.

load_data($data), load_data_tsv($data)

Fills the model with model data acquired from a model file.

Training support

Method stubs to be overridden in extending packages.

prepare_for_mira

Called after preprocessing training data, before entering the MIRA phase.

get_feature_count

Only to provide information about the model. Returns number of features in the model (where a "feature" can stand for various things depending on the algorithm used).

AUTHORS

Rudolf Rosa <rosa@ufal.mff.cuni.cz>

Zdeněk Žabokrtský <zabokrtsky@ufal.mff.cuni.cz>

COPYRIGHT AND LICENSE

Copyright © 2011 by Institute of Formal and Applied Linguistics, Charles University in Prague

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.