| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Hailo::Role::Engine; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:AVAR'; |
|
3
|
|
|
|
|
|
|
$Hailo::Role::Engine::VERSION = '0.75'; |
|
4
|
23
|
|
|
23
|
|
18785
|
use v5.10.0; |
|
|
23
|
|
|
|
|
93
|
|
|
5
|
23
|
|
|
23
|
|
145
|
use Moose::Role; |
|
|
23
|
|
|
|
|
50
|
|
|
|
23
|
|
|
|
|
283
|
|
|
6
|
23
|
|
|
23
|
|
82141
|
use MooseX::Types::Moose ':all'; |
|
|
23
|
|
|
|
|
56
|
|
|
|
23
|
|
|
|
|
220
|
|
|
7
|
23
|
|
|
23
|
|
197854
|
use namespace::clean -except => 'meta'; |
|
|
23
|
|
|
|
|
58
|
|
|
|
23
|
|
|
|
|
250
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has storage => ( |
|
10
|
|
|
|
|
|
|
required => 1, |
|
11
|
|
|
|
|
|
|
is => 'ro', |
|
12
|
|
|
|
|
|
|
documentation => "Our copy of the current Storage object", |
|
13
|
|
|
|
|
|
|
); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
has order => ( |
|
16
|
|
|
|
|
|
|
required => 1, |
|
17
|
|
|
|
|
|
|
isa => Int, |
|
18
|
|
|
|
|
|
|
is => 'rw', |
|
19
|
|
|
|
|
|
|
documentation => "Our copy of the current markov order", |
|
20
|
|
|
|
|
|
|
); |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
requires 'learn'; |
|
23
|
|
|
|
|
|
|
requires 'reply'; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
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 |