Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / importer / tmx / compiler.groovy @ 479

History | View | Annotate | Download (18.3 kB)

1
// Copyright © 2010-2013 ENS de Lyon.
2
// Copyright © 2007-2010 ENS de Lyon, CNRS, INRP, University of
3
// Lyon 2, University of Franche-Comté, University of Nice
4
// Sophia Antipolis, University of Paris 3.
5
// 
6
// The TXM platform is free software: you can redistribute it
7
// and/or modify it under the terms of the GNU General Public
8
// License as published by the Free Software Foundation,
9
// either version 2 of the License, or (at your option) any
10
// later version.
11
// 
12
// The TXM platform is distributed in the hope that it will be
13
// useful, but WITHOUT ANY WARRANTY; without even the implied
14
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15
// PURPOSE. See the GNU General Public License for more
16
// details.
17
// 
18
// You should have received a copy of the GNU General
19
// Public License along with the TXM platform. If not, see
20
// http://www.gnu.org/licenses.
21
//
22
//
23
//
24
// $LastChangedDate: 2017-01-24 18:11:42 +0100 (mar. 24 janv. 2017) $
25
// $LastChangedRevision: 3400 $
26
// $LastChangedBy: mdecorde $
27
//
28
package org.txm.importer.tmx;
29

    
30
import org.txm.importer.cwb.BuildAlignOut;
31
import org.txm.importer.cwb.CwbAlign;
32
import org.txm.importer.cwb.CwbEncode
33
import org.txm.importer.cwb.CwbMakeAll
34
import org.txm.importer.cwb.PatchCwbRegistry;
35
import org.txm.importer.*;
36
import org.txm.scripts.*;
37
import org.txm.scripts.teitxm.*;
38
import org.txm.utils.logger.Log;
39
import org.txm.utils.treetagger.TreeTagger;
40

    
41
import javax.xml.stream.*;
42

    
43
import java.net.URL;
44
import java.io.File;
45
import java.io.IOException;
46
import java.util.ArrayList;
47
import java.util.HashMap;
48
import java.util.List;
49

    
50
// TODO: Auto-generated Javadoc
51
/**
52
 * The Class compiler.
53
 */
