line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Acme::HOIGAN; |
2
|
|
|
|
|
|
|
# ABSTRACT: convert text into HOIGAN! |
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
84681
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
48
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
1405
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub HOIGAN { |
9
|
0
|
|
|
0
|
0
|
|
my ($text) = @_; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# convert to uppercase |
12
|
0
|
|
|
|
|
|
$text = uc($text); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# algunos saludan |
15
|
0
|
0
|
|
|
|
|
if (rand > 0.95) { |
16
|
0
|
|
|
|
|
|
my $saludo = ('OIGAN! ', 'OYGA! ', 'HOIGAN! ', 'HOYGAN! ' )[int(rand(4))]; |
17
|
0
|
|
|
|
|
|
$text = "$saludo$text"; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Eliminamos acentos |
21
|
0
|
|
|
|
|
|
$text =~ tr/ÁÉÍÓÚÀÈÌÒÙáéíóúàèìòùñ/AEIOUAEIOUAEIOUAEIOUÑ/; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# Causuistica chunga de haber, a ver, aver.. |
24
|
0
|
0
|
|
|
|
|
$text =~ s/A VER/rand > 0.75 ?'HABER':'A VER'/ge; |
|
0
|
|
|
|
|
|
|
25
|
0
|
0
|
|
|
|
|
$text =~ s/HABER/rand > 0.75 ?'A VER':'AVER'/ge; |
|
0
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$text =~ s/(\w+)/hoigan_word($1)/ge; |
|
0
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Punto con espacio detras, anadimos puntos o ponemos exclamaciones |
30
|
0
|
0
|
|
|
|
|
$text =~ s/(\.\s+)/rand > 0.25 ? '.' x int(rand(7)+1) . ' ':'!' x int(rand(7)+1) . ' '/ge; |
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Eliminamos puntuacion, y la que queda pasa a ser solo punto. |
32
|
0
|
0
|
|
|
|
|
$text =~ s/(\.+|\,|\;)/rand > 0.50 ? ' ':'.'/ge; |
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $text; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
our $vowels = { |
38
|
|
|
|
|
|
|
'A' => 1, |
39
|
|
|
|
|
|
|
'E' => 1, |
40
|
|
|
|
|
|
|
'I' => 1, |
41
|
|
|
|
|
|
|
'O' => 1, |
42
|
|
|
|
|
|
|
'U' => 1 |
43
|
|
|
|
|
|
|
}; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub hoigan_word { |
46
|
0
|
|
|
0
|
0
|
|
my ($word) = @_; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# sustituir aleatoriamente A por HA y HA por A |
49
|
0
|
0
|
0
|
|
|
|
return 'HA' if ($word eq 'A' and rand > 0.80); |
50
|
0
|
0
|
0
|
|
|
|
return 'A' if ($word eq 'HA' and rand > 0.90); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
# intercalar haches donde no hace falta |
53
|
0
|
0
|
|
|
|
|
$word =~ s/([AEIOU])([AEIOU])/(rand > 0.90)?"$1H$2":"$1$2"/ge; |
|
0
|
|
|
|
|
|
|
54
|
0
|
0
|
|
|
|
|
$word =~ s/([E])([AEIOU])/(rand > 0.90)?"$1H$2":"$1$2"/ge; |
|
0
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
0
|
0
|
|
|
|
|
$word =~ s/CION$/SION/ if (rand > 0.05); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Quitar haches intercaladas... |
59
|
0
|
0
|
|
|
|
|
$word =~ s/(\w)H/(rand > 0.30)?"$1":"$1H"/ge; |
|
0
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# haches a principio de palabra empezada en vocal |
62
|
0
|
|
|
|
|
|
my $first_letter = substr($word, 0, 1); |
63
|
0
|
0
|
0
|
|
|
|
if ($vowels->{$first_letter} and length($word) > 1 and rand > 0.60) { |
|
|
|
0
|
|
|
|
|
64
|
0
|
|
|
|
|
|
$word = "H$word"; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$word =~ s/Ñ/(rand > 0.05)?'NI':(rand > 0.20)?'NY':'Ñ'/; |
68
|
|
|
|
|
|
|
|
69
|
0
|
0
|
|
|
|
|
$word =~ s/QU/(rand > 0.10)?'K':'QU'/ge; |
|
0
|
|
|
|
|
|
|
70
|
0
|
0
|
|
|
|
|
$word =~ s/C(A|O|U)/(rand > 0.10)?"K$1":"C$1"/ge; |
|
0
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
#cl suena a K |
72
|
0
|
0
|
|
|
|
|
$word =~ s/CL/K/g if (rand > 0.90); |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# Letra ese, repetida, si es a final de palabra, con más probabilidad |
75
|
0
|
0
|
|
|
|
|
$word =~ s/([A-RT-Z])S/rand > 0.95 ? "$1S":$1 . ("S" x int(rand(2)+1))/ge; |
|
0
|
|
|
|
|
|
|
76
|
0
|
0
|
|
|
|
|
$word =~ s/S$/rand > 0.25 ? 'S':'S' x int(rand(3)+1)/ge; |
|
0
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Y pasa a LL |
79
|
0
|
0
|
|
|
|
|
$word =~ s/Y(\w)/rand > 0.50 ? "LL$1":"Y$1"/ge; |
|
0
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
$word =~ s/(B|V)/('B','V')[int(rand(2))]/ge; |
|
0
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
0
|
|
|
|
|
|
return $word; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
#################### main pod documentation begin ################### |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head1 NAME |
91
|
|
|
|
|
|
|
Acme::HOIGAN - Convert text into HOIGAN!!! |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SYNOPSIS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
use Acme::HOIGAN; |
96
|
|
|
|
|
|
|
my $text = Acme::HOIGAN::HOIGAN('Un poco de texto') |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Convert text to authentic internet HOIGAN dialect. |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 AUTHOR |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
Jose Luis Martinez |
105
|
|
|
|
|
|
|
CPAN ID: JLMARTIN |
106
|
|
|
|
|
|
|
CAPSiDE |
107
|
|
|
|
|
|
|
jlmartinez@capside.com |
108
|
|
|
|
|
|
|
http://www.pplusdomain.net |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 COPYRIGHT |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Copyright (c) 2015 by Jose Luis Martinez Torres |
113
|
|
|
|
|
|
|
This program is free software; you can redistribute |
114
|
|
|
|
|
|
|
it and/or modify it under the same terms as Perl itself. |
115
|
|
|
|
|
|
|
the full text of the license can be found in the |
116
|
|
|
|
|
|
|
LICENSE file included with this module. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |
119
|
|
|
|
|
|
|
|