Debian Codegraph @

src/04-ngram/02-FormatCorpus

raw
1 #!/usr/bin/perl
2 # Copyright (C) 2009-2011 Antonio Bonafonte
3 # Universitat Politècnica de Catalunya, Barcelona, Spain
4 #
5 # This script is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation,
8 # version 2.1 of the License.
9 #
10 # This library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with this library; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 open (DICIN, "work/corpus-ca-reduitsTAGS.out");
20 open (DICOUT, ">work/corpus-ca.out");
21 open (DICOUT2, ">work/corpus-ca-frase.out");
22 $inici=1;
23
24
25 while(<DICIN>)
26 {
27 @fila = split(/\s+/, $_);
28 if ((@fila[2] eq Fp)||(@fila[2] eq Fat)||(@fila[2] eq Fp)||(@fila[2] eq Fit)){
29 print DICOUT " @fila[2]\n";
30 print DICOUT2 " @fila[0]\n";
31 $inici=1;
32 }
33 else {
34
35 if ($inici eq 1)
36 {
37 print DICOUT "@fila[2]";
38 print DICOUT2 "@fila[0]";
39 $inici=0;
40 }
41 else
42 {
43 print DICOUT " @fila[2]";
44 print DICOUT2 " @fila[0]";
45 }
46
47
48 }
49 }
50 close (DICOUT);
51 close (DICIN);
52 close (DICOUT);