-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcol2vard.pl
47 lines (38 loc) · 1.34 KB
/
col2vard.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#irs, May 2014
# convert the column format to VARDS format.
# for this round we decided to ignore the abbreviations
# that means that the special cases where an abbreviation is first expanded and then normalized, are removed from evaluation!!
#all of these are ignored:
#NormColTrain/PS6223.col:ms muchos
#NormColTrain/PS6223.col:as años
#NormColTrain/PS6223.col:q que
#NormColTrain/PS6216.col:ll libras llibras
#NormColTrain/PS6218.col:unicamte únicamente unicamente
#$file = $ARGV[0];
$path= "/Users/irishendrickx/CLUL/CARDS/Data/Spaans/mei2014/";
#@files = glob("$path/NormColTrain/*.col"); #Test
foreach $file (@files)
{
chomp($file);
if($file =~ /.*\/(.*)\.col/){ $name = $1; }
#open (OUT,">$path/VARDtrain/$name.txt") || die "kan niet schrijven";
open(FILE, "$file")|| die "cant open $file\n";
while(<FILE>)
{
$line =$_;
chomp $line;
if($line =~ /<s>/){print OUT "\n"; }
else{
($orig,$norm,$expand ) = split /\t/, $line;
if($expand eq "" && $norm eq "") {print OUT "$orig "; }
else{
$printorig="";
if($expand ne ""){ $printorig = $expand; }
if($norm ne "" ){ $printorig = $norm; }
print OUT "<normalised orig=\"$orig\" auto=\"false\">$printorig<\/normalised> ";
}
}
}
close(FILE);
close(OUT);
}