Revision 479 tmp/org.txm.groovy.core/src/groovy/org/txm/test/Cooccurrences.groovy

Cooccurrences.groovy (revision 479)
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: 2013-05-06 17:38:43 +0200 (lun., 06 mai 2013) $
30
//// $LastChangedRevision: 2386 $
31
//// $LastChangedBy: mdecorde $ 
32
////
33
//package org.txm.test
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: 2013-05-06 17:38:43 +0200 (lun. 06 mai 2013) $
30
// $LastChangedRevision: 2386 $
31
// $LastChangedBy: mdecorde $ 
34 32
//
35
//// we import the packages containing the functions we are going to use
36
//import org.txm.Toolbox
37
//import org.txm.searchengine.cqp.corpus.*
38
//import org.txm.searchengine.cqp.corpus.query.*
39
//import org.txm.functions.cooccurrences.*
40
//
41
//// TODO: Auto-generated Javadoc
42
///* (non-Javadoc)
43
// * @see groovy.lang.Script#run()
44
// */
45
//def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
46
//
47
//def word = discours.getProperty("word")
48
//def pos = discours.getProperty("pos")
49
//
50
//def limit = discours.getStructuralUnit("s")
51
//def minleft = 1
52
//def maxleft = 2
53
//def minright = 1
54
//def maxright = 2
55
//
56
//def minf = 0
57
//def mincof = 0
58
//def minscore = 0
59
//
60
//def query = new Query(Query.fixQuery("je"))
61
//
62
////long time = System.currentTimeMillis()
63
//
64
//def cooccurrence = new Cooccurrence(discours, query, [word], limit, minleft, maxleft, minright, maxright, minf, mincof, minscore)
65
//cooccurrence.process();
66
////cooccurrence.compute()
67
//
68
////println("Compute time : "+(System.currentTimeMillis()-time)+" ms")
69
//
70
//
71
//def file = new File("cooc.txt")
72
//cooccurrence.toTxt(file)
73
//
74
//println "printed cooccurrents in "+file.getAbsolutePath()
75
//
33
package org.txm.test
34

  
35
// we import the packages containing the functions we are going to use
36
import org.txm.Toolbox
37
import org.txm.searchengine.cqp.corpus.*
38
import org.txm.searchengine.cqp.corpus.query.*
39
import org.txm.cooccurrence.core.functions.Cooccurrence
40
import org.txm.functions.cooccurrences.*
41

  
42
// TODO: Auto-generated Javadoc
43
/* (non-Javadoc)
44
 * @see groovy.lang.Script#run()
45
 */
46
def discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
47

  
48
def word = discours.getProperty("word")
49
def pos = discours.getProperty("pos")
50

  
51
def limit = discours.getStructuralUnit("s")
52
def minleft = 1
53
def maxleft = 2
54
def minright = 1
55
def maxright = 2
56

  
57
def minf = 0
58
def mincof = 0
59
def minscore = 0
60

  
61
def query = new Query(Query.fixQuery("je"))
62

  
63
//long time = System.currentTimeMillis()
64

  
65
def cooccurrence = new Cooccurrence(discours, query, [word], limit, minleft, maxleft, minright, maxright, minf, mincof, minscore)
66
cooccurrence.process();
67
//cooccurrence.compute()
68

  
69
//println("Compute time : "+(System.currentTimeMillis()-time)+" ms")
70

  
71

  
72
def file = new File("cooc.txt")
73
cooccurrence.toTxt(file)
74

  
75
println "printed cooccurrents in "+file.getAbsolutePath()
76

  

Also available in: Unified diff