tagger benchmark
[IRC.git] / Robust / src / Benchmarks / mlp / tagger / original-java / maps / make-map.pl
diff --git a/Robust/src/Benchmarks/mlp/tagger/original-java/maps/make-map.pl b/Robust/src/Benchmarks/mlp/tagger/original-java/maps/make-map.pl
new file mode 100755 (executable)
index 0000000..127de4f
--- /dev/null
@@ -0,0 +1,29 @@
+# perl script\r
+# makes character map\r
+# input line: number tab name\r
+# output line: <char:name><font:><index:number>\r
+\r
+# generate file names for input\r
+$sourcefile = $ARGV[0];\r
+# generate file names for output\r
+# trim off suffix starting with dot\r
+($base = $sourcefile) =~ s/(.+)\..*/$1/;\r
+$resultfile = "$base.processed.txt";\r
+\r
+print "Converting $sourcefile to $resultfile ...\n";\r
+open (SOURCE, "<$sourcefile");\r
+open (RESULT, ">$resultfile");\r
+\r
+LINE: while ($line = <SOURCE>) {\r
+       next LINE if $line =~ /^#/;             # skip if line matches pattern\r
+       next LINE if $line =~ /^\s*$/;  # skip if source line is empty\r
+       \r
+       if ($line =~ /^(\w+)\s+(\w+)/) {\r
+               $number = $1;\r
+               $name = $2;\r
+               print RESULT "<char:$name><font:><index:$number>\n";\r
+               }\r
+       }\r
+\r
+close (SOURCE);\r
+close (RESULT);\r