[[Perl]] &kensaku("札幌",20); ################################## # # ################################## sub kensaku() { my($kensaku_word,$threshold) = @_; print "$kensaku_word\n"; $pwd = '/home/web/public_html/NLP-Source/Google7gmsIndex'; @res = `estcmd search -max -1 $pwd "$kensaku_word"`; my $i; $i=0; foreach (@res){ if(/^\d+$/){ @lines = `estcmd get $pwd $_ `; foreach $line (@lines){ if($line =~ /^\@uri=(.*)$/){ $file = $1; $file =~ s/^file:\/\///; print "file $file\n"; open(IN,$file); while(<IN>){ chomp; if(/$kensaku_word.*\s(\d+)$/){ $tmp_num = $1; if($tmp_num>=$threshold){ print "$_ \n"; } } } close(IN); } } } } }