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