54
class compiler
55
{
56
        /** The debug. */
57
        private boolean debug= false;
58

    
59
        /** The input data. */
60
        private def inputData;
61

    
62
        /** The factory. */
63
        private def factory;
64

    
65
        /** The parser. */
66
        private XMLStreamReader parser;
67

    
68
        /** The dir. */
69
        private def dir;
70

    
71
        /** The output. */
72
        private def output;
73

    
74
        /** The url. */
75
        private def url;
76

    
77
        /** The text. */
78
        String text="";
79

    
80
        /** The base. */
81
        String base="";
82

    
83
        /** The project. */
84
        String project="";
85

    
86
        /** The anahash. */
87
        static boolean firstWord = true;
88
        private def anaTypes = [];
89
        public def getAnaTypes() { return anaTypes; }
90
        private HashMap<String,String> anahash = new HashMap<String,String>() ;
91

    
92
        private static SAttributesListener sattrsListener;
93
        private static HashMap<String,ArrayList<String>> structs;
94
        private static HashMap<String, Integer> structsProf;
95
        def headerAttrs; // only for TMX
96

    
97
        /** The tuprops. */
98
        List<String> tuprops;
99

    
100
        /** The cwb loc. */
101
        String cwbLoc;
102

    
103
        /** The corporanames. */
104
        List<String> corporanames = new ArrayList<String>();
105

    
106
        /** The align structure. */
107
        String alignStructure;
108

    
109
        /** The align attribute. */
110
        String alignAttribute;
111

    
112
        /** The do align. */
113
        boolean doAlign = false;
114
        public static HashMap<String, Integer> segs_id = [:]; // static so the id are uniques
115
        public static int seg_id = 0;
116

    
117
        /**
118
         * initialize.
119
         *
120
         */
121
        public compiler(){}
122

    
123
        /**
124
         * Instantiates a new compiler.
125
         *
126
         * @param url the url
127
         * @param text the text
128
         * @param base the base
129
         * @param project the project
130
         * @param tuprops the tuprops
131
         */
132
        public compiler(URL url, String text, String base, String project, List<String> tuprops)
133
        {
134
                this.text = text
135
                this.base = base;
136
                this.project = project;
137
                this.tuprops = tuprops;
138
                try {
139
                        this.url = url;
140
                        inputData = url.openStream();
141
                        factory = XMLInputFactory.newInstance();
142
                        parser = factory.createXMLStreamReader(inputData);
143

    
144
                        if (sattrsListener == null)
145
                                sattrsListener = new SAttributesListener(parser);
146
                        else
147
                                sattrsListener.start(parser)
148
                } catch (XMLStreamException ex) {
149
                        System.out.println(ex);
150
                }catch (IOException ex) {
151
                        System.err.println("IOException while parsing ");
152
                }
153
        }
154

    
155
        /**
156
         * Sets the cwb path.
157
         *
158
         * @param path the new cwb path
159
         */
160
        public void setCwbPath(String path)
161
        {
162
                if(!new File(path).exists())
163
                        System.err.println("CWB Path : "+path+" does not exists")
164
                cwbLoc = path;
165
        }
166

    
167
        /**
168
         * Creates the output.
169
         *
170
         * @param dirPathName the dir path name
171
         * @param fileName the file name
172
         * @return true, if successful
173
         */
174
        private boolean createOutput(String dirPathName, String fileName){
175
                try {
176
                        File f = new File(dirPathName, fileName)
177
                        //We don't want to concatenate the wtc files
178
                        output = new OutputStreamWriter(new FileOutputStream(f, f.exists()) , "UTF-8");
179
                        return true;
180
                } catch (Exception e) {
181
                        System.err.println(e);
182

    
183
                        return false;
184
                }
185
        }
186

    
187
        /**
188
         * Go to text.
189
         */
190
        private void GoToText()
191
        {
192
                for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
193
                {
194
                        if(event == XMLStreamConstants.END_ELEMENT)
195
                                if(parser.getLocalName().equals("teiHeader"))
196
                                        return;
197
                }
198
        }
199

    
200
        /**
201
         * Transfom file wtc.
202
         *
203
         * @param dirPathName the dir path name
204
         * @param fileName the file name
205
         * @return true, if successful
206
         */
207
        public boolean transfomFileWtc(String dirPathName, String fileName)
208
        {
209
                createOutput(dirPathName, fileName);
210

    
211
                GoToText();
212
                firstWord = true;
213
                String headvalue = ""
214
                String vAna = "";
215
                String vForm = "";
216
                String wordid= "";
217
                String vHead = "";
218

    
219
                boolean captureword = false;
220
                boolean flagForm = false;
221
                boolean flagAna = false;
222

    
223
                String anaType;
224
                String tuRef;
225
                try {
226
                        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
227
                        {
228
                                switch (event) {
229
                                        case XMLStreamConstants.START_ELEMENT:
230
                                                sattrsListener.startElement(parser.getLocalName());
231
                                                switch (parser.getLocalName()) {
232
                                                        case "header": // capture header attributes
233
                                                                headerAttrs = [:];
234
                                                                for ( int i = 0 ; i < parser.getAttributeCount() ; i++) {
235
                                                                        headerAttrs[parser.getAttributeLocalName(i)] =  parser.getAttributeValue(i);
236
                                                                }
237
                                                                break;
238
                                                        case "text":
239
                                                                output.write("<text id=\""+text+"\" base=\""+base+"\"" +
240
                                                                " project=\""+project+"\"");
241
                                                                def textAttrs = [];
242
                                                                for ( int i = 0 ; i < parser.getAttributeCount() ; i++)
243
                                                                {
244
                                                                        String attrname = parser.getAttributeLocalName(i);
245
                                                                        String attrvalue = parser.getAttributeValue(i);
246
                                                                        if(attrname != "id")
247
                                                                                output.write(" "+attrname+"=\""+attrvalue+"\"")
248
                                                                        textAttrs << attrname
249
                                                                }
250
                                                                if (headerAttrs != null)
251
                                                                        for( String key : headerAttrs.keySet()) {
252
                                                                                if (!textAttrs.contains(key))
253
                                                                                        output.write(" "+key+"=\""+headerAttrs[key]+"\"")
254
                                                                        }
255
                                                                output.write(">\n");
256

    
257
                                                                break;
258

    
259
                                                        case "tu":
260
                                                                output.write("<tu");
261
                                                                for( String attrname : tuprops)
262
                                                                {
263
                                                                        String attrvalue = parser.getAttributeValue(null, attrname);
264
                                                                        attrname = attrname.toLowerCase();
265
                                                                        if(attrvalue == null)
266
                                                                                output.write(" "+attrname+"=\"N/A\"")
267
                                                                        else
268
                                                                                output.write(" "+attrname+"=\""+attrvalue+"\"")
269
                                                                }
270
                                                                tuRef = text;
271
                                                                for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
272
                                                                        output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"")
273
                                                                        if (parser.getAttributeLocalName(i) == "ref")
274
                                                                                tuRef = parser.getAttributeValue(i);
275
                                                                }
276
                                                                output.write(">\n");
277
                                                                break;
278
                                                        case "seg":
279
                                                                output.write("<seg")
280
                                                                for (int i = 0 ; i < parser.getAttributeCount() ; i++) {
281
                                                                        output.write(" "+parser.getAttributeLocalName(i)+"=\""+parser.getAttributeValue(i)+"\"")
282
                                                                }
283
                                                                output.write(">\n")
284
                                                                break;
285

    
286
                                                        case "w":
287
                                                                for(int i = 0 ; i < parser.getAttributeCount(); i++)
288
                                                                        if(parser.getAttributeLocalName(i).equals("id"))
289
                                                                {
290
                                                                        wordid = parser.getAttributeValue(i);
291
                                                                }
292
                                                                break;
293
                                                        case "form":
294
                                                                flagForm = true;
295
                                                                vForm = "";
296
                                                                anahash.clear();
297
                                                                break;
298

    
299
                                                        case "ana":
300
                                                                flagAna = true;
301
                                                                anaType = parser.getAttributeValue(null, "type")
302
                                                                if (anaType.length() > 0) anaType = anaType.substring(1);
303
                                                                //println "anatype $anaType"
304
                                                                anahash.put(anaType, "");
305
                                                                if (firstWord) {
306
                                                                        anaTypes << anaType;
307
                                                                }
308
                                                                break;
309
                                                }
310
                                                break;
311

    
312
                                        case XMLStreamConstants.END_ELEMENT:
313
                                                sattrsListener.endElement(parser.getLocalName());
314
                                                switch (parser.getLocalName())
315
                                                {
316
                                                        case "text":
317
                                                                output.write("</text>\n");
318
                                                                break;
319

    
320
                                                        case "tu":
321
                                                                output.write("</tu>\n")
322
                                                                break;
323
                                                        case "seg":
324
                                                                output.write("</seg>\n")
325
                                                                break;
326

    
327
                                                        case "w":
328
                                                                firstWord = false;
329
                                                                output.write( vForm.replaceAll("&", "&amp;").replaceAll("<", "&lt;")
330
                                                                         +"\t"+wordid+"\t"+tuRef);
331
                                                                for(String type : anaTypes) {
332
                                                                        output.write("\t"+anahash.get(type));
333
                                                                }
334
                                                                output.write("\n")
335

    
336
                                                                vForm = "";
337
                                                                break;
338

    
339
                                                        case "form":
340
                                                                flagForm = false;
341
                                                                break;
342

    
343
                                                        case "ana":
344
                                                                anahash.put(anaType, vAna);
345
                                                                vAna = "";
346
                                                                flagAna = false;
347
                                                                break;
348
                                                }
349
                                                break;
350

    
351
                                        case XMLStreamConstants.CHARACTERS:
352
                                                if(flagForm)
353
                                                        vForm += parser.getText().trim();
354
                                                if (flagAna) {
355
                                                        vAna += parser.getText().trim()
356
                                                }
357
                                                break;
358
                                }
359
                        }
360
                        output.close();
361
                        parser.close();
362
                }
