1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| sub occurence
{
my %Hash_i = @_;
my $code_html = $Hashè_i{'result'}->[0];
print_code($code_html);
my $tree = HTML::TreeBuilder->new->parse_file("test.html");
my $formatter = HTML::FormatText->new();
my $text = print $formatter->format($tree);
$text =~ s/\S+/ /;
my @html = split/\s/, $text;
@html = delete_common(@html);
@html = grep { defined } @html;
my %occurence = &calcul_occurence(\@html);
foreach my $word(keys(%occurence)) {
my $densite = ($occurence{$word}*100/$#tablo+1;
my %occ = (
$word => [ "$occurence{$word}", "$densite" ]
);
foreach ($word) {
%Hash1 = (
result => [
"$Hash_i{'result'}->[0]", "$Hash_i{'result'}->[1]",
"$Hash_i{'result'}->[2]", "$Hash_i{'result'}->[3] KB",
"$Hash_i{'result'}->[4]", "$Hash_i{'result'}->[5]",
"$Hash_i{'result'}->[6]", "$Hash_i{'result'}->[7]",
"$Hash_i{'result'}->[8]", "$Hash_i{'result'}->[9]",
"$Hash_i{'result'}->[10]", "$text"
],
{
$word => [ "$occurence{$word}", "$densite" ]
}
);
return %Hash1;
}
}
} |
Partager