bin/hailo

filter: Statementstmt 88.8% 32 / 36 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 83.0% 44 / 53 CC 1 SCAR 0.0
CC
1
Cov
84%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Hailo/Role/Tokenizer.pm ↑ Summary blib/lib/Hailo/Tokenizer/Chars.pm »
1 #!/usr/bin/env perl
2 package hailo;
3 9 our $AUTHORITY = 'cpan:AVAR';
4 9 $hailo::VERSION = '0.74';
5 9 ▶use v5.28.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use open qw< :encoding(utf8) :std >;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use Dir::Self;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Encode qw(decode);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use Hailo::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 # Nothing to see here
14 9 __PACKAGE__->meta->make_immutable;
15  
16 # use utf8 everywhere
17 9 $_ = decode('utf8', $_) for @ARGV;
18  
19 # Set programname
20 9 $0 = 'hailo';
21  
22 9 ▶if ($] < 5.013000 and $^O eq 'linux') {
Branch: 1 branch
BranchTrueFalseTotal
if ($] < "5.013" and $^O eq "linux") 0 9 9
Condition33%1/3
$] < "5.013" and $^O eq "linux"
!ll&&!rl&&r
900
MC/DC0%0/2
$] < "5.013" and $^O eq "linux"
$] < "5.013" $^O eq "linux"
Truth table33%1/3
A and B
A= $] < "5.013"B= $^O eq "linux"
ABresult
0X0
100
111
23 0 local $@;
24 0 eval {
25 0 require Sys::Prctl;
26 0 Sys::Prctl::prctl_name('hailo');
27 };
28 }
29  
30 # I want my mommy!
31 9 $Hailo::Command::HERE_MOMMY = __DIR__;
32  
33 # Show help if run without arguments
34 9 ▶@ARGV = qw(--help) unless @ARGV;
Branch: 1 branch
BranchTrueFalseTotal
unless @ARGV 1 8 9
35  
36 # Hailing frequencies open
37 9 Hailo::Command->new_with_options->run;
38  
39 =encoding utf8
40  
41 =head1 NAME
42  
43 hailo - Command-line interface to the L<Hailo|Hailo> Markov bot
44  
45 =head1 USAGE
46  
47 usage: hailo [-abEfhLlopRrSsTtuv] [long options...]
48 usage: hailo [-abEfhLlopRrSsTtuv] [long options...]
49 -v --version Print version and exit
50 -u --ui Use UI CLASS
51 -t --train Learn from all the lines in FILE, use - for STDIN
52 -s --stats Print statistics about the brain
53 -r --reply Reply to STRING
54 -p --progress Display progress during the import
55 -o --order Markov order; How deep the rabbit hole goes
56 -l --learn Learn from STRING
57 -h --help You're soaking it in
58 -f --train-fast Train with aggressive caching (memory-hungry!)
59 -b --brain Load/save brain to/from FILE
60 -a --autosave Save the brain on exit (on by default)
61 -T --tokenizer Use tokenizer CLASS
62 -S --storage Use storage CLASS
63 -R --random-reply Like --reply but takes no STRING; Babble at random
64 -L --learn-reply Learn from STRING and reply to it
65 -E --engine Use engine CLASS
66 --ui-args Arguments for the UI class
67 --tokenizer-args Arguments for the Tokenizer class
68 --storage-args Arguments for the Storage class
69 --examples Print examples along with the help message
70 --engine-args Arguments for the Engine class
71 --brain-resource Alias for `brain' for backwards compatibility
72  
73 Note: All input/output and files are assumed to be UTF-8 encoded.
74  
75 =head1 SYNOPSIS
76  
77 Train in-memory using L<bot-training|Bot::Training>'s F<megahal.trn>
78 and reply:
79  
80 bot-training -f megahal | hailo --brain :memory: --train - --random-reply
81 # ==> Time flies like a banana.
82  
83 Create an on-disk brain for later use:
84  
85 bot-training -f megahal > megahal.trn
86 hailo --brain hailo.sqlite --train megahal.trn
87 hailo --brain hailo.sqlite --reply 'Reply to this, silly robot!'
88 # ==> No way! I don't want to think.
89  
90 Interact with the brain using readline:
91  
92 hailo --brain hailo.sqlite
93 Welcome to the Hailo interactive shell!
94 Enter ".help" to show the built-in commands.
95 Input that's not a command will be passed to Hailo to learn, and it'll
96 reply back.
97 Hailo> Hello there
98 # ==> Wife asked "what have you got there?" replied he, "just my cup of fur".
99  
100 =head1 DESCRIPTION
101  
102 See the documentation for L<Hailo|Hailo> for more information.
103  
104 =head1 AUTHOR
105  
106 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org>
107  
108 =head1 LICENSE AND COPYRIGHT
109  
110 Copyright 2010 E<AElig>var ArnfjE<ouml>rE<eth> Bjarmason <avar@cpan.org>
111  
112 This program is free software, you can redistribute it and/or modify
113 it under the same terms as Perl itself.
114  
115 =cut
« blib/lib/Hailo/Role/Tokenizer.pm ↑ Summary blib/lib/Hailo/Tokenizer/Chars.pm »