2004-12-10 Fri
■ cl.itemlistからidfを求める
tfidf
http://www.namazu.org/ml/avocado/msg00010.html
use strict;
my @words;#1アイテムを分かち書きしたもの。
my %f;#{単語,出現回数}のハッシュ
my $th = 1;#閾値
my $line_count = 0;#行数
my $ignore = "http://";
while(<STDIN>){
$line_count = $line_count + 1;
@words = split (/\s/ , $_);
shift @words;
shift @words;
my %d;#重複カウント防止
foreach (@words){
unless($_ =~ /$ignore/){#URLを除く
$f{$_} = $f{$_} + 1 unless $d{$_};
$d{$_} = 1;
# print "$f{$_} $_\n";
}
}
}
foreach (keys %f){
my $idf = 1 + log($line_count / $f{$_}) / log(2);
print "$_,$f{$_},$idf\n" if ($f{$_} > $th);
}
kakasi -w < cl.itemlist| perl idf.pl |lv -Os > idf.txt
[
固定リンク
]
■ Generalized Venn Diagrams
http://www.informatik.uni-ulm.de/ni/mitarbeiter/HKestler/vennm/
via http://km.meme.hokudai.ac.jp/people/buchi/diary/?date=20041206#p02
[
固定リンク
]
2004-12 / 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
これまでの訪問者は 人です。
