Revision 609
tmp/org.txm.searchengine.cqp.rcp/src/org/txm/searchengine/cqp/rcp/editor/DiagnosticEditor.java (revision 609) | ||
---|---|---|
4 | 4 |
|
5 | 5 |
import org.eclipse.swt.SWT; |
6 | 6 |
import org.eclipse.swt.browser.Browser; |
7 |
import org.eclipse.swt.events.SelectionEvent; |
|
8 |
import org.eclipse.swt.events.SelectionListener; |
|
7 | 9 |
import org.eclipse.swt.layout.GridData; |
8 | 10 |
import org.eclipse.swt.layout.GridLayout; |
9 | 11 |
import org.eclipse.swt.layout.RowData; |
... | ... | |
17 | 19 |
import org.txm.rcp.editors.TXMEditorPart; |
18 | 20 |
import org.txm.searchengine.cqp.CQPPreferences; |
19 | 21 |
|
20 |
public class DiagnosticEditor extends TXMEditorPart { |
|
22 |
public class DiagnosticEditor extends TXMEditorPart<Diagnostic> {
|
|
21 | 23 |
|
22 | 24 |
private Spinner maxScore; |
23 | 25 |
private Browser browser; |
... | ... | |
45 | 47 |
RowData gdata = new RowData(); |
46 | 48 |
gdata.width = 100; |
47 | 49 |
maxScore.setLayoutData(gdata); |
50 |
maxScore.addSelectionListener(new SelectionListener() { |
|
51 |
@Override |
|
52 |
public void widgetSelected(SelectionEvent e) { |
|
53 |
compute(true); |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public void widgetDefaultSelected(SelectionEvent e) { } |
|
58 |
}); |
|
59 |
|
|
48 | 60 |
Composite displayArea = getResultArea(); |
49 | 61 |
displayArea.setLayout(new GridLayout(1, true)); |
50 | 62 |
|
tmp/org.txm.internalview.rcp/src/org/txm/rcp/internal/rcp/handler/ComputeInternalView.java (revision 609) | ||
---|---|---|
12 | 12 |
import org.txm.internal.rcp.editors.InternalViewEditor; |
13 | 13 |
import org.txm.internalview.rcp.Messages; |
14 | 14 |
import org.txm.rcp.StatusLine; |
15 |
import org.txm.rcp.editors.TXMEditorPart; |
|
15 | 16 |
import org.txm.rcp.editors.TXMResultEditorInput; |
16 | 17 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
17 | 18 |
import org.txm.rcp.views.corpora.CorporaView; |
... | ... | |
22 | 23 |
|
23 | 24 |
private IWorkbenchWindow window; |
24 | 25 |
private IStructuredSelection selection; |
25 |
private TXMResultEditorInput editorInput; |
|
26 |
private TXMResultEditorInput<InternalView> editorInput;
|
|
26 | 27 |
|
27 | 28 |
// adds a double click listener to the Corpus View |
28 | 29 |
static { |
... | ... | |
66 | 67 |
return null; |
67 | 68 |
} |
68 | 69 |
|
69 |
editorInput = new TXMResultEditorInput(iview); |
|
70 |
|
|
71 |
IWorkbenchPage page = window.getActivePage(); |
|
72 |
try { |
|
73 |
StatusLine.setMessage(org.txm.rcp.RCPMessages.OK); |
|
74 |
page.openEditor(editorInput, InternalViewEditor.ID); //$NON-NLS-1$ |
|
75 |
|
|
76 |
} catch (PartInitException e) { |
|
77 |
System.err.println(org.txm.rcp.RCPMessages.OK+ e); |
|
78 |
} |
|
79 |
|
|
70 |
TXMEditorPart.openEditor(iview, InternalViewEditor.ID); |
|
80 | 71 |
return null; |
81 | 72 |
} |
82 | 73 |
|
tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java (revision 609) | ||
---|---|---|
96 | 96 |
|
97 | 97 |
/** The matches. */ |
98 | 98 |
List<Match> matches; |
99 |
|
|
99 |
|
|
100 | 100 |
/** The positions. */ |
101 | 101 |
int[] positions; |
102 |
|
|
102 |
|
|
103 | 103 |
/** The nlines. */ |
104 | 104 |
int nlines; |
105 | 105 |
|
... | ... | |
207 | 207 |
protected boolean _compute(boolean update) |
208 | 208 |
{ |
209 | 209 |
try { |
210 |
if (this.parent == null || pQuery == null || pPattern == null || pProperty == null) |
|
211 |
return false; |
|
212 |
if (pPattern.size() == 0) |
|
213 |
return false; |
|
214 |
if (pQuery.getQueryString().equals("")) //$NON-NLS-1$ |
|
215 |
return false; |
|
216 |
|
|
217 | 210 |
if (!getQueryMatches()) |
218 | 211 |
return false; |
219 | 212 |
|
... | ... | |
533 | 526 |
|
534 | 527 |
@Override |
535 | 528 |
public boolean canCompute() { |
536 |
return getCorpus() != null |
|
537 |
&& pQuery != null |
|
538 |
&& !pQuery.isEmpty(); |
|
529 |
|
|
530 |
if (pQuery == null |
|
531 |
|| pQuery.isEmpty()) { |
|
532 |
System.out.println("Empty query"); |
|
533 |
return false; |
|
534 |
} |
|
535 |
if (pPattern == null |
|
536 |
|| pPattern.size() == 0) { |
|
537 |
System.out.println("No reference pattern"); |
|
538 |
return false; |
|
539 |
} |
|
540 |
if (pProperty == null) { |
|
541 |
System.out.println("No property"); |
|
542 |
return false; |
|
543 |
} |
|
544 |
|
|
545 |
return true; |
|
539 | 546 |
} |
540 | 547 |
|
541 | 548 |
@Override |
542 | 549 |
public boolean loadParameters() throws CqiClientException { |
543 | 550 |
this.pQuery = new Query(this.getStringParameterValue(ReferencerPreferences.QUERY)); |
544 |
|
|
551 |
|
|
545 | 552 |
String s = this.getStringParameterValue(ReferencerPreferences.PATTERN); |
546 | 553 |
this.pPattern = StructuralUnitProperty.fromStringToList(getCorpus(), s); |
547 |
|
|
554 |
|
|
548 | 555 |
s = this.getStringParameterValue(ReferencerPreferences.PROPERTY); |
549 | 556 |
this.pProperty = getCorpus().getProperty(s); |
550 |
|
|
551 |
// this.pHierarchicSort = this.getBooleanParameterValue(ReferencerPreferences.SORTBYFREQ);
|
|
557 |
|
|
558 |
//this.pHierarchicSort = this.getBooleanParameterValue(ReferencerPreferences.SORTBYFREQ);
|
|
552 | 559 |
return true; |
553 | 560 |
} |
554 | 561 |
|
... | ... | |
559 | 566 |
return true; |
560 | 567 |
} |
561 | 568 |
|
562 |
|
|
563 |
|
|
564 | 569 |
|
570 |
|
|
571 |
|
|
565 | 572 |
/** |
566 | 573 |
* The Class Line. |
567 | 574 |
*/ |
tmp/org.txm.referencer.core/src/org/txm/functions/referencer/ReferencerPreferences.java (revision 609) | ||
---|---|---|
1 | 1 |
package org.txm.functions.referencer; |
2 | 2 |
|
3 | 3 |
import org.eclipse.core.runtime.preferences.DefaultScope; |
4 |
import org.osgi.framework.FrameworkUtil; |
|
4 | 5 |
import org.osgi.service.prefs.Preferences; |
5 | 6 |
import org.txm.core.preferences.TXMPreferences; |
6 | 7 |
|
7 | 8 |
public class ReferencerPreferences extends TXMPreferences { |
8 | 9 |
|
9 |
public static final String PREFERENCES_NODE = ReferencerPreferences.class.getName();//FrameworkUtil.getBundle(RPreferences.class).getSymbolicName();
|
|
10 |
public static final String PREFERENCES_NODE = FrameworkUtil.getBundle(ReferencerPreferences.class).getSymbolicName();
|
|
10 | 11 |
|
11 |
|
|
12 | 12 |
/** The Constant SORTBYFREQ. */ |
13 | 13 |
//FIXME: to extract to referencer plug-in |
14 | 14 |
public static final String SORTBYFREQ = "sorttype"; //$NON-NLS-1$ |
15 | 15 |
|
16 |
public static final String QUERY = "query"; //$NON-NLS-1$ |
|
17 |
public static final String PROPERTY = "property"; //$NON-NLS-1$ |
|
18 |
public static final String PATTERN = "pattern"; //$NON-NLS-1$ |
|
16 | 19 |
|
17 |
public static final String QUERY = "query"; |
|
18 |
public static final String PROPERTY = "property"; |
|
19 |
public static final String PATTERN = "pattern"; |
|
20 |
|
|
21 | 20 |
@Override |
22 | 21 |
public void initializeDefaultPreferences() { |
23 | 22 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE); |
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 609) | ||
---|---|---|
32 | 32 |
import java.util.List; |
33 | 33 |
|
34 | 34 |
import org.eclipse.core.runtime.IProgressMonitor; |
35 |
import org.eclipse.core.runtime.IStatus; |
|
36 |
import org.eclipse.core.runtime.Status; |
|
37 | 35 |
import org.eclipse.jface.action.MenuManager; |
38 | 36 |
import org.eclipse.jface.operation.IRunnableWithProgress; |
39 | 37 |
import org.eclipse.jface.viewers.TableViewer; |
40 | 38 |
import org.eclipse.osgi.util.NLS; |
41 | 39 |
import org.eclipse.swt.SWT; |
42 | 40 |
import org.eclipse.swt.custom.ScrolledComposite; |
43 |
import org.eclipse.swt.events.ControlAdapter; |
|
44 |
import org.eclipse.swt.events.ControlEvent; |
|
45 | 41 |
import org.eclipse.swt.events.KeyEvent; |
46 | 42 |
import org.eclipse.swt.events.KeyListener; |
47 | 43 |
import org.eclipse.swt.events.SelectionEvent; |
... | ... | |
49 | 45 |
import org.eclipse.swt.graphics.Font; |
50 | 46 |
import org.eclipse.swt.graphics.FontData; |
51 | 47 |
import org.eclipse.swt.graphics.Point; |
52 |
import org.eclipse.swt.graphics.Rectangle; |
|
53 | 48 |
import org.eclipse.swt.layout.FormAttachment; |
54 | 49 |
import org.eclipse.swt.layout.FormData; |
55 | 50 |
import org.eclipse.swt.layout.FormLayout; |
56 | 51 |
import org.eclipse.swt.layout.GridData; |
57 | 52 |
import org.eclipse.swt.layout.GridLayout; |
58 | 53 |
import org.eclipse.swt.layout.RowLayout; |
59 |
import org.eclipse.swt.widgets.Button; |
|
60 | 54 |
import org.eclipse.swt.widgets.Composite; |
61 | 55 |
import org.eclipse.swt.widgets.Display; |
62 | 56 |
import org.eclipse.swt.widgets.Event; |
... | ... | |
83 | 77 |
import org.txm.core.messages.TXMCoreMessages; |
84 | 78 |
import org.txm.core.preferences.TXMPreferences; |
85 | 79 |
import org.txm.core.results.TXMParameters; |
86 |
import org.txm.core.results.TXMResult; |
|
87 |
import org.txm.rcp.JobsTimer; |
|
88 | 80 |
import org.txm.rcp.RCPMessages; |
89 |
import org.txm.rcp.StatusLine; |
|
90 | 81 |
import org.txm.rcp.editors.TXMEditorPart; |
91 | 82 |
import org.txm.rcp.editors.TXMResultEditorInput; |
92 | 83 |
import org.txm.rcp.editors.TableKeyListener; |
... | ... | |
94 | 85 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
95 | 86 |
import org.txm.rcp.swt.widget.EmpantWidget; |
96 | 87 |
import org.txm.rcp.swt.widget.PropertiesSelector; |
97 |
import org.txm.rcp.utils.JobHandler; |
|
98 |
import org.txm.rcp.utils.Logger; |
|
99 | 88 |
import org.txm.rcp.views.QueriesView; |
100 |
import org.txm.searchengine.cqp.CQPEngine; |
|
101 | 89 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
102 | 90 |
import org.txm.searchengine.cqp.corpus.Corpus; |
103 | 91 |
import org.txm.searchengine.cqp.corpus.Property; |
104 |
import org.txm.searchengine.cqp.corpus.query.Query; |
|
105 |
import org.txm.statsengine.core.StatException; |
|
106 | 92 |
import org.txm.statsengine.r.rcp.views.RVariablesView; |
107 | 93 |
import org.txm.utils.logger.Log; |
108 | 94 |
|
... | ... | |
260 | 246 |
public void keyPressed(KeyEvent e) { |
261 | 247 |
// System.out.println("key pressed : "+e.keyCode); |
262 | 248 |
if (e.keyCode == SWT.CR || e.keyCode == SWT.KEYPAD_CR) { |
249 |
cooc.setQuery(queryWidget.getQuery()); |
|
263 | 250 |
compute(true); |
264 | 251 |
} |
265 | 252 |
} |
266 | 253 |
|
267 | 254 |
@Override |
268 |
public void keyReleased(KeyEvent e) { |
|
269 |
} |
|
255 |
public void keyReleased(KeyEvent e) { } |
|
270 | 256 |
}); |
271 | 257 |
|
272 | 258 |
// final Button go = new Button(queryArea, SWT.BOLD); |
... | ... | |
320 | 306 |
public void handleEvent(Event event) { |
321 | 307 |
if (TXMPreferences.getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR, RCPPreferences.PREFERENCES_NODE)) { |
322 | 308 |
compute(true); |
323 |
// FIXME old method |
|
324 |
// TXMEditorPart.compute(CooccurrencesEditor.this.getResultData(), true, CooccurrencesEditor.this); |
|
325 | 309 |
} |
326 | 310 |
} |
327 | 311 |
}); |
... | ... | |
615 | 599 |
|
616 | 600 |
TXMParameters parameters = new TXMParameters(); |
617 | 601 |
parameters.put(CooccurrencePreferences.QUERY, this.queryWidget.getQueryString()); |
618 |
parameters.put(CooccurrencePreferences.PROPERTIES, this.propsArea.getProperties());
|
|
602 |
parameters.put(CooccurrencePreferences.PROPERTIES, new ArrayList<Property>(this.propsArea.getProperties()));
|
|
619 | 603 |
parameters.put(CooccurrencePreferences.STRUCTURE_LIMIT, this.empantPanel.getStruct()); |
620 | 604 |
parameters.put(CooccurrencePreferences.MAX_LEFT, this.empantPanel.getMaxLeft() + 1); |
621 | 605 |
parameters.put(CooccurrencePreferences.MIN_LEFT, this.empantPanel.getMinLeft() + 1); |
... | ... | |
769 | 753 |
|
770 | 754 |
empantPanel.setInfo(txt, tooltip); |
771 | 755 |
|
772 |
System.out.println(""+cooc.getLines()); |
|
773 | 756 |
viewer.setInput(cooc.getLines()); |
774 | 757 |
sort(); |
775 | 758 |
|
776 | 759 |
// Pack the columns |
777 | 760 |
TXMEditorPart.packColumns(viewer); |
778 | 761 |
|
779 |
// FIXME: need to be done in another way with after the |
|
780 |
// plugin split |
|
762 |
// FIXME: need to be done in another way with after the plugin split |
|
781 | 763 |
QueriesView.refresh(); |
782 | 764 |
RVariablesView.refresh(); |
783 | 765 |
|
784 | 766 |
viewer.getTable().setFocus(); |
785 |
|
|
786 | 767 |
} |
787 | 768 |
}); |
788 | 769 |
|
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 609) | ||
---|---|---|
240 | 240 |
|
241 | 241 |
this.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_27); |
242 | 242 |
try { |
243 |
if (lines != null) this.lines.clear(); |
|
244 |
if (allsignaturesstr != null) this.allsignaturesstr.clear(); |
|
245 |
if (conclines != null) this.conclines.clear(); |
|
246 |
if (count != null) this.count.clear(); |
|
247 |
if (counted != null) this.counted.clear(); |
|
248 |
if (counts != null) this.counts.clear(); |
|
249 |
if (dist != null) this.dist.clear(); |
|
250 |
if (distances != null) this.distances.clear(); |
|
251 |
if (distancescounts != null) this.distancescounts.clear(); |
|
252 |
if (indexfreqs != null) this.indexfreqs.clear(); |
|
253 |
if (keysToString != null) this.keysToString.clear(); |
|
254 |
if (occproperties != null) this.occproperties.clear(); |
|
255 |
|
|
243 | 256 |
if (!this.stepQueryLimits()) { |
244 | 257 |
return false; |
245 | 258 |
} |
... | ... | |
271 | 284 |
if (!this.stepGetScores()) { |
272 | 285 |
return false; |
273 | 286 |
} |
287 |
|
|
288 |
this.clearMemory(); |
|
274 | 289 |
this.worked(10); |
275 | 290 |
|
276 | 291 |
} catch(Exception e) { |
... | ... | |
371 | 386 |
|
372 | 387 |
//FIXME: useless? |
373 | 388 |
public void clearMemory() { |
374 |
distances = null; |
|
375 |
distancescounts = null; |
|
376 |
counts = null; |
|
377 |
indexfreqs = null; |
|
378 |
counted = null; |
|
379 |
m1 = null; |
|
380 |
m2 = null; |
|
381 |
m3 = null; |
|
382 |
allsignaturesstr = null; |
|
389 |
if (distances != null) distances.clear(); |
|
390 |
if (distancescounts != null) distancescounts.clear(); |
|
391 |
if (counts != null) counts.clear(); |
|
392 |
if (indexfreqs != null) indexfreqs.clear(); |
|
393 |
if (counted != null) counted.clear(); |
|
394 |
if (m1 != null) m1.clear(); |
|
395 |
if (m2 != null) m2.clear(); |
|
396 |
if (m3 != null) m3.clear(); |
|
397 |
if (allsignaturesstr != null) allsignaturesstr.clear(); |
|
398 |
if (keysToString != null) keysToString.clear(); |
|
399 |
if (occproperties != null) occproperties.clear(); |
|
400 |
if (count != null) count.clear(); |
|
401 |
if (dist != null) dist.clear(); |
|
402 |
if (freq != null) freq.clear(); |
|
403 |
if (scores != null) scores.clear(); |
|
404 |
|
|
383 | 405 |
lt = null; |
384 |
keysToString = null; |
|
385 |
occproperties = null; |
|
386 |
count = null; |
|
387 |
dist = null; |
|
388 |
freq = null; |
|
389 |
scores = null; |
|
390 | 406 |
} |
391 | 407 |
|
392 |
/** |
|
393 |
* Count occ. |
|
394 |
* |
|
395 |
* @param propsvalue the propsvalue |
|
396 |
* @param rightcontext the rightcontext |
|
397 |
*/ |
|
398 |
public void countOcc(Map<Property, List<String>> propsvalue, boolean rightcontext) { |
|
399 |
// System.out.println("countOcc (R="+rightcontext+") "+propsvalue); |
|
400 |
Property key = pProperties.get(0); |
|
401 |
List<String> iterationlist = propsvalue.get(key); |
|
402 |
// pr chq mot |
|
403 |
for (int i = 0; i < iterationlist.size(); i++) { |
|
404 |
// build occ |
|
405 |
String occ = ""; //$NON-NLS-1$ |
|
406 |
for (Property p : pProperties) |
|
407 |
occ += propsvalue.get(p).get(i) + "_"; //$NON-NLS-1$ |
|
408 |
occ = occ.substring(0, occ.length() - 1); |
|
408 |
// /** |
|
409 |
// * Count occ. |
|
410 |
// * |
|
411 |
// * @param propsvalue the propsvalue |
|
412 |
// * @param rightcontext the rightcontext |
|
413 |
// */ |
|
414 |
// public void countOcc(Map<Property, List<String>> propsvalue, boolean rightcontext) { |
|
415 |
// // System.out.println("countOcc (R="+rightcontext+") "+propsvalue); |
|
416 |
// Property key = pProperties.get(0); |
|
417 |
// List<String> iterationlist = propsvalue.get(key); |
|
418 |
// // pr chq mot |
|
419 |
// for (int i = 0; i < iterationlist.size(); i++) { |
|
420 |
// // build occ |
|
421 |
// String occ = ""; //$NON-NLS-1$ |
|
422 |
// for (Property p : pProperties) |
|
423 |
// occ += propsvalue.get(p).get(i) + "_"; //$NON-NLS-1$ |
|
424 |
// occ = occ.substring(0, occ.length() - 1); |
|
425 |
// |
|
426 |
// if (occproperties.get(occ) == null) { |
|
427 |
// ArrayList<String> values = new ArrayList<String>(); |
|
428 |
// for (Property p : pProperties) |
|
429 |
// values.add(propsvalue.get(p).get(i)); |
|
430 |
// occproperties.put(occ, values); |
|
431 |
// } |
|
432 |
// |
|
433 |
// // System.out.println("occ '"+occ+"'"); |
|
434 |
// // update nbocc |
|
435 |
// if (count.get(occ) == null) { |
|
436 |
// count.put(occ, 0); |
|
437 |
// } |
|
438 |
// count.put(occ, count.get(occ) + 1); |
|
439 |
// |
|
440 |
// // update dist |
|
441 |
// if (dist.get(occ) == null) { |
|
442 |
// dist.put(occ, 0.0f); |
|
443 |
// } |
|
444 |
// if (rightcontext) { |
|
445 |
// dist.put(occ, dist.get(occ) + i + 1); |
|
446 |
// } else { |
|
447 |
// dist.put(occ, dist.get(occ) + iterationlist.size() - i); |
|
448 |
// } |
|
449 |
// |
|
450 |
// // update freq |
|
451 |
// if (freq.get(occ) == null) { |
|
452 |
// // System.out.println("compute freq of "+occ); |
|
453 |
// int occfreq = -1; // calcul avec l'index |
|
454 |
// for (org.txm.index.core.functions.Line l : index.getLines(0, index.getV())) { |
|
455 |
// if (l.toString().equals(occ)) { |
|
456 |
// // System.out.println("FOUND "+occ); |
|
457 |
// occfreq = l.getFrequency(); |
|
458 |
// break; |
|
459 |
// } |
|
460 |
// } |
|
461 |
// freq.put(occ, occfreq); |
|
462 |
// } |
|
463 |
// } |
|
464 |
// } |
|
409 | 465 |
|
410 |
if (occproperties.get(occ) == null) { |
|
411 |
ArrayList<String> values = new ArrayList<String>(); |
|
412 |
for (Property p : pProperties) |
|
413 |
values.add(propsvalue.get(p).get(i)); |
|
414 |
occproperties.put(occ, values); |
|
415 |
} |
|
416 |
|
|
417 |
// System.out.println("occ '"+occ+"'"); |
|
418 |
// update nbocc |
|
419 |
if (count.get(occ) == null) { |
|
420 |
count.put(occ, 0); |
|
421 |
} |
|
422 |
count.put(occ, count.get(occ) + 1); |
|
423 |
|
|
424 |
// update dist |
|
425 |
if (dist.get(occ) == null) { |
|
426 |
dist.put(occ, 0.0f); |
|
427 |
} |
|
428 |
if (rightcontext) { |
|
429 |
dist.put(occ, dist.get(occ) + i + 1); |
|
430 |
} else { |
|
431 |
dist.put(occ, dist.get(occ) + iterationlist.size() - i); |
|
432 |
} |
|
433 |
|
|
434 |
// update freq |
|
435 |
if (freq.get(occ) == null) { |
|
436 |
// System.out.println("compute freq of "+occ); |
|
437 |
int occfreq = -1; // calcul avec l'index |
|
438 |
for (org.txm.index.core.functions.Line l : index.getLines(0, index.getV())) { |
|
439 |
if (l.toString().equals(occ)) { |
|
440 |
// System.out.println("FOUND "+occ); |
|
441 |
occfreq = l.getFrequency(); |
|
442 |
break; |
|
443 |
} |
|
444 |
} |
|
445 |
freq.put(occ, occfreq); |
|
446 |
} |
|
447 |
} |
|
448 |
} |
|
449 |
|
|
450 | 466 |
/** |
451 | 467 |
* Gets the corpus. |
452 | 468 |
* |
... | ... | |
763 | 779 |
this.pFCoocFilter = minCof; |
764 | 780 |
this.pIncludeXpivot = includeXpivot; |
765 | 781 |
this.buildLexicalTableWithCooccurrents = buildLexicalTableWithCooccurrents; |
766 |
|
|
767 | 782 |
} |
768 | 783 |
|
769 | 784 |
public void setIncludeXpivot(boolean b) { |
... | ... | |
860 | 875 |
keysToString = new HashMap<String, String>(); |
861 | 876 |
|
862 | 877 |
//time = System.currentTimeMillis(); |
863 |
Index voc = null; |
|
864 | 878 |
for (TXMResult rez : corpus.getChildren(Index.class)) { //TODO: fix usages of index for cooc |
865 | 879 |
Index rezvoc = (Index) rez; |
866 | 880 |
|
867 | 881 |
if (rezvoc.getProperties().equals(pProperties)) { |
868 | 882 |
if (rezvoc.getQuery().equals(new Query(""+pCooccurentQueryFilter+""))) { //$NON-NLS-1$ //$NON-NLS-2$ |
869 | 883 |
if (rezvoc.getFilterFmax() == null) { |
870 |
voc = rezvoc;
|
|
884 |
index = rezvoc;
|
|
871 | 885 |
break; |
872 | 886 |
} |
873 | 887 |
} |
... | ... | |
875 | 889 |
} |
876 | 890 |
if (Thread.interrupted()) return false; // stop if interrupted by user |
877 | 891 |
|
878 |
if (voc == null) {
|
|
892 |
if (index == null) {
|
|
879 | 893 |
try { |
880 |
voc = new Index(corpus); |
|
881 |
voc.setParameters(new Query(pCooccurentQueryFilter), pProperties, null, null, null, null); |
|
882 |
voc.compute(false, monitor); |
|
894 |
index = new Index(corpus); |
|
895 |
index.setParameters(new Query(pCooccurentQueryFilter), pProperties, null, null, null, null); |
|
896 |
if (!index.compute(false, monitor)) { |
|
897 |
System.out.println("Cooccurrence internal Index compute failed. Aborting."); |
|
898 |
return false; |
|
899 |
} |
|
883 | 900 |
} catch (Exception e){ |
884 | 901 |
Log.severe("Error while computing Index for the cooccurrence: "+e.getLocalizedMessage()); |
885 | 902 |
return false; |
... | ... | |
901 | 918 |
|
902 | 919 |
if (Thread.interrupted()) return false; // stop if interrupted by user |
903 | 920 |
|
904 |
List<org.txm.index.core.functions.Line> vocLines = voc.getAllLines();
|
|
921 |
List<org.txm.index.core.functions.Line> vocLines = index.getAllLines();
|
|
905 | 922 |
int[][] freqs; |
906 | 923 |
String[] rownames; |
907 | 924 |
if (buildLexicalTableWithCooccurrents) { |
... | ... | |
944 | 961 |
i++; |
945 | 962 |
} |
946 | 963 |
} |
964 |
index.delete(); // no more needed |
|
965 |
index = null; |
|
947 | 966 |
if (Thread.interrupted()) return false; // stop if interrupted by user |
948 | 967 |
|
949 | 968 |
//time = System.currentTimeMillis(); |
... | ... | |
1232 | 1251 |
((float) (distances.get(signaturestr) / distancescounts |
1233 | 1252 |
.get(signaturestr))) - 1.0f, -1); |
1234 | 1253 |
//System.out.println(cline); |
1235 |
if (cline.freq >= this.pFminFilter && cline.nbocc >= this.pFCoocFilter && Math.abs(cline.score) >= this.pScoreMinFilter)
|
|
1254 |
if (cline.freq >= this.pFminFilter && cline.nbocc >= this.pFCoocFilter && cline.score >= 0 && cline.score >= this.pScoreMinFilter)
|
|
1236 | 1255 |
{ |
1237 | 1256 |
if (cline.score >= Integer.MAX_VALUE - 5) |
1238 | 1257 |
cline.score = Float.MAX_EXPONENT; |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 609) | ||
---|---|---|
133 | 133 |
try { |
134 | 134 |
this.autoLoadParametersFromAnnotations(); // auto fill from Parameter annotations |
135 | 135 |
this.loadParameters(); // subclasses manual settings |
136 |
} |
|
137 |
catch (Exception e) { |
|
136 |
} catch (Exception e) { |
|
138 | 137 |
// TODO Auto-generated catch block |
139 | 138 |
e.printStackTrace(); |
140 | 139 |
} |
... | ... | |
395 | 394 |
/** |
396 | 395 |
* Updates the dirty states by comparing TXMResult @Parameter with previously used parameters in the compute() method. |
397 | 396 |
* |
398 |
* To work correctly the equals method of the TXMResult parameters must be correctly implemented. |
|
397 |
* To work correctly : |
|
398 |
* - the equals method of the TXMResult parameters must be correctly implemented. |
|
399 |
* - the @Parameter member must be another variable (the previous is stored in the lastParameters protected variable) (e.g editing a List @Parameter is not enough for this test) |
|
399 | 400 |
* |
400 | 401 |
* The method is final and don't need to be re-implemented. To ignore this method, don't use the @Parameter annotations |
401 | 402 |
* |
... | ... | |
416 | 417 |
} |
417 | 418 |
|
418 | 419 |
String name; |
419 |
if(!"".equals(parameter.key())) { |
|
420 |
if (!"".equals(parameter.key())) {
|
|
420 | 421 |
name = parameter.key(); |
421 |
} |
|
422 |
else { |
|
422 |
} else { |
|
423 | 423 |
name = f.getName(); |
424 | 424 |
} |
425 | 425 |
|
426 |
f.setAccessible(true); // not to set accessible to test the field values
|
|
426 |
f.setAccessible(true); // to be able to test the field values
|
|
427 | 427 |
Object previousValue = this.lastParameters.get(name); |
428 | 428 |
Object newValue = f.get(this); |
429 | 429 |
|
... | ... | |
438 | 438 |
return this.dirty; |
439 | 439 |
} |
440 | 440 |
|
441 |
|
|
442 |
|
|
443 | 441 |
/** |
444 | 442 |
* Gets the dirty states. |
445 | 443 |
* |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 609) | ||
---|---|---|
86 | 86 |
import org.txm.searchengine.cqp.corpus.Corpus; |
87 | 87 |
import org.txm.searchengine.cqp.corpus.Property; |
88 | 88 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
89 |
import org.txm.searchengine.cqp.corpus.WordProperty; |
|
89 | 90 |
import org.txm.searchengine.cqp.corpus.query.Query; |
90 | 91 |
import org.txm.statsengine.r.rcp.views.RVariablesView; |
91 | 92 |
import org.txm.utils.logger.Log; |
... | ... | |
95 | 96 |
* |
96 | 97 |
* @author mdecorde |
97 | 98 |
*/ |
98 |
public class IndexEditor extends TXMEditorPart { |
|
99 |
public class IndexEditor extends TXMEditorPart<Index> {
|
|
99 | 100 |
|
100 | 101 |
/** The index. */ |
101 | 102 |
protected Index index; |
... | ... | |
111 | 112 |
protected Button go; |
112 | 113 |
|
113 | 114 |
/** The props area. */ |
114 |
protected PropertiesSelector propsArea; |
|
115 |
protected PropertiesSelector<Property> propsArea;
|
|
115 | 116 |
// seuils |
116 | 117 |
/** The Fmin spinner. */ |
117 | 118 |
protected Spinner fMinSpinner; |
... | ... | |
324 | 325 |
queryWidget.addKeyListener(listener); |
325 | 326 |
|
326 | 327 |
// select focus properties |
327 |
propsArea = new PropertiesSelector(queryArea, SWT.NONE); |
|
328 |
propsArea = new PropertiesSelector<Property>(queryArea, SWT.NONE);
|
|
328 | 329 |
propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); |
329 | 330 |
propsArea.setLayout(new GridLayout(3, false)); |
330 | 331 |
propsArea.addValueChangeListener(new Listener() { |
tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 609) | ||
---|---|---|
445 | 445 |
}); |
446 | 446 |
} |
447 | 447 |
|
448 |
|
|
449 | 448 |
/** |
450 | 449 |
* Creates the chart container component from the chart object stored into the composite. |
451 | 450 |
*/ |
... | ... | |
462 | 461 |
super.dispose(); |
463 | 462 |
} |
464 | 463 |
|
465 |
|
|
466 |
|
|
467 | 464 |
/** |
468 | 465 |
* Returns the tool bar of this editor. |
469 | 466 |
* @return the toolBar |
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 609) | ||
---|---|---|
129 | 129 |
import org.txm.rcp.swt.dialog.ViewPropertySelectionDialog; |
130 | 130 |
import org.txm.rcp.swt.widget.AssistedQueryWidget; |
131 | 131 |
import org.txm.rcp.swt.widget.NavigationWidget; |
132 |
import org.txm.rcp.swt.widget.PropertiesSelector; |
|
132 | 133 |
import org.txm.rcp.utils.JobHandler; |
133 | 134 |
import org.txm.rcp.utils.SWTEditorsUtils; |
134 | 135 |
import org.txm.rcp.views.QueriesView; |
135 | 136 |
import org.txm.rcp.views.corpora.CorporaView; |
136 | 137 |
import org.txm.searchengine.cqp.CQPEngine; |
137 | 138 |
import org.txm.searchengine.cqp.ReferencePattern; |
139 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
|
138 | 140 |
import org.txm.searchengine.cqp.corpus.Corpus; |
139 | 141 |
import org.txm.searchengine.cqp.corpus.Property; |
140 | 142 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
... | ... | |
355 | 357 |
|
356 | 358 |
private void initializeEditor() throws PartInitException { |
357 | 359 |
|
358 |
TXMResultEditorInput input = getEditorInput(); |
|
360 |
TXMResultEditorInput<Concordance> input = getEditorInput();
|
|
359 | 361 |
TXMResult result = input.getResult(); |
360 | 362 |
if (!(result instanceof Concordance)) { |
361 | 363 |
throw new PartInitException("Cannot open ConcordanceEditor with "+result); |
... | ... | |
889 | 891 |
|
890 | 892 |
private Composite navigationArea; |
891 | 893 |
|
894 |
private PropertiesSelector<Property> propsArea; |
|
895 |
|
|
892 | 896 |
/** |
893 | 897 |
* Get the Composite that contains the query and sort forms |
894 | 898 |
* |
... | ... | |
969 | 973 |
}); |
970 | 974 |
|
971 | 975 |
// | Properties: word/pos [Edit] | |
972 |
Composite propertiesArea = new Composite(queryArea, SWT.NONE); |
|
973 |
propertiesArea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, |
|
974 |
false, 1, 1)); |
|
975 |
propertiesArea.setLayout(new GridLayout(3, false)); |
|
976 |
// Properties: |
|
977 |
Label propLabel = new Label(propertiesArea, SWT.NONE); |
|
978 |
propLabel.setText(Messages.ConcordancesEditor_16); |
|
979 |
propLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true)); |
|
980 |
|
|
981 |
// word/pos |
|
982 |
viewPropertiesLabel = new Label(propertiesArea, SWT.NONE); |
|
983 |
viewPropertiesLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, |
|
984 |
false, true)); |
|
985 |
this.updateViewPropertiesLabel(); |
|
986 |
|
|
987 |
// [Edit] |
|
988 |
Button editViewProperties = new Button(propertiesArea, SWT.PUSH); |
|
989 |
editViewProperties.setText(Messages.ConcordancesEditor_18); |
|
990 |
editViewProperties.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, true)); |
|
991 |
editViewProperties.addSelectionListener(new SelectionListener() { |
|
976 |
propsArea = new PropertiesSelector<Property>(queryArea, SWT.NONE); |
|
977 |
propsArea.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false)); |
|
978 |
propsArea.setLayout(new GridLayout(3, false)); |
|
979 |
this.propsArea.setProperties(concordance.getAvailableKeywordViewProperties(), concordance.getKeywordViewProperties()); |
|
980 |
propsArea.addValueChangeListener(new Listener() { |
|
992 | 981 |
@Override |
993 |
public void widgetSelected(SelectionEvent e) { |
|
994 |
StatusLine.setMessage(Messages.ConcordancesEditor_55); |
|
995 |
new ViewPropertySelectionDialog(getSite(), |
|
996 |
concordance.getAvailableKeywordViewProperties(), |
|
997 |
concordance.getKeywordViewProperties()).open(); |
|
998 |
if (concordance != null) |
|
999 |
try { |
|
1000 |
refreshViewProperties(); |
|
1001 |
} catch (Exception e1) { |
|
1002 |
System.err.println(NLS.bind( |
|
1003 |
Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, |
|
1004 |
e1)); |
|
1005 |
} |
|
1006 |
updateViewPropertiesLabel(); |
|
982 |
public void handleEvent(Event event) { |
|
983 |
concordance.setKeywordViewProperties(propsArea.getProperties()); |
|
984 |
refreshViewProperties(); |
|
985 |
// if (!TXMPreferences.getBoolean(RCPPreferences.AUTO_UPDATE_EDITOR, RCPPreferences.PREFERENCES_NODE)) { |
|
986 |
// try { |
|
987 |
// refreshViewProperties(); |
|
988 |
// } catch (Exception e1) { |
|
989 |
// System.err.println(NLS.bind( |
|
990 |
// Messages.ERROR_WHILE_LOADING_CONCORDANCE_LINE, |
|
991 |
// e1)); |
|
992 |
// } |
|
993 |
// } |
|
1007 | 994 |
} |
1008 |
|
|
1009 |
@Override |
|
1010 |
public void widgetDefaultSelected(SelectionEvent e) { |
|
1011 |
} |
|
1012 | 995 |
}); |
1013 | 996 |
|
1014 | 997 |
// [Search] |
tmp/org.txm.referencer.rcp/src/org/txm/rcp/editors/referencer/ReferencerEditor.java (revision 609) | ||
---|---|---|
81 | 81 |
/** |
82 | 82 |
* The Class ReferencerEditor display&update a Referencer TXMResult |
83 | 83 |
*/ |
84 |
public class ReferencerEditor extends TXMEditorPart { |
|
84 |
public class ReferencerEditor extends TXMEditorPart<Referencer> {
|
|
85 | 85 |
|
86 | 86 |
/** The Constant ID. */ |
87 | 87 |
public static final String ID = ReferencerEditor.class.getName(); //$NON-NLS-1$ |
tmp/org.txm.concordance.core/src/org/txm/concordance/core/functions/Concordance.java (revision 609) | ||
---|---|---|
281 | 281 |
} else { |
282 | 282 |
StringBuffer buf = new StringBuffer(); |
283 | 283 |
buf.append("Concordance:\n"); //$NON-NLS-1$ |
284 |
buf.append("\tCorpus: " + this.getCorpus().getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
284 |
buf.append("\tCorpus: " + this.getCorpus() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
285 | 285 |
buf |
286 |
.append("\tQuery: " + this.getQuery().getQueryString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
286 |
.append("\tQuery: " + this.getQuery() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
287 | 287 |
buf |
288 | 288 |
.append("\tLeft Context View property: " + this.getLeftViewProperties() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
289 | 289 |
buf |
tmp/org.txm.concordance.core/src/org/txm/concordance/core/preferences/ConcordancePreferences.java (revision 609) | ||
---|---|---|
23 | 23 |
public static final String LEFT_CONTEXT_SIZE = PREFERENCES_PREFIX + "left_context_size"; //$NON-NLS-1$ |
24 | 24 |
public static final String RIGHT_CONTEXT_SIZE = PREFERENCES_PREFIX + "right_context_size"; //$NON-NLS-1$ |
25 | 25 |
|
26 |
|
|
27 | 26 |
public static final String QUERY = "query"; |
28 | 27 |
public static final String LEFT_ANALYSIS_PROPERTIES = "left_analysis_properties"; |
29 | 28 |
public static final String KEYWORD_ANALYSIS_PROPERTIES = "keyword_analysis_properties"; |
... | ... | |
38 | 37 |
public static final String LIMITCQL = "limit_cql"; |
39 | 38 |
public static final String TOP_INDEX = "top_index"; |
40 | 39 |
|
41 |
|
|
42 | 40 |
public static final String WORD = "word"; |
41 |
|
|
43 | 42 |
@Override |
44 | 43 |
public void initializeDefaultPreferences() { |
45 | 44 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/preferences/RCPPreferences.java (revision 609) | ||
---|---|---|
58 | 58 |
preferences.put(TBXPreferences.EXPORT_TXTSEPARATOR, ""); //$NON-NLS-1$ |
59 | 59 |
preferences.put(RCPPreferences.UI_LOCALE, "en"); //$NON-NLS-1$ |
60 | 60 |
|
61 |
preferences.putBoolean(AUTO_UPDATE_EDITOR, false);
|
|
61 |
preferences.putBoolean(AUTO_UPDATE_EDITOR, true);
|
|
62 | 62 |
preferences.putBoolean(SHOW_SEVERE_DIALOG, false); |
63 | 63 |
preferences.putBoolean(USER_ALERT_DELETE, false); |
64 | 64 |
preferences.putBoolean(SAVE_BEFORE_EXECUTION, false); |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 609) | ||
---|---|---|
369 | 369 |
* @param resetView |
370 | 370 |
* @param clearChartItemsSelection |
371 | 371 |
*/ |
372 |
protected static void compute(final TXMResultEditorInput editorInput, final String editorId, final boolean update, final TXMEditorPart editor) {
|
|
372 |
protected static void compute(final TXMResultEditorInput<? extends TXMResult> editorInput, final String editorId, final boolean update, final TXMEditorPart<? extends TXMResult> editor) {
|
|
373 | 373 |
|
374 | 374 |
StatusLine.setMessage("Computing " + editorInput.getResult().getName()); |
375 | 375 |
|
376 | 376 |
JobHandler job = new JobHandler("Computing " + editorInput.getResult().getName()) { |
377 | 377 |
|
378 |
TXMEditorPart currentEditor = null; |
|
378 |
TXMEditorPart<? extends TXMResult> currentEditor = null;
|
|
379 | 379 |
|
380 | 380 |
@Override |
381 | 381 |
protected IStatus run(IProgressMonitor monitor) { |
... | ... | |
404 | 404 |
// computing result |
405 | 405 |
monitor.beginTask("Computing", 100); |
406 | 406 |
|
407 |
editorInput.getResult().compute(update, monitor); |
|
407 |
if (!editorInput.getResult().compute(update, monitor)) { |
|
408 |
Log.info("TXMEditorPart.compute(): compute failed."); |
|
408 | 409 |
|
410 |
} |
|
411 |
|
|
409 | 412 |
monitor.worked(50); |
410 | 413 |
|
411 | 414 |
// opening an editor if not exists |
Also available in: Unified diff