NAME

Treex::Tool::Parser::MSTperl::ModelUnlabelled

VERSION

version 0.11306

DESCRIPTION

This is an in-memory represenation of a parsing model, extended from Treex::Tool::Parser::MSTperl::ModelBase.

The model is represented by features and their weights.

FIELDS

Feature weights

weights

A hash reference containing weights of all features. This is the actual model.

METHODS

Access to feature weights

my $edge_score = $model->score_edge($edge);

Counts the score of an edge by summing up weights of all of its features.

my $sentence_score = $model->score_sentence($sentence)

Returns score of the sentence (by calling score_features on the sentence features).

my $score = $model->score_features(['0:být|VB', '1:pes|N1', ...]);

Counts the score of an edge or sentence by summing up weights of all of its features, which are passed as an array reference.

my $feature_weight = $model->get_feature_weight('1:pes|N1');

Returns the weight of a given feature, or 0 if the feature is not contained in the model.

$model->set_feature_weight('1:pes|N1', 0.0021);

Sets a new weight for a given feature.

$model->update_feature_weight('1:pes|N1', 0.0042);

Adds the update value to current feature weight - eg. if the weight of the feature '1:pes|N1' is currently 0.0021, it will be 0.0063 after the call. The update can also be negative - then the weight of the feature decreases.

AUTHORS

Rudolf Rosa <rosa@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.