363
                catch (XMLStreamException ex) {
364
                        System.out.println(ex);
365
                }
366
                catch (IOException ex) {
367
                        System.out.println("IOException while parsing " + inputData);
368
                }
369

    
370
                return true;
371
        }
372

    
373
        /**
374
         * Sets the alignment.
375
         *
376
         * @param structure the structure
377
         * @param attribute the attribute
378
         */
379
        public void setAlignment(String structure, String attribute)
380
        {
381
                doAlign = true;
382
                this.alignStructure = structure;
383
                this.alignAttribute = attribute;
384
        }
385

    
386
        /**
387
         * Gets the tu props.
388
         *
389
         * @param files the files
390
         * @return the tu props
391
         */
392
        public List<String> getTuProps(List<File> files)
393
        {
394
                Set<String> tuprops = new HashSet<String>();
395
                for (File f : files) {
396
                        def inputData = f.toURI().toURL().openStream();
397
                        def factory = XMLInputFactory.newInstance();
398
                        def parser = factory.createXMLStreamReader(inputData);
399
                        for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next())
400
                        {
401
                                switch (event) {
402
                                        case XMLStreamConstants.START_ELEMENT:
403
                                                switch (parser.getLocalName()) {
404
                                                        case "tu":
405
                                                        for ( int i = 0 ; i < parser.getAttributeCount() ; i++) {
406
                                                                tuprops.add(parser.getAttributeLocalName(i));
407
                                                        }
408
                                                        break;
409
                                                }
410
                                }
411
                        }
412
                }
413
                return new ArrayList<String>(tuprops);
414
        }
415

    
416
        public static HashMap<String, String> langs;
417
        public void setLangs(HashMap<String, String> langs)
418
        {
419
                this.langs = langs;
420
        }
421

    
422
        public static HashMap<Integer, ArrayList<String>> langGroups;
423
        public void setLangGroups(HashMap<Integer, ArrayList<String>> groups)
424
        {
425
                this.langGroups = groups;
426
        }
427
        
428
        public static HashMap<Integer, ArrayList<String>> corpusIDS;
429
        public void setCorpusIDS(HashMap<Integer, ArrayList<String>> corpusIDS)
430
        {
431
                this.corpusIDS = corpusIDS;
432
        }
433
        
434
        /**
435
         * Run.
436
         *
437
         * @param rootDirFile the root dir file
438
         * @param basename the basename
439
         * @param textAttributes the text attributes
440
         * @return true, if successful
441
         */
442
        public boolean run(File binDir, File txmDir, String basename)
443
        {
444
                sattrsListener = null; // reset SAttribute Listener for each new import
445
                String rootDir = binDir.getAbsolutePath();
446
                seg_id=1;
447
                if (cwbLoc == null)
448
                        cwbLoc = org.txm.Toolbox.getParam(org.txm.Toolbox.CQI_SERVER_PATH_TO_CQPLIB)+File.separator;
449

    
450
                if (!new File(cwbLoc).exists()) {
451
                        println ("CWB path error: "+cwbLoc)
452
                        return false;
453
                }
454
                if (!new File(rootDir).exists()) {
455
                        println ("binary directory does not exists: "+rootDir)
456
                        return false;
457
                }
458

    
459
                new File(binDir,"/wtc/").deleteDir();
460
                new File(binDir,"/wtc/").mkdir();
461
                new File(binDir,"/data/").deleteDir();
462
                new File(binDir,"/data/").mkdir();
463
                new File(binDir,"registry/").mkdir();
464

    
465
                String textid="";
466
                int counttext =0;
467
                List<File> files = txmDir.listFiles();
468

    
469
                //0- get all tu props
470
                //List<String> tuprops = getTuProps(files);
471

    
472
                if (corpusIDS == null || corpusIDS.size() == 0) {
473
                        corpusIDS = [:];
474
                        for (int group : langGroups.keySet()) {
475
                                String lang = langs.get(langGroups.get(group)[0]);
476
                                if (lang ==null) {
477
                                        println "ERROR: no lang defined for group $group . Aborting."
478
                                }
479
                                corpusIDS[group] = (lang+group).toLowerCase();
480
                        }
481
                }
482
                println "Using corpus ID: $corpusIDS"
483
                
484
                String wtcName;
485
                for (int group : langGroups.keySet()) {
486
                        String lang = langs.get(langGroups.get(group)[0]);
487
                        segs_id.put(group, 0);
488
                        wtcName = basename+"_"+corpusIDS.get(group);
489
                        createOutput(rootDir+"/wtc", "${wtcName}.wtc");
490
                        output.write("<txmcorpus id=\"${wtcName}\" lang=\"$lang\">\n")
491
                        output.close();
492

    
493
                        //create txmDirs
494
                        new File(rootDir, "txm/"+wtcName.toUpperCase()).mkdir();
495
                }
496

    
497
                //1- Transform into WTC file and build a corpus per file
498
                Collections.sort(files);
499
                def anaTypesPerWtc = [:];
500
                def builder = null;
501
                for (int group : langGroups.keySet()) {
502
                        //String lang = langs.get(langGroups.get(group)[0]);
503
                        wtcName = basename+"_"+corpusIDS.get(group);
504
                        def filenames = langGroups.get(group);
505
                        filenames.sort()
506
                        //println("Process group no $group of files "+filenames)
507
                        for (String filename : filenames) {
508
                                File f = new File(txmDir, filename);
509
                                print "."
510
                                if (!f.exists()) {
511
                                        println("COMPILER: file "+f+ " does not exists -> stop")
512
                                        return false;
513
                                }
514

    
515
                                filename = filename.substring(0, filename.length()-4);
516
                                String corpusname = (wtcName).toLowerCase();
517
                                counttext++;
518

    
519
                                String txtname = f.getName();
520
                                txtname = txtname.substring(0, txtname.lastIndexOf("_"));
521
                                seg_id = segs_id.get(group);
522
                                builder = new compiler(f.toURI().toURL(), txtname, basename, "default", tuprops);
523
                                builder.transfomFileWtc(rootDir+"/wtc",wtcName+".wtc");
524
                                anaTypesPerWtc[wtcName] = builder.getAnaTypes();
525
                                segs_id.put(group, seg_id);
526

    
527
                                // move xml-txm file
528
                                File txmCorpusDir = new File(rootDir, "txm/"+wtcName.toUpperCase())
529
                                f.renameTo(new File(txmCorpusDir, f.getName()));
530
                        }
531
                }
532
                println ""
533
                
534
                for (int group : langGroups.keySet()) {
535
                        //String lang = langs.get(langGroups.get(group)[0]);
536
                        createOutput(rootDir+"/wtc", basename+"_"+corpusIDS.get(group)+".wtc");
537
                        output.write("</txmcorpus>")
538
                        output.close();
539
                }
540

    
541
                if(builder == null) {
542
                        System.out.println("No TXM files to process Stop import");
543
                        return false;
544
                }
545
                //2- Import into CWB
546
                def outDir = rootDir;
547
                def outDirTxm = rootDir;
548

    
549
                def wtcFiles = [:]
550
                for (File wtcfile : new File(rootDir, "wtc").listFiles()) {
551
                        String corpusname = wtcfile.getName();
552
                        
553
                        corpusname = corpusname.substring(0, corpusname.length()-4);
554
                        def corpusAnaTypes = anaTypesPerWtc[corpusname];
555
                        
556
                        CwbEncode cwbEn = new CwbEncode();
557
                        cwbEn.setDebug(debug);
558
                        CwbMakeAll cwbMa = new CwbMakeAll();
559
                        cwbMa.setDebug(debug);
560

    
561
                        def pAttrs = ["id", "ref"];
562
                        for(String type : corpusAnaTypes) {
563
                                int i = 2;
564
                                while (pAttrs.contains(type))
565
                                        type = type+(i++);
566
                                pAttrs.add(type);
567
                        }
568

    
569
                        structs = sattrsListener.getStructs();
570
                        structsProf = sattrsListener.getProfs();
571
                        // add structures+properties found in sources
572
                        List<String> sargs = new ArrayList<String>();
573

    
574
                        for (String name : structs.keySet()) {
575
                                if (name == "header") continue;
576
                                //if ( name == "text") continue; // added after
577
                                //if ( name == "q") continue; // added after
578
                                //if ( name == "foreign") continue; // added after
579
                                String concat = name+":"+structsProf.get(name); // append the depth
580
                                for (String value : structs.get(name)) // append the attributes
581
                                        concat += "+"+value;
582
                                if ((name == "text") &&
583
                                !(concat.endsWith("+id") || concat.contains("+id+")))
584
                                        concat += "+id"
585
                                if ((name == "text") &&
586
                                !(concat.endsWith("+base") || concat.contains("+base+")))
587
                                        concat += "+base"
588
                                if ((name == "text") &&
589
                                !(concat.endsWith("+project") || concat.contains("+project+")))
590
                                        concat += "+project"
591
                                sargs.add(concat);
592
                        }
593

    
594
                        sargs.add("txmcorpus:0+id+lang")
595
                        sargs.sort();
596

    
597
                        String[] sAttributes = sargs;
598
                        String[] pAttributes = pAttrs;
599
                        println "P-attributes: "+pAttrs
600
                        println "S-attributes: "+sargs
601

    
602
                        try {
603
                                wtcFiles[corpusname.toLowerCase()] = outDir + "/wtc/"+wtcfile.getName();
604
                                String regPath = outDirTxm + "/registry/"+corpusname.toLowerCase()
605
                                cwbEn.run(new File(cwbLoc,"cwb-encode").getAbsolutePath(), outDirTxm + "/data/"+corpusname.toUpperCase()+"/", outDir + "/wtc/"+wtcfile.getName(), regPath, pAttributes, sAttributes);
606
                                if (!new File(regPath).exists()) {
607
                                        println "Error: The registry file was not created: $regPath. See https://groupes.renater.fr/wiki/txm-users/public/faq"
608
                                        return false;
609
                                }
610
                                cwbMa.run(new File(cwbLoc,"cwb-makeall").getAbsolutePath(), corpusname.toUpperCase(), outDirTxm + "/registry");
611
                        } catch (Exception ex) {System.out.println(ex); return false;}
612
                }
613

    
614
                // 3- do alignement
615
                if (doAlign) {
616
                        File registryDirectory = new File(rootDir,"registry");
617
                        def registryFiles = registryDirectory.listFiles();
618
                        for (File corpusName : registryFiles) {
619
                                for (File targetName : registryFiles) {
620
                                        if (!corpusName.equals(targetName)) {
621
                                                try {
622
                                                        PatchCwbRegistry.patchAlignment(new File(registryDirectory, corpusName.getName()), targetName.getName());
623
                                                        
624
                                                        File wtcFile1 = new File(wtcFiles[corpusName.getName()]);
625
                                                        File wtcFile2 = new File(wtcFiles[targetName.getName()]);
626
                                                        File alignOutFile = new File(outDir, "align.out");
627
                                                        
628
                                                        BuildAlignOut bao = new BuildAlignOut(wtcFile1, wtcFile2);
629
                                                        if (!bao.process(alignOutFile, "seg", "id")) {
630
                                                                println "Error while creating alignement file of $corpusName. Aborting."
631
                                                                return false;
632
                                                        }
633
                                                        
634
                                                        CwbAlign tt = new CwbAlign(cwbLoc);
635
                                                        // ./cwb-align-encode -D -r ~/TXM/corpora/tmxtest/registry/ -v out.align
636
                                                        tt = new CwbAlign(cwbLoc);
637
                                                        tt.setD();
638
                                                        tt.setv();
639
                                                        tt.setr(new File(rootDir,"registry").getAbsolutePath());
640
                                                        tt.cwbalignencode(alignOutFile.getAbsolutePath());
641
                                                } catch (IOException e) {
642
                                                        Log.severe("Error while calling TreeTagger: "+e.getLocalizedMessage());
643
                                                        return false;
644
                                                }
645
                                        }
646
                                }
647
                        }
648
                }
649

    
650
                return true;
651
        }
652

    
653
        /**
654
         * Gets the corpora names.
655
         *
656
         * @return the corpora names
657
         */
658
        public List<String> getCorporaNames()
659
        {
660
                return corporanames;
661
        }
662

    
663
        /**
664
         * Sets the debug.
665
         */
666
        public void setDebug()
667
        {
668
                this.debug = true;
669
        }
670

    
671
        /**
672
         * The main method.
673
         *
674
         * @param args the arguments
675
         */
676
        public static void main(String[] args)
677
        {
678
                File dir = new File("~/xml/geo");
679
                def c = new compiler();
680
                c.setDebug();
681
                c.setCwbPath("~/TXM/cwb/bin");
682
                c.run(dir,"geo");
683
        }
684
}