blib/lib/Hailo/Role/Storage.pm

filter: Statementstmt 100% 26 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 32 / 32 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Hailo/Role/Engine.pm ↑ Summary blib/lib/Hailo/Role/UI.pm »
1 package Hailo::Role::Storage;
2 30 our $AUTHORITY = 'cpan:AVAR';
3 30 $Hailo::Role::Storage::VERSION = '0.74';
4 30 ▶use v5.28.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 30 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 30 ▶use MooseX::Types::Moose ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 30 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 30 has brain => (
10 isa => Str,
11 is => 'rw',
12 );
13  
14 30 has order => (
15 isa => Int,
16 is => 'rw',
17 );
18  
19 30 has hailo => (
20 isa => HashRef,
21 is => 'ro',
22 documentation => "Miscellaneous private callbacks that Hailo provides to communicate with it",
23 );
24  
25 30 has tokenizer_class => (
26 isa => Str,
27 is => 'rw',
28 );
29  
30 30 requires 'ready';
31 30 requires 'initialized';
32 30 requires 'save';
33 30 requires 'start_learning';
34 30 requires 'stop_learning';
35 30 requires 'start_training';
36 30 requires 'stop_training';
37  
38 sub save {
39 # does nothing by default
40 5 ▶ return;
Subroutine save: called CC=1 SCAR=0.0
Pod documented
41 }
42  
43 30 1;
44  
45 =encoding utf8
46  
47 =head1 NAME
48  
49 Hailo::Role::Storage - A role representing a L<Hailo|Hailo> storage backend
50  
51 =head1 ATTRIBUTES
52  
53 =head2 C<ready>
54  
55 Ask the storage backend if it considers itself ready to go. E.g. a
56 storage that requires a C<brain> would return false if it wasn't
57 passed one.
58  
59 =head2 C<initialized>
60  
61 If you're connecting to an existing storage that already has a
62 populated schema and is ready to go this'll return true.
63  
64 =head2 C<order>
65  
66 The Markov order (chain length) being used.
67  
68 =head2 C<brain>
69  
70 The name of the resource (file name, database name) to use as storage.
71  
72 =head1 METHODS
73  
74 =head2 C<new>
75  
76 This is the constructor. It accept the attributes specified in
77 L</ATTRIBUTES>.
78  
79 =head2 C<save>
80  
81 Saves the current state.
82  
83 =head2 C<learn_tokens>
84  
85 Learns from a sequence of tokens. Takes an array reference of strings.
86  
87 =head2 C<make_reply>
88  
89 Takes an (optional) array reference of tokens and returns a reply (arrayref
90 of tokens) that might be relevant.
91  
92 =head2 C<token_total>
93  
94 Takes no arguments. Returns the number of tokens the brain knows.
95  
96 =head2 C<expr_total>
97  
98 Takes no arguments. Returns the number of expressions the brain knows.
99  
100 =head2 C<start_learning>
101  
102 Takes no arguments. This method is called by L<Hailo|Hailo> right before learning
103 begins.
104  
105 =head2 C<stop_learning>
106  
107 Takes no arguments. This method is called by L<Hailo|Hailo> right after learning
108 finishes.
109  
110 =head2 C<start_training>
111  
112 Takes no arguments. This method is called by L<Hailo|Hailo> right before training
113 begins.
114  
115 =head2 C<stop_training>
116  
117 Takes no arguments. This method is called by L<Hailo|Hailo> right after training
118 finishes.
119  
120 =head1 AUTHOR
121  
122 Hinrik E<Ouml>rn SigurE<eth>sson, hinrik.sig@gmail.com
123  
124 =head1 LICENSE AND COPYRIGHT
125  
126 Copyright 2010 Hinrik E<Ouml>rn SigurE<eth>sson
127  
128 This program is free software, you can redistribute it and/or modify
129 it under the same terms as Perl itself.
130  
131 =cut
« blib/lib/Hailo/Role/Engine.pm ↑ Summary blib/lib/Hailo/Role/UI.pm »