| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Text::Schmutz; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Ỵoụr ̣Scre̒en is q̒uịt̒e di̇ṛṫẏ, pl̒e̒a̒s̒e cl̇ẹạn i̇ṭ. |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
256626
|
use v5.20; |
|
|
1
|
|
|
|
|
5
|
|
|
6
|
1
|
|
|
1
|
|
8
|
use utf8; |
|
|
1
|
|
|
|
|
10
|
|
|
|
1
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
776
|
use Moo; |
|
|
1
|
|
|
|
|
10324
|
|
|
|
1
|
|
|
|
|
9
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
2483
|
use Types::Common qw( ArrayRef Bool NumRange StrLength ); |
|
|
1
|
|
|
|
|
360343
|
|
|
|
1
|
|
|
|
|
11
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
6079
|
use namespace::autoclean; |
|
|
1
|
|
|
|
|
24180
|
|
|
|
1
|
|
|
|
|
5
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# RECOMMEND PREREQ: Type::Tiny::XS |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
916
|
use experimental qw( postderef signatures ); |
|
|
1
|
|
|
|
|
5274
|
|
|
|
1
|
|
|
|
|
9
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
our $VERSION = 'v0.1.2'; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my $Prob = NumRange [ 0, 1 ]; |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has prob => ( |
|
24
|
|
|
|
|
|
|
is => 'ro', |
|
25
|
|
|
|
|
|
|
isa => $Prob, |
|
26
|
|
|
|
|
|
|
default => 0.1, |
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
has use_small => ( |
|
31
|
|
|
|
|
|
|
is => 'lazy', |
|
32
|
|
|
|
|
|
|
isa => Bool, |
|
33
|
|
|
|
|
|
|
default => sub($self) { return !( $self->use_large || $self->strike_out ) }, |
|
34
|
|
|
|
|
|
|
); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has use_large => ( |
|
38
|
|
|
|
|
|
|
is => 'ro', |
|
39
|
|
|
|
|
|
|
isa => Bool, |
|
40
|
|
|
|
|
|
|
default => 0, |
|
41
|
|
|
|
|
|
|
); |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
has strike_out => ( |
|
45
|
|
|
|
|
|
|
is => 'ro', |
|
46
|
|
|
|
|
|
|
isa => Bool, |
|
47
|
|
|
|
|
|
|
default => 0, |
|
48
|
|
|
|
|
|
|
); |
|
49
|
|
|
|
|
|
|
|
|
50
|
1
|
|
|
|
|
1
|
has _schmutz => ( |
|
51
|
|
|
|
|
|
|
is => 'lazy', |
|
52
|
|
|
|
|
|
|
isa => ArrayRef [ StrLength [1] ], |
|
53
|
1
|
|
|
1
|
|
10
|
builder => sub($self) { |
|
|
1
|
|
|
|
|
2
|
|
|
54
|
1
|
|
|
|
|
2
|
my @schmutz; |
|
55
|
|
|
|
|
|
|
|
|
56
|
1
|
50
|
|
|
|
13
|
push @schmutz, ( "\x{0323}", "\x{0307}", "\x{0312}" ) if $self->use_small; |
|
57
|
1
|
50
|
|
|
|
11
|
push @schmutz, ( "\x{0314}", "\x{031C}", "\x{0358}", "\x{0353}", "\x{0335}" ) if $self->use_large; |
|
58
|
1
|
50
|
|
|
|
2
|
push @schmutz, |
|
59
|
|
|
|
|
|
|
( "\x{0337}", "\x{0338}", "\x{0336}", "\x{0335}", "\x{20d2}", "\x{20d3}", "\x{20e5}", "\x{20e6}", "\x{20eb}" ) |
|
60
|
|
|
|
|
|
|
if $self->strike_out; |
|
61
|
1
|
|
|
|
|
26
|
return \@schmutz; |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
}, |
|
64
|
|
|
|
|
|
|
init_arg => undef, |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
|
68
|
1
|
|
|
1
|
1
|
782
|
sub mangle ( $self, $text, $prob = undef ) { |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1
|
|
|
69
|
|
|
|
|
|
|
|
|
70
|
1
|
|
|
|
|
27
|
my @schmutz = $self->_schmutz->@*; |
|
71
|
1
|
|
|
|
|
36
|
my $size = scalar(@schmutz); |
|
72
|
|
|
|
|
|
|
|
|
73
|
1
|
|
33
|
|
|
6
|
$Prob->assert_valid( $prob //= $self->prob ); |
|
74
|
|
|
|
|
|
|
|
|
75
|
1
|
50
|
|
|
|
58
|
return join( "", map { rand(1) <= $prob ? $_ . $schmutz[ int( rand($size) ) ] : $_ } split //, $text ); |
|
|
11
|
|
|
|
|
46
|
|
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |