Statistics
| Revision:

root / tmp / org.txm.tigersearch.rcp / src / org / txm / test / DrawTSSVG.groovy @ 458

History | View | Annotate | Download (4.3 kB)

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

    
35
import org.txm.Toolbox
36
import org.txm.searchengine.ts.*
37
import org.txm.utils.ExecTimer
38

    
39

    
40
String userhome = System.getProperty("user.home")
41
Toolbox.setParam(Toolbox.USER_TXM_HOME, "/home/mdecorde/TXM/")
42
File configdir = new File(userhome,"TXM/Tiger/tigersearch.logprop")
43
File registrydir = new File(userhome, "TXM/Tiger/corpora/")
44
File svgfile = new File(userhome,"TXM/Tiger/result.svg")
45
String id = "GRAAL"
46
String query = """#n:[cat = "Obj"] >* #m & arity(#n, 2, 10)"""
47
//String query = "[]"
48

    
49
TSCorpusManager manager = new TSCorpusManager(registrydir, configdir)
50
if(manager.isInitialized()) {
51

    
52
        ExecTimer.start()
53
        TSCorpus corpus = manager.getCorpus(id);
54

    
55
        println "T features: "+corpus.getTFeatures()
56
        println "NT features: "+corpus.getNTFeatures()
57

    
58
        TSResult result = corpus.query(query);
59

    
60
        result.setDisplayProperties(["word", "pos", "form"], "type");
61

    
62
        TSMatch first = result.getFirst();
63
        println "First: nb of sub graph: "+first.getNumberOfSubGraph();
64
        first.firstSubGraph();
65
        first.toSVGFile(new File(userhome,"TXM/Tiger/result_1_1.svg"));
66
        println first.toHTML() + "<br>"
67
        first.nextSubGraph()
68
        first.toSVGFile(new File(userhome,"TXM/Tiger/result_1_2.svg"));
69
        println first.toHTML() + "<br>"
70
        first.nextSubGraph()
71
        first.toSVGFile(new File(userhome,"TXM/Tiger/result_1_3.svg"));
72
        println first.toHTML() + "<br>"
73

    
74
        TSMatch next = result.getNext();
75
        println "Next: nb of sub graph: "+next.getNumberOfSubGraph();
76
        next.firstSubGraph();
77
        next.toSVGFile(new File(userhome,"TXM/Tiger/result_2_1.svg"));
78
        println next.toHTML() + "<br>"
79
        next.nextSubGraph()
80
        next.toSVGFile(new File(userhome,"TXM/Tiger/result_2_2.svg"));
81
        println next.toHTML() + "<br>"
82
        next.nextSubGraph()
83
        next.toSVGFile(new File(userhome,"TXM/Tiger/result_2_3.svg"));
84
        println next.toHTML() + "<br>"
85
        next.previousSubGraph()
86
        next.toSVGFile(new File(userhome,"TXM/Tiger/result_2_2bis.svg"));
87
        println next.toHTML() + "<br>"
88

    
89

    
90

    
91
        //        println "make some room :)"
92
        //        for(File f : new File("/home/mdecorde/Bureau/tigerexports/").listFiles())
93
        //                f.delete()
94
        //
95

    
96
        //        println "SAVE XML"
97
        //        result.toXml(new File("/home/mdecorde/Bureau/tigerexports/result.xml"), false, true)
98
        //
99
        //        println "SAVE AS SVG"
100
        //        for (int i = 0 ; i < result.getNumberOfMatch() && i < 10; i++) {
101
        //                result.getMatch(i).toSVGFile(new File("/home/mdecorde/Bureau/tigerexports/match_"+i+".svg"))
102
        //        }
103
        //
104
        //        println "SIMPLE NO PNC"
105
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export1.csv"), "concordance_simple", 30, ["cat"], ["pos"], false);
106
        //        println "MOT-PIVOT NO PNC"
107
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export2.csv"), "concordance_mot-pivot", 30, ["cat"], ["pos"], false);
108
        //        println "BLOCKS NO PNC"
109
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export3.csv"), "concordance_blocks", 30, ["cat"], ["pos"], false);
110
        //
111
        //        println "SIMPLE + PNC"
112
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export12.csv"), "concordance_simple", 30, ["cat"], ["pos"], true);
113
        //        println "MOT-PIVOT + PNC"
114
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export22.csv"), "concordance_mot-pivot", 30, ["cat"], ["pos"], true);
115
        //        println "BLOCKS + PNC"
116
        //        println result.toConcordance(new File("/home/mdecorde/Bureau/tigerexports/export32.csv"), "concordance_blocks", 30, ["cat"], ["pos"], true);
117
        println ExecTimer.stop()
118
}