Révision 615
tmp/org.txm.wordcloud.core/src/org/txm/wordcloud/core/functions/WordCloud.java (revision 615) | ||
---|---|---|
225 | 225 |
} |
226 | 226 |
|
227 | 227 |
@Override |
228 |
protected boolean _compute(boolean update) {
|
|
228 |
protected boolean _compute() { |
|
229 | 229 |
// // FIXME: source must always be an Index because the corpus source produces an Index |
230 | 230 |
// // from corpus |
231 | 231 |
// if (source instanceof Corpus) { |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/preferences/ChartsEnginePreferences.java (revision 615) | ||
---|---|---|
66 | 66 |
*/ |
67 | 67 |
public final static String FONT = PREFERENCES_PREFIX + "font"; //$NON-NLS-1$ |
68 | 68 |
|
69 |
/** |
|
70 |
* Same style for all lines. |
|
71 |
*/ |
|
72 |
public static final String MULTIPLE_LINE_STROKES = PREFERENCES_PREFIX + "multiple_line_strokes"; //$NON-NLS-1$ |
|
69 | 73 |
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
70 | 78 |
// local result preferences |
71 | 79 |
public final static String CHART_TYPE = PREFERENCES_PREFIX + "chart_type"; //$NON-NLS-1$ |
72 | 80 |
public final static String RESULT_DATA_TYPE = PREFERENCES_PREFIX + "result_data_type"; //$NON-NLS-1$ |
73 | 81 |
|
74 | 82 |
|
83 |
|
|
84 |
|
|
85 |
|
|
75 | 86 |
/** |
76 | 87 |
* Default font string representation. |
77 | 88 |
*/ |
... | ... | |
102 | 113 |
preferences.putBoolean(SHOW_GRID, true); |
103 | 114 |
preferences.putInt(RENDERING_COLORS_MODE, ChartsEngine.RENDERING_COLORS_MODE); |
104 | 115 |
preferences.put(MONOCHROME_COLOR, "0,220,20"); //$NON-NLS-1$ |
116 |
preferences.putBoolean(MULTIPLE_LINE_STROKES, false); |
|
105 | 117 |
|
118 |
|
|
119 |
|
|
106 | 120 |
preferences.put(CHART_TYPE, DEFAULT_CHART_TYPE); |
107 | 121 |
|
108 | 122 |
// FIXME: maybe need need to check here the target OS and set a default Unicode installed font |
tmp/org.txm.chartsengine.core/src/org/txm/chartsengine/core/results/ChartResult.java (revision 615) | ||
---|---|---|
4 | 4 |
package org.txm.chartsengine.core.results; |
5 | 5 |
|
6 | 6 |
import java.lang.reflect.Field; |
7 |
import java.util.ArrayList; |
|
8 |
import java.util.Arrays; |
|
9 |
import java.util.HashMap; |
|
10 | 7 |
import java.util.List; |
11 | 8 |
|
12 | 9 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
87 | 84 |
|
88 | 85 |
|
89 | 86 |
/** |
87 |
* Multiple lines styles/strokes. |
|
88 |
*/ |
|
89 |
@Parameter(key=ChartsEnginePreferences.MULTIPLE_LINE_STROKES, type=Parameter.RENDERING) |
|
90 |
protected boolean multipleLineStrokes; |
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
/** |
|
90 | 96 |
* |
91 | 97 |
* @param parent |
92 | 98 |
*/ |
... | ... | |
107 | 113 |
|
108 | 114 |
|
109 | 115 |
@Override |
110 |
public boolean compute(boolean update, IProgressMonitor monitor) throws Exception {
|
|
116 |
public boolean compute(IProgressMonitor monitor) throws Exception { |
|
111 | 117 |
|
112 | 118 |
// FIXME: Debug |
113 | 119 |
System.err.println("************** ChartResult.compute(): computing result of type " + this.getClass() + "..."); |
114 |
// |
|
120 |
|
|
115 | 121 |
// compute the result if needed |
116 |
if(super.compute(update, monitor, false)) {
|
|
122 |
if(super.compute(monitor, false)) { |
|
117 | 123 |
// compute the chart |
118 |
return renderChart(update);
|
|
124 |
return renderChart(); |
|
119 | 125 |
} |
120 | 126 |
else { |
121 | 127 |
return false; |
... | ... | |
128 | 134 |
* @return |
129 | 135 |
* @throws Exception |
130 | 136 |
*/ |
131 |
protected boolean renderChart(boolean update) throws Exception {
|
|
137 |
protected boolean renderChart() throws Exception { |
|
132 | 138 |
|
133 | 139 |
this.subTask("Rendering chart."); |
134 | 140 |
|
... | ... | |
188 | 194 |
return false; |
189 | 195 |
} |
190 | 196 |
|
197 |
|
|
198 |
@Override |
|
199 |
public String dumpParameters() { |
|
200 |
return super.dumpParameters() + "\n" + this.dumpParameters(Parameter.RENDERING); |
|
201 |
} |
|
202 |
|
|
191 | 203 |
/** |
192 | 204 |
* Updates the parameters used for last rendering. |
193 | 205 |
* |
... | ... | |
436 | 448 |
return TXMPreferences.isEmpty(this.preferencesNodeQualifier, key); |
437 | 449 |
} |
438 | 450 |
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
/** |
|
455 |
* @return the monoStyle |
|
456 |
*/ |
|
457 |
public boolean isMultipleLineStrokes() { |
|
458 |
return multipleLineStrokes; |
|
459 |
} |
|
460 |
|
|
461 |
|
|
462 |
|
|
463 |
/** |
|
464 |
* @param multipleStrokes the monoStyle to set |
|
465 |
*/ |
|
466 |
public void setMultipleLineStrokes(boolean multipleStrokes) { |
|
467 |
this.multipleLineStrokes = multipleStrokes; |
|
468 |
} |
|
469 |
|
|
470 |
|
|
439 | 471 |
// FIXME |
440 | 472 |
// public Object createChart(IProgressMonitor monitor, String chartType) { |
441 | 473 |
// Object chart = null; |
tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/summary/Summary.java (revision 615) | ||
---|---|---|
287 | 287 |
|
288 | 288 |
|
289 | 289 |
@Override |
290 |
protected boolean _compute(boolean update) throws Exception {
|
|
290 |
protected boolean _compute() throws Exception { |
|
291 | 291 |
System.err.println("Summary.compute() not implemented"); |
292 | 292 |
return false; |
293 | 293 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/preview/Preview.java (revision 615) | ||
---|---|---|
114 | 114 |
|
115 | 115 |
|
116 | 116 |
@Override |
117 |
protected boolean _compute(boolean update) throws Exception {
|
|
117 |
protected boolean _compute() throws Exception { |
|
118 | 118 |
if (partition != null) { |
119 | 119 |
return computePartition(); |
120 | 120 |
} else { |
tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/diagnostic/Diagnostic.java (revision 615) | ||
---|---|---|
628 | 628 |
} |
629 | 629 |
|
630 | 630 |
@Override |
631 |
protected boolean _compute(boolean update) throws Exception {
|
|
631 |
protected boolean _compute() throws Exception { |
|
632 | 632 |
|
633 | 633 |
this.beginTask("Computing informations...", 3); |
634 | 634 |
stepGeneralInfos(); |
tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/selection/Selection.java (revision 615) | ||
---|---|---|
515 | 515 |
} |
516 | 516 |
|
517 | 517 |
@Override |
518 |
protected boolean _compute(boolean update) throws Exception {
|
|
518 |
protected boolean _compute() throws Exception { |
|
519 | 519 |
System.err.println("Selection.compute() not implemented"); |
520 | 520 |
return false; |
521 | 521 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 615) | ||
---|---|---|
724 | 724 |
} |
725 | 725 |
|
726 | 726 |
@Override |
727 |
protected boolean _compute(boolean update) throws Exception {
|
|
727 |
protected boolean _compute() throws Exception { |
|
728 | 728 |
// TODO Auto-generated method stub |
729 | 729 |
return true; |
730 | 730 |
} |
tmp/org.txm.ca.rcp/src/org/txm/ca/rcp/handlers/ComputeCA.java (revision 615) | ||
---|---|---|
41 | 41 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
42 | 42 |
import org.txm.core.results.TXMResult; |
43 | 43 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
44 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
|
44 |
import org.txm.lexicaltable.core.functions.___LexicalTableFactory;
|
|
45 | 45 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog; |
46 | 46 |
import org.txm.rcp.RCPMessages; |
47 | 47 |
import org.txm.rcp.StatusLine; |
... | ... | |
152 | 152 |
// FIXME: old code |
153 | 153 |
//ChartEditorPart.compute(ca); |
154 | 154 |
// FIXME: new code |
155 |
ca.compute(false);
|
|
155 |
ca.compute(); |
|
156 | 156 |
|
157 | 157 |
try { |
158 | 158 |
|
tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java (revision 615) | ||
---|---|---|
204 | 204 |
* |
205 | 205 |
* @return true, if successful |
206 | 206 |
*/ |
207 |
protected boolean _compute(boolean update) |
|
208 |
{ |
|
207 |
protected boolean _compute() { |
|
209 | 208 |
try { |
210 | 209 |
if (!getQueryMatches()) |
211 | 210 |
return false; |
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Specificites2.java (revision 615) | ||
---|---|---|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
@Override |
22 |
protected boolean _compute(boolean update) throws StatException {
|
|
22 |
protected boolean _compute() throws StatException { |
|
23 | 23 |
itable = table.getData(); |
24 | 24 |
colNames = itable.getColNames().asStringsArray(); |
25 | 25 |
rowNames = itable.getRowNames().asStringsArray(); |
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrast.java (revision 615) | ||
---|---|---|
11 | 11 |
import org.txm.core.results.TXMParameters; |
12 | 12 |
import org.txm.core.results.TXMResult; |
13 | 13 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
14 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
|
15 |
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable; |
|
16 |
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl; |
|
17 |
import org.txm.lexicon.core.corpusengine.cqp.Lexicon; |
|
18 |
//import org.txm.progression.core.functions.Progression; |
|
19 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
20 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
21 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
22 |
import org.txm.searchengine.cqp.corpus.Property; |
|
23 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
24 | 14 |
import org.txm.specificities.core.messages.SpecificitiesCoreMessages; |
25 | 15 |
import org.txm.stat.engine.r.RDevice; |
26 | 16 |
import org.txm.stat.engine.r.RWorkspaceRenderer; |
27 | 17 |
import org.txm.statsengine.core.StatException; |
28 |
import org.txm.statsengine.core.data.Vector; |
|
29 | 18 |
import org.txm.statsengine.r.core.RWorkspace; |
19 |
//import org.txm.progression.core.functions.Progression; |
|
30 | 20 |
|
31 | 21 |
public abstract class Contrast extends TXMResult{ |
32 | 22 |
|
... | ... | |
60 | 50 |
// symbol = "Contrast_"+this.getClass().getSimpleName()+"_"+(no_contrast++); |
61 | 51 |
// } |
62 | 52 |
|
63 |
protected abstract boolean _compute(boolean update) throws Exception; |
|
64 | 53 |
|
65 | 54 |
public abstract String getName(); |
66 | 55 |
|
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/RelativeFrequency.java (revision 615) | ||
---|---|---|
16 | 16 |
} |
17 | 17 |
|
18 | 18 |
@Override |
19 |
protected boolean _compute(boolean update) throws Exception {
|
|
19 |
protected boolean _compute() throws Exception { |
|
20 | 20 |
itable = table.getData(); |
21 | 21 |
colNames = itable.getColNames().asStringsArray(); |
22 | 22 |
rowNames = itable.getRowNames().asStringsArray(); |
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/AbsoluteFrequency.java (revision 615) | ||
---|---|---|
17 | 17 |
} |
18 | 18 |
|
19 | 19 |
@Override |
20 |
protected boolean _compute(boolean update) throws StatException {
|
|
20 |
protected boolean _compute() throws StatException { |
|
21 | 21 |
itable = table.getData(); |
22 | 22 |
colNames = itable.getColNames().asStringsArray(); |
23 | 23 |
rowNames = itable.getRowNames().asStringsArray(); |
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Contrasts.java (revision 615) | ||
---|---|---|
39 | 39 |
public boolean compute() throws Exception { |
40 | 40 |
for (Contrast m : mesures) { |
41 | 41 |
System.out.println(TXMCoreMessages.Contrasts_0+m.getName()); |
42 |
m.compute(false);
|
|
42 |
m.compute(); |
|
43 | 43 |
} |
44 | 44 |
return true; |
45 | 45 |
} |
tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Chi2.java (revision 615) | ||
---|---|---|
15 | 15 |
} |
16 | 16 |
|
17 | 17 |
@Override |
18 |
protected boolean _compute(boolean update) throws StatException {
|
|
18 |
protected boolean _compute() throws StatException { |
|
19 | 19 |
itable = table.getData(); |
20 | 20 |
colNames = itable.getColNames().asStringsArray(); |
21 | 21 |
rowNames = itable.getRowNames().asStringsArray(); |
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 615) | ||
---|---|---|
130 | 130 |
} |
131 | 131 |
|
132 | 132 |
@Override |
133 |
protected boolean _compute(boolean update) throws Exception {
|
|
133 |
protected boolean _compute() throws Exception { |
|
134 | 134 |
|
135 | 135 |
SpecificitiesR si = new SpecificitiesR(lexicalTable.getData()); |
136 | 136 |
|
tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 615) | ||
---|---|---|
146 | 146 |
} |
147 | 147 |
|
148 | 148 |
@Override |
149 |
protected boolean _compute(boolean update) throws Exception {
|
|
149 |
protected boolean _compute() throws Exception { |
|
150 | 150 |
// does nothing |
151 | 151 |
return true; |
152 | 152 |
} |
tmp/org.txm.groovy.core/src/groovy/org/txm/test/AFC.groovy (revision 615) | ||
---|---|---|
80 | 80 |
// on fait une afc |
81 | 81 |
//EN: compute the CA |
82 | 82 |
def ca = new CA(table) |
83 |
ca.processFromTable();
|
|
83 |
ca.compute();
|
|
84 | 84 |
|
85 | 85 |
timer.stop() |
86 | 86 |
println "calcul de l'AFC 1 : "+timer.toString() |
... | ... | |
137 | 137 |
// on fait une afc |
138 | 138 |
//EN: we compute a CA |
139 | 139 |
def ca2 = new CA(table) |
140 |
ca2.processFromTable();
|
|
140 |
ca2.compute();
|
|
141 | 141 |
timer.stop() |
142 | 142 |
println "calcul de la deuxième AFC : "+timer.toString() |
143 | 143 |
timer.reset() |
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTableFactory.java (revision 615) | ||
---|---|---|
1 |
package org.txm.lexicaltable.core.functions; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.HashMap; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
|
|
8 |
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl; |
|
9 |
import org.txm.lexicon.core.corpusengine.cqp.Lexicon; |
|
10 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
11 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
12 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
13 |
import org.txm.searchengine.cqp.corpus.Property; |
|
14 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
15 |
import org.txm.statsengine.r.core.exceptions.RWorkspaceException; |
|
16 |
|
|
17 |
public class LexicalTableFactory { |
|
18 |
|
|
19 |
/** |
|
20 |
* Create a Complete Lexical Table according to a Partition and a Property. |
|
21 |
* |
|
22 |
* @param partition the partition |
|
23 |
* @param analysisProperty the analysis property |
|
24 |
* @param fMin the fmin |
|
25 |
* @param vmax |
|
26 |
* @return the lexical table |
|
27 |
* @throws CqiClientException the cqi client exception |
|
28 |
* @throws RWorkspaceException the r workspace exception |
|
29 |
*/ |
|
30 |
public static final LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int fMin, int vMax) throws Exception { |
|
31 |
//long time = System.currentTimeMillis(); |
|
32 |
List<Lexicon> lexicons = new ArrayList<Lexicon>(); |
|
33 |
// Set<String> allLexiconEntry = new HashSet<String>(); |
|
34 |
for (int i = 0; i < partition.getNPart(); i++) { |
|
35 |
Lexicon l = new Lexicon(partition.getParts().get(i)); |
|
36 |
l.setProperty(analysisProperty); |
|
37 |
l.compute(null); |
|
38 |
lexicons.add(l); |
|
39 |
} |
|
40 |
//System.out.println("time lexicon build "+(System.currentTimeMillis()-time)); |
|
41 |
//time = System.currentTimeMillis(); |
|
42 |
// String[] entries = allLexiconEntry.toArray(new String[]{}); |
|
43 |
Corpus c = partition.getCorpus(); |
|
44 |
Lexicon ll = new Lexicon(c); |
|
45 |
ll.setProperty(analysisProperty); |
|
46 |
ll.compute(null); |
|
47 |
|
|
48 |
ArrayList<String> filteredForms = new ArrayList<String>(); |
|
49 |
//create a copy and filter line with Fmin; |
|
50 |
for (int i = 0 ; i < ll.getFreq().length ; i++) { |
|
51 |
if (ll.getFreq()[i] >= fMin) { |
|
52 |
filteredForms.add(ll.getForms()[i]); |
|
53 |
} |
|
54 |
} |
|
55 |
//System.out.println("remove freq too low "+(System.currentTimeMillis()-time)); |
|
56 |
//time = System.currentTimeMillis(); |
|
57 |
Map<String, Integer> entries2index = new HashMap<String, Integer>(); |
|
58 |
for (int i = 0; i < filteredForms.size(); i++) { |
|
59 |
entries2index.put(filteredForms.get(i), i); |
|
60 |
} |
|
61 |
|
|
62 |
//System.out.println("entries2index "+(System.currentTimeMillis()-time)); |
|
63 |
//time = System.currentTimeMillis(); |
|
64 |
int[][] mat = new int[filteredForms.size()][lexicons.size()];//DoubleFactory2D.sparse.make(filteredForms.size(), lexicons.size(), 0); |
|
65 |
|
|
66 |
|
|
67 |
Integer id= null; |
|
68 |
for (int i = 0; i < lexicons.size(); i++) { |
|
69 |
Lexicon l = lexicons.get(i); |
|
70 |
String[] ents = l.getForms(); |
|
71 |
int[] freqs = l.getFreq(); |
|
72 |
for (int j = 0; j < freqs.length; j++) { |
|
73 |
id = entries2index.get(ents[j]); |
|
74 |
// if (entriesFreqs[id] >= 2) |
|
75 |
if (id != null) { |
|
76 |
mat[id][i] = freqs[j]; //mat.setQuick(id, i, freqs[j]); |
|
77 |
} |
|
78 |
} |
|
79 |
} |
|
80 |
//System.out.println("time build matrix "+(System.currentTimeMillis()-time)); |
|
81 |
//time = System.currentTimeMillis(); |
|
82 |
//System.out.println("Entries size " + filteredForms.size()); |
|
83 |
//System.out.println("mat size " + mat.rows()); |
|
84 |
//System.out.println("mat columns " + mat.columns()); |
|
85 |
|
|
86 |
LexicalTableImpl iTable = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartShortNames().toArray(new String[] {})); |
|
87 |
|
|
88 |
LexicalTable table = new LexicalTable(partition, analysisProperty, fMin, vMax, iTable); |
|
89 |
//System.out.println("time build table lexical "+(System.currentTimeMillis()-time)); |
|
90 |
return table; |
|
91 |
} |
|
92 |
|
|
93 |
/** |
|
94 |
* |
|
95 |
* @param subcorpus |
|
96 |
* @param property |
|
97 |
* @return |
|
98 |
* @throws Exception |
|
99 |
*/ |
|
100 |
public static LexicalTable getLexicalTable(Subcorpus subcorpus, Property property) throws Exception { |
|
101 |
return new LexicalTable(subcorpus, property); |
|
102 |
} |
|
103 |
} |
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 615) | ||
---|---|---|
350 | 350 |
|
351 | 351 |
|
352 | 352 |
@Override |
353 |
protected boolean _compute(boolean update) throws Exception {
|
|
353 |
protected boolean _compute() throws Exception { |
|
354 | 354 |
|
355 | 355 |
if (this.parent instanceof Subcorpus) { |
356 | 356 |
|
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/___LexicalTableFactory.java (revision 615) | ||
---|---|---|
1 |
package org.txm.lexicaltable.core.functions; |
|
2 |
|
|
3 |
import java.util.ArrayList; |
|
4 |
import java.util.HashMap; |
|
5 |
import java.util.List; |
|
6 |
import java.util.Map; |
|
7 |
|
|
8 |
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl; |
|
9 |
import org.txm.lexicon.core.corpusengine.cqp.Lexicon; |
|
10 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
11 |
import org.txm.searchengine.cqp.corpus.Corpus; |
|
12 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
13 |
import org.txm.searchengine.cqp.corpus.Property; |
|
14 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
15 |
import org.txm.statsengine.r.core.exceptions.RWorkspaceException; |
|
16 |
|
|
17 |
// FIXME: became useless? |
|
18 |
@Deprecated |
|
19 |
public class ___LexicalTableFactory { |
|
20 |
|
|
21 |
/** |
|
22 |
* Create a Complete Lexical Table according to a Partition and a Property. |
|
23 |
* |
|
24 |
* @param partition the partition |
|
25 |
* @param analysisProperty the analysis property |
|
26 |
* @param fMin the fmin |
|
27 |
* @param vmax |
|
28 |
* @return the lexical table |
|
29 |
* @throws CqiClientException the cqi client exception |
|
30 |
* @throws RWorkspaceException the r workspace exception |
|
31 |
*/ |
|
32 |
public static final LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int fMin, int vMax) throws Exception { |
|
33 |
//long time = System.currentTimeMillis(); |
|
34 |
List<Lexicon> lexicons = new ArrayList<Lexicon>(); |
|
35 |
// Set<String> allLexiconEntry = new HashSet<String>(); |
|
36 |
for (int i = 0; i < partition.getNPart(); i++) { |
|
37 |
Lexicon l = new Lexicon(partition.getParts().get(i)); |
|
38 |
l.setProperty(analysisProperty); |
|
39 |
l.compute(null); |
|
40 |
lexicons.add(l); |
|
41 |
} |
|
42 |
//System.out.println("time lexicon build "+(System.currentTimeMillis()-time)); |
|
43 |
//time = System.currentTimeMillis(); |
|
44 |
// String[] entries = allLexiconEntry.toArray(new String[]{}); |
|
45 |
Corpus c = partition.getCorpus(); |
|
46 |
Lexicon ll = new Lexicon(c); |
|
47 |
ll.setProperty(analysisProperty); |
|
48 |
ll.compute(null); |
|
49 |
|
|
50 |
ArrayList<String> filteredForms = new ArrayList<String>(); |
|
51 |
//create a copy and filter line with Fmin; |
|
52 |
for (int i = 0 ; i < ll.getFreq().length ; i++) { |
|
53 |
if (ll.getFreq()[i] >= fMin) { |
|
54 |
filteredForms.add(ll.getForms()[i]); |
|
55 |
} |
|
56 |
} |
|
57 |
//System.out.println("remove freq too low "+(System.currentTimeMillis()-time)); |
|
58 |
//time = System.currentTimeMillis(); |
|
59 |
Map<String, Integer> entries2index = new HashMap<String, Integer>(); |
|
60 |
for (int i = 0; i < filteredForms.size(); i++) { |
|
61 |
entries2index.put(filteredForms.get(i), i); |
|
62 |
} |
|
63 |
|
|
64 |
//System.out.println("entries2index "+(System.currentTimeMillis()-time)); |
|
65 |
//time = System.currentTimeMillis(); |
|
66 |
int[][] mat = new int[filteredForms.size()][lexicons.size()];//DoubleFactory2D.sparse.make(filteredForms.size(), lexicons.size(), 0); |
|
67 |
|
|
68 |
|
|
69 |
Integer id= null; |
|
70 |
for (int i = 0; i < lexicons.size(); i++) { |
|
71 |
Lexicon l = lexicons.get(i); |
|
72 |
String[] ents = l.getForms(); |
|
73 |
int[] freqs = l.getFreq(); |
|
74 |
for (int j = 0; j < freqs.length; j++) { |
|
75 |
id = entries2index.get(ents[j]); |
|
76 |
// if (entriesFreqs[id] >= 2) |
|
77 |
if (id != null) { |
|
78 |
mat[id][i] = freqs[j]; //mat.setQuick(id, i, freqs[j]); |
|
79 |
} |
|
80 |
} |
|
81 |
} |
|
82 |
//System.out.println("time build matrix "+(System.currentTimeMillis()-time)); |
|
83 |
//time = System.currentTimeMillis(); |
|
84 |
//System.out.println("Entries size " + filteredForms.size()); |
|
85 |
//System.out.println("mat size " + mat.rows()); |
|
86 |
//System.out.println("mat columns " + mat.columns()); |
|
87 |
|
|
88 |
LexicalTableImpl iTable = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartShortNames().toArray(new String[] {})); |
|
89 |
|
|
90 |
LexicalTable table = new LexicalTable(partition, analysisProperty, fMin, vMax, iTable); |
|
91 |
//System.out.println("time build table lexical "+(System.currentTimeMillis()-time)); |
|
92 |
return table; |
|
93 |
} |
|
94 |
|
|
95 |
/** |
|
96 |
* |
|
97 |
* @param subcorpus |
|
98 |
* @param property |
|
99 |
* @return |
|
100 |
* @throws Exception |
|
101 |
*/ |
|
102 |
public static LexicalTable getLexicalTable(Subcorpus subcorpus, Property property) throws Exception { |
|
103 |
return new LexicalTable(subcorpus, property); |
|
104 |
} |
|
105 |
} |
|
0 | 106 |
tmp/org.txm.cah.core/src/org/txm/cah/core/functions/AHC.java (revision 615) | ||
---|---|---|
217 | 217 |
protected static int nocah = 1; |
218 | 218 |
|
219 | 219 |
@Override |
220 |
protected boolean _compute(boolean update) {
|
|
220 |
protected boolean _compute() { |
|
221 | 221 |
|
222 | 222 |
|
223 | 223 |
Log.info("Computing CAH..."); |
224 | 224 |
try { |
225 | 225 |
|
226 | 226 |
// compute the lexical table |
227 |
this.table.compute(update);
|
|
227 |
this.table.compute(); |
|
228 | 228 |
|
229 | 229 |
|
230 | 230 |
RWorkspace rw = RWorkspace.getRWorkspaceInstance(); |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages_fr.properties (revision 615) | ||
---|---|---|
4 | 4 |
ProgressionDialog_10 = Progression : mauvaise expression régulière : |
5 | 5 |
ProgressionDialog_11 = Échelle des bandeaux |
6 | 6 |
ProgressionDialog_13 = Options d'affichage |
7 |
ProgressionDialog_14 = Style de ligne unique
|
|
7 |
ProgressionDialog_14 = Styles de ligne multiples
|
|
8 | 8 |
ProgressionDialog_15 = Répéter les valeurs identiques |
9 | 9 |
ProgressionDialog_16 = N/B |
10 | 10 |
ProgressionDialog_17 = Erreur : multiplicateur de bande : |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/messages/messages.properties (revision 615) | ||
---|---|---|
1 | 1 |
|
2 |
ProgressionDialog_0 = Progression Parameters |
|
3 |
|
|
4 |
ProgressionDialog_1 = Graph type: |
|
5 |
|
|
2 |
ProgressionDialog_0 = Progression Parameters |
|
3 |
ProgressionDialog_1 = Graph type: |
|
6 | 4 |
ProgressionDialog_10 = Progression dialog: wrong regular expression: |
7 |
|
|
8 | 5 |
ProgressionDialog_11 = Bandewidth multiplier: |
9 |
|
|
10 | 6 |
ProgressionDialog_13 = Display options |
11 |
|
|
12 |
ProgressionDialog_14 = Single line style |
|
13 |
|
|
7 |
ProgressionDialog_14 = Multiple line styles |
|
14 | 8 |
ProgressionDialog_15 = Repeat same values |
15 |
|
|
16 | 9 |
ProgressionDialog_16 = Monochrome |
17 |
|
|
18 | 10 |
ProgressionDialog_17 = Strip multiplier error: |
11 |
ProgressionDialog_2 = cumulative |
|
12 |
ProgressionDialog_3 = density |
|
13 |
ProgressionDialog_4 = Structural Unit: |
|
14 |
ProgressionDialog_5 = delete |
|
15 |
ProgressionDialog_7 = Regex: |
|
16 |
ProgressionDialog_8 = Queries: |
|
17 |
ProgressionDialog_9 = add a query |
|
19 | 18 |
|
20 |
ProgressionDialog_2 = cumulative |
|
21 |
|
|
22 |
ProgressionDialog_3 = density |
|
23 |
|
|
24 |
ProgressionDialog_4 = Structural Unit: |
|
25 |
|
|
26 |
ProgressionDialog_5 = delete |
|
27 |
|
|
28 |
ProgressionDialog_7 = Regex: |
|
29 |
|
|
30 |
ProgressionDialog_8 = Queries: |
|
31 |
|
|
32 |
ProgressionDialog_9 = add a query |
|
33 |
|
|
34 | 19 |
ProgressionPreferencePage_3 = Default graph type is cumulative |
35 |
|
|
36 | 20 |
ProgressionPreferencePage_5 = Single line style |
37 |
|
|
38 | 21 |
ProgressionPreferencePage_6 = Repeat the values of the structure properties |
39 |
|
|
40 | 22 |
ProgressionPreferencePage_7 = Bande size multiplier |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/editors/ProgressionEditor.java (revision 615) | ||
---|---|---|
8 | 8 |
import java.util.regex.Pattern; |
9 | 9 |
import java.util.regex.PatternSyntaxException; |
10 | 10 |
|
11 |
import org.eclipse.jface.viewers.ComboViewer; |
|
11 | 12 |
import org.eclipse.swt.SWT; |
12 | 13 |
import org.eclipse.swt.custom.ScrolledComposite; |
13 |
import org.eclipse.swt.events.KeyEvent; |
|
14 |
import org.eclipse.swt.events.KeyListener; |
|
15 | 14 |
import org.eclipse.swt.events.SelectionEvent; |
16 | 15 |
import org.eclipse.swt.events.SelectionListener; |
17 |
import org.eclipse.swt.layout.FormAttachment; |
|
18 |
import org.eclipse.swt.layout.FormData; |
|
19 |
import org.eclipse.swt.layout.FormLayout; |
|
20 | 16 |
import org.eclipse.swt.layout.GridData; |
21 | 17 |
import org.eclipse.swt.layout.GridLayout; |
22 | 18 |
import org.eclipse.swt.widgets.Button; |
23 |
import org.eclipse.swt.widgets.Combo; |
|
24 | 19 |
import org.eclipse.swt.widgets.Composite; |
20 |
import org.eclipse.swt.widgets.Control; |
|
25 | 21 |
import org.eclipse.swt.widgets.Display; |
26 | 22 |
import org.eclipse.swt.widgets.Event; |
27 | 23 |
import org.eclipse.swt.widgets.Label; |
28 | 24 |
import org.eclipse.swt.widgets.Listener; |
29 | 25 |
import org.eclipse.swt.widgets.Text; |
26 |
import org.txm.chartsengine.core.preferences.ChartsEnginePreferences; |
|
30 | 27 |
import org.txm.chartsengine.r.core.themes.DefaultTheme; |
31 | 28 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
32 |
import org.txm.core.messages.TXMCoreMessages;
|
|
29 |
import org.txm.core.results.Parameter;
|
|
33 | 30 |
import org.txm.progression.core.functions.Progression; |
34 | 31 |
import org.txm.progression.core.preferences.ProgressionPreferences; |
35 | 32 |
import org.txm.progression.rcp.messages.ProgressionUIMessages; |
36 | 33 |
import org.txm.rcp.IImageKeys; |
37 |
import org.txm.rcp.RCPMessages; |
|
38 | 34 |
import org.txm.rcp.StatusLine; |
35 |
import org.txm.rcp.editors.TXMEditorPart; |
|
36 |
import org.txm.rcp.editors.listeners.ComputeKeyListener; |
|
37 |
import org.txm.rcp.editors.listeners.ComputeSelectionListener; |
|
39 | 38 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
39 |
import org.txm.rcp.swt.widget.StructuralUnitsGroup; |
|
40 | 40 |
import org.txm.searchengine.cqp.corpus.Corpus; |
41 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
|
42 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
|
43 | 41 |
import org.txm.searchengine.cqp.corpus.query.Query; |
44 | 42 |
import org.txm.utils.logger.Log; |
45 | 43 |
|
... | ... | |
54 | 52 |
/** The query widgets. */ |
55 | 53 |
protected List<QueryField> queryWidgets = new ArrayList<QueryField>(); |
56 | 54 |
|
57 |
/** The queries. */ |
|
58 |
List<Query> queries; |
|
59 |
|
|
60 | 55 |
/** The corpus. */ |
61 | 56 |
private Corpus corpus; |
62 | 57 |
|
63 |
/** The selected structural unit. */ |
|
64 |
private StructuralUnit selectedStructuralUnit; |
|
65 |
|
|
66 |
/** The selected structural unit property. */ |
|
67 |
private StructuralUnitProperty selectedStructuralUnitProperty; |
|
68 |
|
|
69 |
/** The regexproperty value. */ |
|
70 |
private String regexPropertyValue; |
|
71 |
|
|
72 | 58 |
/** The graphtype. */ |
73 | 59 |
private boolean cumulative = true; |
74 | 60 |
|
75 |
/** The monostyle. */ |
|
76 |
private boolean monostyle = true; |
|
77 |
|
|
78 | 61 |
/** The linewidth. */ |
79 | 62 |
private int lineWidth = 2; |
80 | 63 |
|
81 |
/** The structural units combo. */ |
|
82 |
Combo structuralUnitsCombo; |
|
83 |
|
|
84 |
/** The structural units. */ |
|
85 |
List<StructuralUnit> structuralUnits; |
|
86 |
|
|
87 |
/** The structural units properties. */ |
|
88 |
List<StructuralUnitProperty> structuralUnitsProperties; |
|
89 |
|
|
90 |
/** The property combo. */ |
|
91 |
private Combo propertyCombo; |
|
92 |
|
|
93 |
/** The regex value. */ |
|
94 |
private Text regexValue; |
|
95 |
|
|
96 | 64 |
/** The focus composite. */ |
97 | 65 |
Composite queriesFocusComposite; |
98 | 66 |
|
... | ... | |
105 | 73 |
/** The cumu button. */ |
106 | 74 |
Button cumuButton; |
107 | 75 |
|
108 |
/** The repeat button. */ |
|
109 |
Button repeatButton; |
|
110 |
|
|
111 |
/** The style button. */ |
|
112 |
Button styleButton; |
|
113 |
|
|
114 | 76 |
/** The colors. */ |
115 | 77 |
String[] colors = DefaultTheme.colors; |
116 | 78 |
|
... | ... | |
122 | 84 |
private Button densityButton; |
123 | 85 |
|
124 | 86 |
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
/** |
|
91 |
* Queries. |
|
92 |
*/ |
|
93 |
@Parameter(key=ProgressionPreferences.QUERIES) |
|
94 |
protected List<Query> queries; |
|
95 |
|
|
96 |
/** |
|
97 |
* Structural unit. |
|
98 |
*/ |
|
99 |
@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT) |
|
100 |
protected ComboViewer structuralUnitsComboViewer; |
|
101 |
|
|
102 |
/** |
|
103 |
* Structural unit property. |
|
104 |
*/ |
|
105 |
@Parameter(key=ProgressionPreferences.STRUCTURAL_UNIT_PROPERTY) |
|
106 |
protected ComboViewer structuralUnitPropertiesComboViewer; |
|
107 |
|
|
108 |
/** |
|
109 |
* Property REGEX. |
|
110 |
*/ |
|
111 |
@Parameter(key=ProgressionPreferences.PROPERTY_REGEX) |
|
112 |
protected Text propertyRegex; |
|
113 |
|
|
114 |
/** |
|
115 |
* Mono style. Same lines styles. |
|
116 |
*/ |
|
117 |
@Parameter(key=ChartsEnginePreferences.MULTIPLE_LINE_STROKES) |
|
118 |
protected Button multipleLineStrokes; |
|
119 |
|
|
120 |
/** |
|
121 |
* Repeats or not the same value when displaying the section markers. |
|
122 |
*/ |
|
123 |
@Parameter(key=ProgressionPreferences.REPEAT_SAME_VALUES) |
|
124 |
protected Button repeatSameValues; |
|
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
129 |
|
|
125 | 130 |
@Override |
126 | 131 |
public void _createPartControl(Composite parent) { |
127 |
super._createPartControl(parent); |
|
132 |
//super._createPartControl(parent);
|
|
128 | 133 |
|
129 | 134 |
|
130 | 135 |
// FIXME: tests parameters composite extension |
... | ... | |
171 | 176 |
|
172 | 177 |
try { |
173 | 178 |
|
174 |
monostyle = this.getBooleanParameterValue(ProgressionPreferences.CHART_MONO_STYLE); |
|
175 | 179 |
cumulative = this.getBooleanParameterValue(ProgressionPreferences.CHART_CUMULATIVE); |
176 | 180 |
|
177 | 181 |
// System.out.println(parent.getLayout()); |
... | ... | |
232 | 236 |
bandeField.setText("" + this.getResultData().getBandeMultiplier()); //$NON-NLS-1$ |
233 | 237 |
bandeField.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
234 | 238 |
|
235 |
// Structural units |
|
236 |
// Group displayParam = new Group(paramPanel, SWT.BORDER); |
|
237 |
// displayParam.setText(ProgressionUIMessages.ProgressionDialog_13); |
|
238 |
// displayParam.setLayout(new GridLayout(3, true)); |
|
239 |
// displayParam.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 3, 1)); |
|
239 |
// Structural units and properties combo viewers |
|
240 |
StructuralUnitsGroup structuration = new StructuralUnitsGroup(this, true, this.getResultData().getStructuralUnit(), this.getResultData().getStructuralUnitProperty(), paramPanel, SWT.NONE); |
|
241 |
|
|
242 |
// Structural Unit |
|
243 |
structuralUnitsComboViewer = structuration.getStructuralUnitsComboViewer(); |
|
244 |
|
|
245 |
// Structural Unit Property |
|
246 |
structuralUnitPropertiesComboViewer = structuration.getStructuralUnitPropertiesComboViewer(); |
|
247 |
|
|
240 | 248 |
|
241 |
Label structLabel = new Label(paramPanel, SWT.NONE); |
|
242 |
structLabel.setText(ProgressionUIMessages.ProgressionDialog_4); |
|
243 |
structLabel.setAlignment(SWT.CENTER); |
|
244 |
|
|
245 |
structuralUnitsCombo = new Combo(paramPanel, SWT.READ_ONLY); |
|
246 |
structuralUnitsCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
247 |
|
|
248 |
structuralUnitsCombo.addSelectionListener(new SelectionListener() { |
|
249 |
@Override |
|
250 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
251 |
} |
|
252 |
|
|
253 |
@Override |
|
254 |
public void widgetSelected(SelectionEvent event) { |
|
255 |
getSite().getShell().getDisplay().syncExec(new Runnable() { |
|
256 |
@Override |
|
257 |
public void run() { |
|
258 |
|
|
259 |
StructuralUnit su = null; |
|
260 |
if(structuralUnitsCombo.getSelectionIndex() != 0) { |
|
261 |
su = structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1); |
|
262 |
} |
|
263 |
|
|
264 |
// skip if no change |
|
265 |
if(su == getResultData().getStructure()) { |
|
266 |
return; |
|
267 |
} |
|
268 |
|
|
269 |
reloadSUProperties(); |
|
270 |
getResultData().setStructuralUnit(su); |
|
271 |
compute(true); |
|
272 |
} |
|
273 |
}); |
|
274 |
} |
|
275 |
}); |
|
276 |
|
|
277 |
|
|
278 |
int selectedSUIndex = 0; |
|
279 |
// get |
|
280 |
try { |
|
281 |
structuralUnitsCombo.add(" "); //$NON-NLS-1$ |
|
282 |
structuralUnits = this.getResultData().getCorpus().getOrderedStructuralUnits(); |
|
283 |
for(int i = 0; i < structuralUnits.size(); i++) { |
|
284 |
structuralUnitsCombo.add(structuralUnits.get(i).getName()); |
|
285 |
if(getResultData().getStructure() == structuralUnits.get(i)) { |
|
286 |
selectedSUIndex = (i + 1); |
|
287 |
} |
|
288 |
} |
|
289 |
} catch (Exception e) { |
|
290 |
Log.severe(RCPMessages.ERROR + Log.toString(e)); |
|
291 |
e.printStackTrace(); |
|
292 |
} |
|
293 |
structuralUnitsCombo.select(selectedSUIndex); |
|
294 |
|
|
295 |
// Structural unit properties |
|
296 |
Label propLabel = new Label(paramPanel, SWT.NONE); |
|
297 |
propLabel.setText(TXMCoreMessages.PROPERTY_1); |
|
298 |
propLabel.setAlignment(SWT.CENTER); |
|
299 |
|
|
300 |
propertyCombo = new Combo(paramPanel, SWT.READ_ONLY); |
|
301 |
propertyCombo.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
302 |
reloadSUProperties(); |
|
303 |
|
|
304 |
propertyCombo.addSelectionListener(new SelectionListener() { |
|
305 |
@Override |
|
306 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
307 |
} |
|
308 |
|
|
309 |
@Override |
|
310 |
public void widgetSelected(SelectionEvent event) { |
|
311 |
StructuralUnitProperty sup = null; |
|
312 |
if(propertyCombo.getSelectionIndex() != 0) { |
|
313 |
sup = structuralUnitsProperties.get(propertyCombo.getSelectionIndex() - 1); |
|
314 |
} |
|
315 |
//getResultData().setStructuralUnitProperty(sup); |
|
316 |
compute(true); |
|
317 |
} |
|
318 |
}); |
|
319 |
|
|
320 |
|
|
321 |
|
|
322 |
// property value field |
|
323 |
Label regexLabel = new Label(paramPanel, SWT.NONE); |
|
249 |
// property REGEX |
|
250 |
Label regexLabel = new Label(structuration, SWT.NONE); |
|
324 | 251 |
regexLabel.setText(ProgressionUIMessages.ProgressionDialog_7); |
325 | 252 |
regexLabel.setAlignment(SWT.CENTER); |
326 | 253 |
|
327 |
regexValue = new Text(paramPanel, SWT.SINGLE | SWT.BORDER); |
|
328 |
regexValue.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
329 |
if(this.getResultData().getPropertyRegex() != null) { |
|
330 |
regexValue.setText(getResultData().getPropertyRegex()); |
|
331 |
} |
|
254 |
propertyRegex = new Text(structuration, SWT.SINGLE | SWT.BORDER); |
|
255 |
// FIXME: layout |
|
256 |
//propertyRegex.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); |
|
257 |
propertyRegex.addKeyListener(new ComputeKeyListener(this)); |
|
332 | 258 |
|
333 |
//spacer |
|
334 |
styleButton = new Button(paramPanel, SWT.CHECK); |
|
335 |
styleButton.setText(ProgressionUIMessages.ProgressionDialog_14); |
|
336 |
styleButton.setSelection(monostyle); |
|
259 |
|
|
260 |
// Repeat same values in part markers |
|
261 |
repeatSameValues = new Button(structuration, SWT.CHECK); |
|
262 |
repeatSameValues.setText(ProgressionUIMessages.ProgressionDialog_15); |
|
263 |
repeatSameValues.addSelectionListener(new ComputeSelectionListener(this)); |
|
264 |
|
|
265 |
|
|
266 |
// Lines styles |
|
267 |
multipleLineStrokes = new Button(paramPanel, SWT.CHECK); |
|
268 |
multipleLineStrokes.setText(ProgressionUIMessages.ProgressionDialog_14); |
|
269 |
multipleLineStrokes.addSelectionListener(new ComputeSelectionListener(this)); |
|
270 |
|
|
337 | 271 |
|
338 |
//Repeat options |
|
339 |
repeatButton = new Button(paramPanel, SWT.CHECK); |
|
340 |
repeatButton.setText(ProgressionUIMessages.ProgressionDialog_15); |
|
341 |
repeatButton.setSelection(this.getResultData().isRepeatingValues()); |
|
342 |
repeatButton.addSelectionListener(new SelectionListener() { |
|
343 |
|
|
344 |
@Override |
|
345 |
public void widgetSelected(SelectionEvent e) { |
|
346 |
//getResultData().setRepeatValues(repeatButton.getSelection()); |
|
347 |
compute(true); |
|
348 |
} |
|
349 |
|
|
350 |
@Override |
|
351 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
352 |
// TODO Auto-generated method stub |
|
353 |
|
|
354 |
} |
|
355 |
}); |
|
356 |
|
|
357 |
|
|
358 | 272 |
// Queries |
359 | 273 |
sc1 = new ScrolledComposite(mainPanel, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); |
360 | 274 |
glayout = new GridLayout(1, true); |
... | ... | |
372 | 286 |
sc1.setContent(queriesFocusComposite); |
373 | 287 |
|
374 | 288 |
// queries parameters |
289 |
// FIXME: useless? |
|
375 | 290 |
// Label focusLabel = new Label(queriesFocusComposite, SWT.NONE); |
376 | 291 |
// focusLabel.setText(ProgressionUIMessages.ProgressionDialog_8); |
377 | 292 |
// focusLabel.setAlignment(SWT.CENTER); |
378 | 293 |
|
379 | 294 |
// add query button |
380 | 295 |
Button plusButton = new Button(queriesFocusComposite, SWT.NONE); |
381 |
plusButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, |
|
382 |
true, false)); |
|
296 |
plusButton.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); |
|
383 | 297 |
plusButton.setText(ProgressionUIMessages.ProgressionDialog_9); |
384 | 298 |
|
385 | 299 |
plusButton.addListener(SWT.Selection, new Listener() { |
... | ... | |
395 | 309 |
} |
396 | 310 |
}); |
397 | 311 |
|
398 |
// fill fields from result data |
|
399 |
queries = this.getResultData().getQueries(); |
|
400 |
if (queries == null) { |
|
401 |
addFocusQueryField(); |
|
402 |
} |
|
403 |
else { |
|
404 |
for (Query q : queries) { |
|
405 |
addFocusQueryField().setQuery(q.getQueryString()); |
|
406 |
} |
|
407 |
} |
|
408 | 312 |
|
409 |
|
|
410 | 313 |
} catch (Exception e) { |
411 | 314 |
Log.printStackTrace(e); |
412 | 315 |
} |
... | ... | |
414 | 317 |
|
415 | 318 |
} |
416 | 319 |
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
/** |
|
324 |
* |
|
325 |
* @author mdecorde |
|
326 |
* |
|
327 |
*/ |
|
417 | 328 |
public class QueryField extends Composite { |
418 | 329 |
|
419 | 330 |
protected AssistedQueryWidget focusTextBox; |
420 | 331 |
|
332 |
protected TXMEditorPart editor; |
|
333 |
|
|
334 |
/** |
|
335 |
* |
|
336 |
* @param editor |
|
337 |
* @param parent |
|
338 |
* @param style |
|
339 |
*/ |
|
421 | 340 |
public QueryField(Composite parent, int style) { |
422 | 341 |
super(parent, style); |
423 |
|
|
342 |
|
|
424 | 343 |
GridLayout glayout = new GridLayout(2, false); |
425 | 344 |
glayout.marginBottom = glayout.marginTop = glayout.marginHeight = glayout.verticalSpacing = 0; |
426 | 345 |
|
... | ... | |
432 | 351 |
focusTextBox.setFocus(); |
433 | 352 |
focusTextBox.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); |
434 | 353 |
|
435 |
focusTextBox.addKeyListener(new KeyListener() { |
|
436 |
@Override |
|
437 |
public void keyPressed(KeyEvent e) { |
|
438 |
// System.out.println("key pressed : "+e.keyCode); |
|
439 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
|
440 |
updateResultFromEditor(); |
|
441 |
compute(false); |
|
442 |
} |
|
443 |
} |
|
354 |
// listener |
|
355 |
focusTextBox.addKeyListener(new ComputeKeyListener(ProgressionEditor.this)); |
|
444 | 356 |
|
445 |
@Override |
|
446 |
public void keyReleased(KeyEvent e) { |
|
447 |
} |
|
448 |
}); |
|
449 |
|
|
450 | 357 |
// delete query button |
451 | 358 |
Button minusButton = new Button(this, SWT.NONE); |
452 | 359 |
minusButton.setLayoutData(new GridData(GridData.CENTER, GridData.CENTER, false, false)); |
... | ... | |
454 | 361 |
minusButton.addListener(SWT.Selection, new Listener() { |
455 | 362 |
@Override |
456 | 363 |
public void handleEvent(Event event) { |
457 |
if (queryWidgets.size() > 0) {
|
|
364 |
if (queryWidgets.size() > 1) {
|
|
458 | 365 |
// System.out.println("remove field"); |
459 | 366 |
QueryField lastwidget = QueryField.this; |
460 | 367 |
lastwidget.setSize(200, 30); |
... | ... | |
469 | 376 |
} |
470 | 377 |
|
471 | 378 |
public void setQuery(String query) { |
472 |
|
|
379 |
focusTextBox.setText(query); |
|
473 | 380 |
} |
474 | 381 |
|
475 | 382 |
public Query getQuery() { |
... | ... | |
482 | 389 |
} |
483 | 390 |
|
484 | 391 |
/** |
485 |
* Reloads the properties of the current selected structural unit. |
|
486 |
*/ |
|
487 |
// FIXME: mutualize this method, its used for some other editors |
|
488 |
private void reloadSUProperties() { |
|
489 |
|
|
490 |
propertyCombo.removeAll(); |
|
491 |
propertyCombo.add(" "); //$NON-NLS-1$ |
|
492 |
|
|
493 |
int selectedSUPIndex = 0; |
|
494 |
|
|
495 |
if (structuralUnitsCombo.getSelectionIndex() > 0) { |
|
496 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1); |
|
497 |
structuralUnitsProperties = selectedStructuralUnit.getOrderedProperties(); |
|
498 |
|
|
499 |
for(int i = 0; i < structuralUnitsProperties.size(); i++) { |
|
500 |
propertyCombo.add(structuralUnitsProperties.get(i).getName()); |
|
501 |
if(getResultData().getProperty() == structuralUnitsProperties.get(i)) { |
|
502 |
selectedSUPIndex = (i + 1); |
|
503 |
} |
|
504 |
} |
|
505 |
} |
|
506 |
if (propertyCombo.getItemCount() > 0) { |
|
507 |
propertyCombo.select(selectedSUPIndex); |
|
508 |
} |
|
509 |
} |
|
510 |
|
|
511 |
/** |
|
512 | 392 |
* Adds a query field. |
513 | 393 |
* |
514 | 394 |
* @return the assisted query widget |
515 | 395 |
*/ |
516 | 396 |
private QueryField addFocusQueryField(String text) { |
517 |
QueryField queryField = new QueryField(queriesFocusComposite, SWT.NONE); |
|
397 |
|
|
398 |
// do not add same query twice |
|
399 |
for (int i = 0; i < queryWidgets.size(); i++) { |
|
400 |
|
|
401 |
if(queryWidgets.get(i).getQuery().getQueryString().equals(text) |
|
402 |
|| (queryWidgets.get(i).getQuery().getQueryString().equals("\"\"") && text.isEmpty())) { |
|
403 |
return null; |
|
404 |
} |
|
405 |
} |
|
406 |
|
|
407 |
QueryField queryField = new QueryField(this.queriesFocusComposite, SWT.NONE); |
|
408 |
queryField.setQuery(text); |
|
518 | 409 |
GridData gridData = new GridData(GridData.FILL, GridData.FILL, true, false); |
519 | 410 |
queryField.setLayoutData(gridData); |
520 | 411 |
|
412 |
this.queriesFocusComposite.layout(true); |
|
413 |
|
|
521 | 414 |
return queryField; |
522 | 415 |
} |
523 | 416 |
|
... | ... | |
530 | 423 |
} |
531 | 424 |
|
532 | 425 |
|
426 |
@Override |
|
427 |
public void updateEditorFromResult(boolean update) { |
|
428 |
|
|
429 |
// create the queries fields |
|
430 |
if (queries == null) { |
|
431 |
addFocusQueryField(); |
|
432 |
} |
|
433 |
else { |
|
434 |
for (Query q : queries) { |
|
435 |
addFocusQueryField(q.getQueryString()); |
|
436 |
} |
|
437 |
} |
|
438 |
} |
|
439 |
|
|
533 | 440 |
|
534 | 441 |
@Override |
535 | 442 |
public void updateResultFromEditor() { |
536 | 443 |
|
537 |
Display.getDefault().syncExec(new Runnable() { |
|
538 |
@Override |
|
539 |
public void run() { |
|
444 |
// Display.getDefault().syncExec(new Runnable() {
|
|
445 |
// @Override
|
|
446 |
// public void run() {
|
|
540 | 447 |
|
541 | 448 |
queries = new ArrayList<Query>(); |
542 | 449 |
for (QueryField wid : queryWidgets) { |
... | ... | |
546 | 453 |
} |
547 | 454 |
} |
548 | 455 |
|
549 |
if (propertyCombo.getSelectionIndex() > 0) { |
|
550 |
selectedStructuralUnitProperty = structuralUnitsProperties.get(propertyCombo.getSelectionIndex() - 1); |
|
551 |
} |
|
552 |
else { |
|
553 |
selectedStructuralUnitProperty = null; |
|
554 |
} |
|
555 |
if (structuralUnitsCombo.getSelectionIndex() > 0) { |
|
556 |
selectedStructuralUnit = structuralUnits.get(structuralUnitsCombo.getSelectionIndex() - 1); |
|
557 |
} |
|
558 |
else { |
|
559 |
selectedStructuralUnit = null; |
|
560 |
selectedStructuralUnitProperty = null;// need a structuralunit |
|
561 |
} |
|
562 |
|
|
563 |
try { |
|
564 |
Pattern.compile(regexValue.getText()); |
|
565 |
regexPropertyValue = regexValue.getText(); |
|
566 |
|
|
567 |
if (regexPropertyValue.length() == 0) { |
|
568 |
regexPropertyValue = null; |
|
569 |
} |
|
570 |
} catch (PatternSyntaxException e) { |
|
571 |
System.out.println(ProgressionUIMessages.ProgressionDialog_10 + e); |
|
572 |
} |
|
573 |
|
|
574 | 456 |
cumulative = cumuButton.getSelection(); |
575 |
monostyle = styleButton.getSelection(); |
|
457 |
|
|
576 | 458 |
String smultibande = bandeField.getText(); |
577 | 459 |
float bandeMultiplier = 1.0f; |
578 | 460 |
if (smultibande != null && smultibande.length() > 0) { |
... | ... | |
580 | 462 |
bandeMultiplier = Float.parseFloat(smultibande); |
581 | 463 |
} catch(Exception e) { |
582 | 464 |
bandeMultiplier = 1.0f; |
583 |
System.out.println(ProgressionUIMessages.ProgressionDialog_17+e);
|
|
584 |
StatusLine.error(ProgressionUIMessages.ProgressionDialog_17+e);
|
|
465 |
System.out.println(ProgressionUIMessages.ProgressionDialog_17 + e);
|
|
466 |
StatusLine.error(ProgressionUIMessages.ProgressionDialog_17 + e);
|
|
585 | 467 |
} |
586 | 468 |
} |
587 | 469 |
else { |
588 | 470 |
bandeMultiplier = 1.0f; |
589 | 471 |
} |
472 |
//getResultData().setParameters(queries, selectedStructuralUnit, selectedStructuralUnitProperty, regexPropertyValue, cumulative, lineWidth, repeatButton.getSelection(), bandeMultiplier); |
|
473 |
// } |
|
474 |
// }); |
|
590 | 475 |
|
591 |
((Progression)getResultData()).setParameters(queries, selectedStructuralUnit, selectedStructuralUnitProperty, regexPropertyValue, cumulative, lineWidth, repeatButton.getSelection(), bandeMultiplier); |
|
592 |
} |
|
593 |
}); |
|
594 |
|
|
595 | 476 |
} |
596 | 477 |
|
597 | 478 |
} |
tmp/org.txm.progression.rcp/src/org/txm/progression/rcp/preferences/ProgressionPreferencePage.java (revision 615) | ||
---|---|---|
63 | 63 |
Composite chartsTab = SWTChartsComponentsProvider.createChartsRenderingPreferencesTabFolderComposite(this.getFieldEditorParent()); |
64 | 64 |
|
65 | 65 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_CUMULATIVE, ProgressionUIMessages.ProgressionPreferencePage_3, chartsTab)); |
66 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.CHART_MONO_STYLE, ProgressionUIMessages.ProgressionPreferencePage_5, chartsTab)); |
|
67 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab)); |
|
66 |
this.addField(new BooleanFieldEditor(ProgressionPreferences.REPEAT_SAME_VALUES, ProgressionUIMessages.ProgressionPreferencePage_6, chartsTab)); |
|
68 | 67 |
|
69 | 68 |
DoubleFieldEditor bandemultiplierfield = new DoubleFieldEditor(ProgressionPreferences.BANDE_MULTIPLIER, ProgressionUIMessages.ProgressionPreferencePage_7, chartsTab); |
70 | 69 |
this.addField(bandemultiplierfield); |
tmp/org.txm.index.core/groovy/org/txm/test/TestIndex.java (revision 615) | ||
---|---|---|
62 | 62 |
|
63 | 63 |
Index index = new Index(corpus); |
64 | 64 |
index.setParameters(query, properties, null, null, null, null); |
65 |
index.compute(false);
|
|
65 |
index.compute(); |
|
66 | 66 |
index.getAllLines(); |
67 | 67 |
|
68 | 68 |
if (sortBy != null) { |
... | ... | |
90 | 90 |
|
91 | 91 |
Index index = new Index(partition); |
92 | 92 |
index.setParameters(query, properties, null, null, null, null); |
93 |
index.compute(false);
|
|
93 |
index.compute(); |
|
94 | 94 |
index.getAllLines(); |
95 | 95 |
|
96 | 96 |
if (sortBy != null) { |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 615) | ||
---|---|---|
188 | 188 |
} |
189 | 189 |
|
190 | 190 |
@Override |
191 |
protected boolean _compute(boolean update) throws Exception {
|
|
191 |
protected boolean _compute() throws Exception { |
|
192 | 192 |
lines.clear(); |
193 | 193 |
counts.clear(); |
194 | 194 |
partnames.clear(); |
tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesSelectionEditor.java (revision 615) | ||
---|---|---|
25 | 25 |
|
26 | 26 |
@Override |
27 | 27 |
public void _createPartControl(Composite parent) { |
28 |
super._createPartControl(parent); |
|
29 | 28 |
|
30 | 29 |
// Group bars by lines |
31 | 30 |
final ToolItem groupBarsByLines = new ToolItem(this.getToolBar(), SWT.CHECK); |
tmp/org.txm.chartsengine.jfreechart.rcp/src/org/txm/chartsengine/jfreechart/rcp/swt/JFCComposite.java (revision 615) | ||
---|---|---|
267 | 267 |
public void loadChart(Object data) { |
268 | 268 |
this.getChartPanel().setChart((JFreeChart) data); |
269 | 269 |
|
270 |
// FIXME: for updating chart. The problem here is the theme is applied twice? one time at the creation and onn time at the update?
|
|
271 |
((JFCChartsEngine) this.chartEditor.getChartsEngine()).getJFCTheme().applyThemeToChart(this.chartEditor.getResultData()); |
|
270 |
// FIXME: for updating chart. The problem here is the theme is applied twice? one time at the creation and one time at the update?
|
|
271 |
//((JFCChartsEngine) this.chartEditor.getChartsEngine()).getJFCTheme().applyThemeToChart(this.chartEditor.getResultData());
|
|
272 | 272 |
|
273 | 273 |
// FIXME: tests, restore the zoom from local node |
274 | 274 |
//this.zoom(x, y, zoomIn); |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 615) | ||
---|---|---|
137 | 137 |
} |
138 | 138 |
|
139 | 139 |
@Override |
140 |
protected boolean _compute(boolean update) throws Exception {
|
|
140 |
protected boolean _compute() throws Exception { |
|
141 | 141 |
|
142 |
if (useFactoMineR) { |
|
143 |
r_ca = new FactoMineRCA(this.getLexicalTable().getData()); |
|
142 |
if (this.useFactoMineR) {
|
|
143 |
this.r_ca = new FactoMineRCA(this.getLexicalTable().getData());
|
|
144 | 144 |
} |
145 | 145 |
else { |
146 |
r_ca = new org.txm.ca.core.statsengine.r.functions.CA(this.getLexicalTable().getData()); |
|
146 |
this.r_ca = new org.txm.ca.core.statsengine.r.functions.CA(this.getLexicalTable().getData());
|
|
147 | 147 |
} |
148 | 148 |
|
149 |
r_ca.compute(); |
|
149 |
this.r_ca.compute();
|
|
150 | 150 |
|
151 | 151 |
// in case the lexical table changes |
152 | 152 |
this.getColNames(); |
... | ... | |
782 | 782 |
return sum; |
783 | 783 |
} |
784 | 784 |
|
785 |
/** |
|
786 |
* Use this function to start CA process from a LexicalTable. |
|
787 |
* |
|
788 |
* @throws StatException the stat exception |
|
789 |
* @throws CqiClientException the cqi client exception |
|
790 |
*/ |
|
791 |
public void processFromTable() throws Exception, StatException, CqiClientException { |
|
792 |
this.compute(false); |
|
793 |
} |
|
794 |
|
|
795 | 785 |
|
796 | 786 |
/** |
797 | 787 |
* Exports CA R data to a file |
tmp/org.txm.ca.core/src/org/txm/ca/core/functions/Eigenvalues.java (revision 615) | ||
---|---|---|
83 | 83 |
|
84 | 84 |
|
85 | 85 |
@Override |
86 |
protected boolean _compute(boolean update) throws Exception {
|
|
86 |
protected boolean _compute() throws Exception { |
|
87 | 87 |
// nothing to do |
88 | 88 |
return true; |
89 | 89 |
} |
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/handlers/ComputeAHC.java (revision 615) | ||
---|---|---|
49 | 49 |
import org.txm.chartsengine.rcp.editors.ChartEditorPart; |
50 | 50 |
import org.txm.core.preferences.TXMPreferences; |
51 | 51 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
52 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
|
52 |
import org.txm.lexicaltable.core.functions.___LexicalTableFactory;
|
|
53 | 53 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog; |
54 | 54 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
55 | 55 |
import org.txm.rcp.views.corpora.CorporaView; |
tmp/org.txm.cah.rcp/src/org/txm/cah/rcp/editors/AHCChartEditor.java (revision 615) | ||
---|---|---|
44 | 44 |
@Override |
45 | 45 |
public void _createPartControl(Composite parent) { |
46 | 46 |
|
47 |
super._createPartControl(parent); |
|
48 |
|
|
49 | 47 |
// Extend the chart editor tool bar |
50 | 48 |
ToolItem separator = new ToolItem(this.topToolBar, SWT.SEPARATOR); |
51 | 49 |
|
... | ... | |
170 | 168 |
try { |
171 | 169 |
|
172 | 170 |
this.acquireSemaphore(); |
173 |
getResultData().compute(false, this);
|
|
171 |
getResultData().compute(this); |
|
174 | 172 |
this.releaseSemaphore(); |
175 | 173 |
|
176 | 174 |
if(!update) { |
tmp/org.txm.rcp/plugin.xml (revision 615) | ||
---|---|---|
182 | 182 |
name="ParametersView" |
183 | 183 |
restorable="true"> |
184 | 184 |
</view> |
185 |
<view |
|
186 |
category="org.txm.rcp" |
|
187 |
class="org.txm.rcp.views.cmdparameters.TXMResultDebugView" |
|
188 |
icon="icons/functions/Properties.png" |
|
189 |
id="org.txm.rcp.views.cmdparameters.TXMResultDebugView" |
|
190 |
name="TXMResultDebugView" |
|
191 |
restorable="true"> |
|
192 |
</view> |
|
185 | 193 |
</extension> |
186 | 194 |
<extension |
187 | 195 |
point="org.eclipse.core.runtime.adapters"> |
Formats disponibles : Unified diff