#!/usr/bin/perl
open (EPW, "<EPW.CD") or die "Can't open EPW file: $!";
open (OUTFILE, ">CelexWordsInTranscription.txt") or die "Can't open output file: $!\n";


READLINE:
while ($line = <EPW>)
{
    $items++;        
    chomp($line);
    $line =~ s/\\/\t/g;    
    ($IdNum, $Word, $Cob, $IdNumLemma, $PronCnt, $PronStatus, $PhonStrsDISC, $PhonCVBr, $PhonSylBCLX, @unassigned) = split ("\t", $line);    
    
    $transcription = $PhonSylBCLX;    
    # $transcription =~ s/[\[\]]//g;    
    unless ($seenwords{$transcription} or $Cob < 10) {
	$seenwords{$transcription} = 1;    
	print OUTFILE "$Cob\t$Word\t$transcription\n";        
    }
    if ($items =~ /000$/) {
        print "$transcription\n";        
    }

}
close (EPW);

close (OUTFILE);
    
