#!/usr/local/bin/perl # Copyright @ 1994 MIT # Written by Eric Brill #THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS #OR WARRANTIES, EXPRESS OR IMPLIED. By way of example, but not #limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF #MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF #THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY #PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS. # given a bigram list, we only need to keep those bigrams actually referred # to in rules. Since bigram list in general imposes the greatest memory # requirement, this can be a big memory saver. open(XX,$ARGV[0]); while(){ if (/good/) { @temp = split; for ($count=0;$count<=$#temp;++$count) { $seen{$temp[$count]}++; }}} open(YY,$ARGV[1]); while() { @temp = split; if ($seen{$temp[0]} || $seen{$temp[1]}) { print;}}