読書記録ChangeLog / 2004-12-10

日記内を検索  前の日 / 次の日 / 最新 / ランダム RSS

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

ヒゲを生やした人が言語設計すると成功する

http://www.rubyist.net/~matz/20041206.html#p02
ハードの設計は駄目なのね。

プログラムの変更要求の出し方

http://on-o.com/page/diary/20041214.html#p01

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

uzoyoto@dkiroku.com

これまでの訪問者は 人です。