NAME
Hailo::Role::Storage - A role representing a Hailo storage backend
ATTRIBUTES
order
The Markov order (chain length) being used.
brain
The name of the resource (file name, database name) to use as storage.
METHODS
new
This is the constructor. It accept the attributes specified in "ATTRIBUTES".
save
Saves the current state.
add_expr
Adds a new expression. Takes the follwing arguments:
'tokens', an array reference of the tokens that make up the expression. The number of elements should be equal to the value returned by order|/order
.
'next_token', the token that succeeds this expression, if any.
'next_token', the token that precedes this expression, if any.
random_expr
Takes a single token as an argument and returns a randomly picked expression which contains it.
token_exists
Takes a single token as an argument and returns a true value if the token exists.
next_tokens
Takes an array reference of tokens arguments that make up an expression and returns a hash reference of tokens that may succeed it. The value is the number of times the token has been seen succeeding the expression.
prev_tokens
Takes an array reference of tokens arguments that make up an expression and returns a hash reference of tokens that may precede it. The value is the number of times the token has been seen preceding the expression.
start_learning
Takes no arguments. This method is called by Hailo|Hailo
right before learning begins.
stop_learning
Takes no arguments. This method is called by Hailo|Hailo
right after learning finishes.
start_training
Takes no arguments. This method is called by Hailo|Hailo
right before training begins.
stop_training
Takes no arguments. This method is called by Hailo|Hailo
right after training finishes.
AUTHOR
Hinrik Örn Sigurðsson, hinrik.sig@gmail.com
LICENSE AND COPYRIGHT
Copyright 2010 Hinrik Örn Sigurðsson
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.