初入
nino_summer
这个作者很懒,什么都没留下…
展开
-
查词典(查一个词后面的东西)
open(In,"dict.txt");while(){ chomp; if(/(.+)=>(.+)/){ $hash{$1}=$2; }}close(In);while(1){ print "plese input a word:\n"; $input=; chomp($input); if(defined $hash{$input}){ print "原创 2017-06-08 15:52:05 · 287 阅读 · 0 评论 -
统计以a开头的词
open(In,"dict.txt");$a=0;$b=0;$c=0;while(){ chomp; if($_=~/^a/){ $a++; } if($_=~/^b/){ $b++; } if($_=~/^c/){ $c++; }}close(In);print $a."\n";print $b."\n";print $c."\n";原创 2017-06-08 15:56:51 · 436 阅读 · 0 评论 -
找出以abc为前缀、中缀、后缀的词
open(In,"dict.txt");while(){ chomp; if(/(.+)=>(.+)/){ $Hash{$1}=$2; }}close(In); foreach $m(sort keys %Hash){ if($m=~/^ab/g){ print "$m\t$Hash{$m}\n"; } if($m=~/d$/){ print "$m\t$Has原创 2017-06-08 16:01:28 · 446 阅读 · 0 评论 -
找出兼类词并计算兼类词占整个词表的百分比
open(In,"dict.txt");$i=0;$j=0;while(){ chomp; if(/@/){ #print "$_\n"; $j++; } $i++;}close(In);print $j/$i;原创 2017-06-08 16:05:24 · 323 阅读 · 0 评论 -
抽取这个词典中所有独立的汉语译文并统计其频次 ?
open(In,"dict.txt");while(){ chomp; if(/(.+)=>(.+)/){ $hash{$2}=$1; } }close(In);$i=0;foreach $m(sort keys %hash){ @arr=split(" ",$m); foreach $d(@arr){ if($d=~/[\x80-\xff].+/){ #原创 2017-06-09 13:45:18 · 220 阅读 · 0 评论 -
统计词性语料库
open(In,"corpus.txt");open(out,">cibiao.txt");while(){ chomp; @Words=$_=~/(\S+)\/\S+/g; @POSs=$_=~/\S+\/(\S+)/g; for($i=0;$i<@Words;$i++){ # if(defined $hash{$Word[$i]}){ # $refPOS=$hash{$Wo原创 2017-06-25 14:28:28 · 631 阅读 · 0 评论