#!/usr/local/bin/perl -w # # David MacKay Dec 97 # # conbigram.p - postpriocesses output of # frbigram.p /usr/doc/FAQ/linux-faq.ascii $verbose = 1 ; $max = 0.0 ; while(<>) { @b = split ; $tot = 0 ; foreach $s ( @b ) { $tot += $s ; } foreach $s ( @b ) { $ans = $s*1.0/$tot ; printf "%8.4g\t" , $ans ; if ($max < $ans ) { $max = $ans ; } } print "\n" ; } print STDERR "max = $max\n" ; # to get conditional bigram distributions, # conbigram.p con-bi | hintond.p rotate=1 o=hd_conbigram.ps zero=0.0 range=0.76 rows=27 bellh=27 background=0.0 27 # transpose.p con-bi > con-bi-T # conbigram.p con-bi-T | transpose.p | hintond.p rotate=1 o=hd_conbigramT.ps zero=0.0 range=0.87 rows=27 bellh=27 background=0.0 27