Statistics
| Revision:

root / tmp / org.txm.groovy.core / src / groovy / org / txm / test / ReleaseFunctionsValidation.groovy @ 345

History | View | Annotate | Download (7.2 kB)

1
//package org.txm.test
2
//import org.txm.*
3
//import org.txm.functions.*
4
//import org.txm.functions.ca.*
5
//import org.txm.functions.classification.*
6
//import org.txm.concordances.functions.*
7
//import org.txm.concordances.functions.comparators.*
8
//import org.txm.functions.cooccurrences.Cooccurrence
9
//import org.txm.functions.diagnostic.*
10
//import org.txm.functions.index.*
11
//import org.txm.functions.referencer.Referencer
12
//import org.txm.functions.specificities.*
13
//import org.txm.searchengine.cqp.corpus.*
14
//import org.txm.searchengine.cqp.corpus.query.*
15
//import org.txm.stat.data.LexicalTable
16
//import org.txm.utils.DeleteDir
17
//
18
//File exporttestdir = new File(System.getProperty("user.home"), "TXM/testrelease");
19
//DeleteDir.deleteDirectory exporttestdir;
20
//exporttestdir.mkdir()
21
//println "Results are saved in dir: "+ exporttestdir
22
//
23
////diag corpus
24
//def corpora = CorpusManager.getCorpusManager().getCorpora()
25
//MainCorpus discours = CorpusManager.getCorpusManager().getCorpus("DISCOURS")
26
//println "CORPUS: "+discours
27
//
28
//// word properties
29
//def word_property = discours.getProperty("word")
30
//def pos_property = discours.getProperty("pos")
31
//def lemma_property = discours.getProperty("lemma")
32
//def func_property = discours.getProperty("func")
33
//println "props: $word_property, $pos_property, $lemma_property and $func_property"
34
//
35
//// structure properties
36
//StructuralUnit text_su = discours.getStructuralUnit("text")
37
//StructuralUnit s_su = discours.getStructuralUnit("s")
38
//println "structs: $text_su and $s_su"
39
//
40
//Property text_id_property = text_su.getProperty("id")
41
//Property text_type_property = text_su.getProperty("type")
42
//Property text_date_property = text_su.getProperty("date")
43
//Property text_loc_property = text_su.getProperty("loc")
44
//println "struct props: $text_id_property, $text_type_property, $text_date_property and $text_loc_property"
45
//ReferencePattern referencePattern = new ReferencePattern().addProperty(text_id_property)
46
//
47
//long time;
48
//
49
//// INFORMATIONS
50
//time = System.currentTimeMillis();
51
//Diagnostic diag = new Diagnostic(discours, 20)
52
//diag.stepGeneralInfos();
53
//diag.stepLexicalProperties();
54
//diag.stepStructuralUnits();
55
//diag.toHTML(new File(exporttestdir, "discours_diag"))
56
//println("Diag: "+(System.currentTimeMillis()-time)/1000)
57
//
58
//// LEXICON
59
//time = System.currentTimeMillis();
60
//discours.getLexicon(lemma_property).toTxt(new File(exporttestdir, "discours_lexpos"), "UTF-8", "\t", "");
61
//println("Lex: "+(System.currentTimeMillis()-time)/1000)
62
//
63
//// INDEX
64
//time = System.currentTimeMillis();
65
//Query query = new Query(Query.fixQuery("j.*"))
66
//IndexSample index = new IndexSample(discours, query, [lemma_property, func_property])
67
////index.sortLines(LineComparator.SortMode.FREQUNIT, true)
68
////index.filterLines(2, 3000)
69
//index.toTxt(new File(exporttestdir, "discours_indexlemmafuncj"), "UTF-8", "\t", "")
70
//println("Ind: "+(System.currentTimeMillis()-time)/1000)
71
//
72
//// REFERENCER
73
//time = System.currentTimeMillis();
74
//Referencer referencer = new Referencer(discours, query, lemma_property, [text_type_property], true);
75
//referencer.getQueryMatches()
76
//referencer.getQueryindexes()
77
//referencer.groupPositionsbyId()
78
//referencer.toTxt(new File(exporttestdir, "discours_referencer"), "UTF-8")
79
//println("Ref: "+(System.currentTimeMillis()-time)/1000)
80
//
81
//// CONCORDANCE
82
//time = System.currentTimeMillis();
83
//Concordance concordance = new Concordance(discours, query, word_property, [word_property, pos_property], referencePattern, referencePattern, 15, 15)
84
//LexicographicLeftContextComparator comparator = new LexicographicLeftContextComparator()
85
//comparator.initialize(discours)
86
//concordance.sort(comparator)
87
//concordance.setViewProperties([word_property])
88
//concordance.toTxt(new File(exporttestdir,"discours_concj"), Concordance.Format.CONCORDANCE)
89
//println("Conc: "+(System.currentTimeMillis()-time)/1000)
90
//
91
//// COOCCURRENCE WORD WINDOW
92
//time = System.currentTimeMillis();
93
//Cooccurrence cooc = new Cooccurrence(discours, query, [word_property], null, 21, 1, 1, 11, 2, 3, 1, false);
94
//cooc.process();
95
//cooc.toTxt(new File(exporttestdir, "discours_cooc_wordwindow"), "UTF-8")
96
//println("Cooc1: "+(System.currentTimeMillis()-time)/1000)
97
//
98
//// COOCCURRENCE SENTENCE WINDOW
99
//time = System.currentTimeMillis();
100
//Cooccurrence cooc2 = new Cooccurrence(discours, query, [word_property], s_su,2, 1, 1, 1, 2, 3,1, false);
101
//cooc2.process();
102
//cooc2.toTxt(new File(exporttestdir, "discours_cooc_swindow"), "UTF-8")
103
//println("Cooc2: "+(System.currentTimeMillis()-time)/1000)
104
//
105
//// SUBCORPORA
106
//time = System.currentTimeMillis();
107
//Corpus DGcorpus = discours.createSubcorpus(text_su, text_loc_property, "de Gaulle", "dgsubcorpus")
108
//println("sub: "+(System.currentTimeMillis()-time)/1000)
109
//
110
//// PARTITIONS
111
//time = System.currentTimeMillis();
112
//Partition discours_types = discours.createPartition(text_su, text_type_property)
113
//Partition discours_dates = discours.createPartition(text_su, text_date_property)
114
//println("partitions: "+(System.currentTimeMillis()-time)/1000)
115
//
116
//// LEXICAL TABLE
117
//time = System.currentTimeMillis();
118
//LexicalTable table = discours_types.getLexicalTable(word_property, 2);
119
//table.exportData(new File(exporttestdir, "discours_type_LT"), "\t", "");
120
//println("lex table: "+(System.currentTimeMillis()-time)/1000)
121
//
122
////// SPECIF PARTITION
123
////time = System.currentTimeMillis();
124
////SpecificitesResult specifresult = org.txm.functions.specificities.Specificites.specificites(discours_types, word_property, [], [], 1);
125
////specifresult.toTxt(new File(exporttestdir,"discours_speciftype"), "UTF-8", "\t", "")
126
////println("sepcif part: "+(System.currentTimeMillis()-time)/1000)
127
////
128
////// SPECIF SUBCORPUS
129
////time = System.currentTimeMillis();
130
////SpecificitesResult specifresult2 = org.txm.functions.specificities.Specificites.specificites(DGcorpus.getParent(), DGcorpus, word_property)
131
////specifresult2.toTxt(new File(exporttestdir,"discours_dgsub_specifloc"), "UTF-8", "\t", "")
132
////println("specif sub: "+(System.currentTimeMillis()-time)/1000)
133
////
134
////// SPECIF LEXICAL TABLE
135
////time = System.currentTimeMillis();
136
////SpecificitesResult specifresult3 = org.txm.functions.specificities.Specificites.specificites(table);
137
////specifresult3.toTxt(new File(exporttestdir,"discours_speciftype"), "UTF-8", "\t", "")
138
////println("specif LT: "+(System.currentTimeMillis()-time)/1000)
139
////
140
////// AFC PARTITION
141
////time = System.currentTimeMillis();
142
////CA ca = new CA(discours_dates, lemma_property)
143
////ca.toSVGFactorialMap(new File(exporttestdir,"discours_cadates"), true, true)
144
////ca.toSVGSingularValues(new File(exporttestdir,"discours_cadates_singularvalues"))
145
////println("CA part: "+(System.currentTimeMillis()-time)/1000)
146
////
147
////// AFC LEXICAL TABLE
148
////time = System.currentTimeMillis();
149
////CA ca2 = new CA(table);
150
////ca2.toSVGFactorialMap(new File(exporttestdir,"discours_cadates"), true, true)
151
////ca2.toSVGSingularValues(new File(exporttestdir,"discours_cadates_singularvalues"))
152
////println("CA LT: "+(System.currentTimeMillis()-time)/1000)
153
////
154
////// CAH
155
////time = System.currentTimeMillis();
156
////CAH cah = new CAH(ca, true, CAH.getDefaultMethod(), CAH.getDefaultMetric(), 4, false)
157
////cah.stepCompute()
158
////cah.toSVG(new File(exporttestdir, "discours_dates_cah"),__RDevice.SVG);
159
////println("CAH: "+(System.currentTimeMillis()-time)/1000)