| 1 | package Hailo::Role::Engine; | ||
| 2 | 23 | our $AUTHORITY = 'cpan:AVAR'; | |
| 3 | 23 | $Hailo::Role::Engine::VERSION = '0.73'; | |
| 4 | 23 | ▶ | use v5.28.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 23 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 23 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 23 | has storage => ( | |
| 9 | required => 1, | ||
| 10 | is => 'ro', | ||
| 11 | documentation => "Our copy of the current Storage object", | ||
| 12 | ); | ||
| 13 | |||
| 14 | 23 | has order => ( | |
| 15 | required => 1, | ||
| 16 | isa => 'Int', | ||
| 17 | is => 'rw', | ||
| 18 | documentation => "Our copy of the current markov order", | ||
| 19 | ); | ||
| 20 | |||
| 21 | 23 | requires 'learn'; | |
| 22 | 23 | requires 'reply'; | |
| 23 | |||
| 24 | 23 | 1; | |
| 25 | |||
| 26 | =encoding utf8 | ||
| 27 | |||
| 28 | =head1 NAME | ||
| 29 | |||
| 30 | Hailo::Role::Engine - A role representing a L<Hailo|Hailo> engine backend | ||
| 31 | |||
| 32 | =head1 ATTRIBUTES | ||
| 33 | |||
| 34 | A C<Hailo::Engine::*> gets the following attributes by using this role: | ||
| 35 | |||
| 36 | =head2 C<storage> | ||
| 37 | |||
| 38 | A L<storage|Hailo::Role::Storage> object the engine should use to get data from. | ||
| 39 | |||
| 40 | =head2 C<order> | ||
| 41 | |||
| 42 | The current Markov order used by the storage object. | ||
| 43 | |||
| 44 | =head1 METHODS | ||
| 45 | |||
| 46 | =head2 C<new> | ||
| 47 | |||
| 48 | This is the constructor. It accept the attributes specified in | ||
| 49 | L</ATTRIBUTES>. | ||
| 50 | |||
| 51 | =head2 C<learn> | ||
| 52 | |||
| 53 | Learn from the given input and add it to storage. | ||
| 54 | |||
| 55 | =head2 C<reply> | ||
| 56 | |||
| 57 | Reply to the given input using the storad data. | ||
| 58 | |||
| 59 | =head1 AUTHOR | ||
| 60 | |||
| 61 | E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org> | ||
| 62 | |||
| 63 | =head1 LICENSE AND COPYRIGHT | ||
| 64 | |||
| 65 | Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason. | ||
| 66 | |||
| 67 | This program is free software, you can redistribute it and/or modify | ||
| 68 | it under the same terms as Perl itself. | ||
| 69 | |||
| 70 | =cut | ||