Révision 554
| tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 554) | ||
|---|---|---|
| 1559 | 1559 |
return occ+CooccurrenceCoreMessages.Cooccurrence_4+freq+CooccurrenceCoreMessages.Cooccurrence_7+nbocc+CooccurrenceCoreMessages.Cooccurrence_8+score+CooccurrenceCoreMessages.Cooccurrence_9+distmoyenne+CooccurrenceCoreMessages.Cooccurrence_10+props; |
| 1560 | 1560 |
} |
| 1561 | 1561 |
} |
| 1562 |
|
|
| 1563 |
|
|
| 1564 |
@Override |
|
| 1565 |
public boolean loadParameters() {
|
|
| 1566 |
System.err.println("Cooccurrence.loadParameters(): not yet implemented.");
|
|
| 1567 |
return true; |
|
| 1568 |
} |
|
| 1569 |
|
|
| 1570 |
|
|
| 1562 | 1571 |
} |
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LexicalTableEditor.java (revision 554) | ||
|---|---|---|
| 84 | 84 |
|
| 85 | 85 |
/** The table. */ |
| 86 | 86 |
LexicalTable lexicalTable; |
| 87 |
ILexicalTable iTable; |
|
| 87 |
//ILexicalTable iTable;
|
|
| 88 | 88 |
|
| 89 | 89 |
// params |
| 90 | 90 |
/** The line table viewer. */ |
| ... | ... | |
| 122 | 122 |
|
| 123 | 123 |
|
| 124 | 124 |
/** |
| 125 |
* Sort. |
|
| 126 |
* |
|
| 127 |
* @param col the col |
|
| 128 |
* @param index the index |
|
| 129 |
*/ |
|
| 130 |
public void sort(TableViewerColumn col, int index) {
|
|
| 131 |
|
|
| 132 |
if (index == previousSortedCol) {
|
|
| 133 |
reverse = !reverse; |
|
| 134 |
} else {
|
|
| 135 |
reverse = DEFAULTREVERSE; |
|
| 136 |
} |
|
| 137 |
|
|
| 138 |
if (index == -2) {// rownames
|
|
| 139 |
iTable.sortRowNames(reverse); |
|
| 140 |
} else if (index == -1) { // freqs
|
|
| 141 |
try {
|
|
| 142 |
iTable.sortByFreqs(reverse); |
|
| 143 |
StatusLine.setMessage(RCPMessages.SORT_DONE); |
|
| 144 |
} catch (Exception e2) {
|
|
| 145 |
org.txm.rcp.utils.Logger.printStackTrace(e2); |
|
| 146 |
} |
|
| 147 |
} else if (index >= 0) {
|
|
| 148 |
iTable.sort(index, reverse); |
|
| 149 |
} |
|
| 150 |
|
|
| 151 |
previousSortedCol = index; |
|
| 152 |
refreshTable(); |
|
| 153 |
|
|
| 154 |
viewer.getTable().setSortColumn(col.getColumn()); |
|
| 155 |
if (reverse) {
|
|
| 156 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
| 157 |
} |
|
| 158 |
else {
|
|
| 159 |
viewer.getTable().setSortDirection(SWT.UP); |
|
| 160 |
} |
|
| 161 |
} |
|
| 162 |
|
|
| 163 |
/** |
|
| 164 | 125 |
* Creates the part control. |
| 165 | 126 |
* |
| 166 | 127 |
* @param parent the parent |
| ... | ... | |
| 173 | 134 |
|
| 174 | 135 |
|
| 175 | 136 |
lexicalTable = (LexicalTable) this.getResultData(); |
| 176 |
iTable = lexicalTable.getData(); |
|
| 137 |
//iTable = lexicalTable.getData();
|
|
| 177 | 138 |
|
| 178 | 139 |
|
| 179 | 140 |
Composite paramArea = new Composite(this.getCommandParametersGroup(), SWT.NONE); |
| ... | ... | |
| 197 | 158 |
return; |
| 198 | 159 |
|
| 199 | 160 |
try {
|
| 200 |
iTable.filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
|
|
| 201 |
refresh(); |
|
| 161 |
lexicalTable.getData().filter(nLinesSpinner.getSelection(), minfreqspinner.getSelection());
|
|
| 162 |
refresh(false);
|
|
| 202 | 163 |
StatusLine.setMessage(""); //$NON-NLS-1$
|
| 203 | 164 |
} catch (Exception e1) {
|
| 204 | 165 |
// TODO Auto-generated catch block |
| ... | ... | |
| 256 | 217 |
|
| 257 | 218 |
// update first col of the Lexical table |
| 258 | 219 |
for (int j = 0; j < lexicalTable.getNRows(); j++) {
|
| 259 |
iTable.set(j, colindices.get(0), firstcol[j]);
|
|
| 220 |
lexicalTable.getData().set(j, colindices.get(0), firstcol[j]);
|
|
| 260 | 221 |
} |
| 261 | 222 |
|
| 262 | 223 |
// and its name |
| ... | ... | |
| 264 | 225 |
|
| 265 | 226 |
// keep only the first col |
| 266 | 227 |
List<Integer> coltodelete = colindices.subList(1, colindices.size()); |
| 267 |
iTable.removeCols(coltodelete);
|
|
| 228 |
lexicalTable.getData().removeCols(coltodelete);
|
|
| 268 | 229 |
|
| 269 | 230 |
// refresh stuff |
| 270 | 231 |
collist = new ArrayList<Object>();// update col name |
| ... | ... | |
| 288 | 249 |
} else// delete |
| 289 | 250 |
{
|
| 290 | 251 |
System.out.println(NLS.bind(LexicalTableUIMessages.LexicalTableEditor_12, colindices)); |
| 291 |
iTable.removeCols(colindices);
|
|
| 252 |
lexicalTable.getData().removeCols(colindices);
|
|
| 292 | 253 |
|
| 293 | 254 |
collist = new ArrayList<Object>(); |
| 294 | 255 |
Vector colnames = lexicalTable.getColNames(); |
| ... | ... | |
| 342 | 303 |
MergeLines.mergeLines(LexicalTableEditor.this, d |
| 343 | 304 |
.getMergeName(), rowindices); |
| 344 | 305 |
} else {
|
| 345 |
iTable.removeRows(rowindices);
|
|
| 306 |
lexicalTable.getData().removeRows(rowindices);
|
|
| 346 | 307 |
refreshTable(); |
| 347 | 308 |
viewer.getTable().deselectAll(); |
| 348 | 309 |
} |
| ... | ... | |
| 433 | 394 |
viewer.getTable().setSortColumn(formColumn.getColumn()); |
| 434 | 395 |
viewer.getTable().setSortDirection(SWT.UP); |
| 435 | 396 |
|
| 436 |
refresh();
|
|
| 397 |
this.refresh(false);
|
|
| 437 | 398 |
|
| 438 |
createContextMenu(viewer); |
|
| 399 |
this.createContextMenu(viewer);
|
|
| 439 | 400 |
|
| 440 | 401 |
//this.commandParametersGroup.pack(); |
| 441 | 402 |
} |
| 442 | 403 |
|
| 404 |
|
|
| 405 |
|
|
| 406 |
/** |
|
| 407 |
* Sort. |
|
| 408 |
* |
|
| 409 |
* @param col the col |
|
| 410 |
* @param index the index |
|
| 411 |
*/ |
|
| 412 |
public void sort(TableViewerColumn col, int index) {
|
|
| 413 |
|
|
| 414 |
if (index == previousSortedCol) {
|
|
| 415 |
reverse = !reverse; |
|
| 416 |
} else {
|
|
| 417 |
reverse = DEFAULTREVERSE; |
|
| 418 |
} |
|
| 419 |
|
|
| 420 |
if (index == -2) {// rownames
|
|
| 421 |
lexicalTable.getData().sortRowNames(reverse); |
|
| 422 |
} else if (index == -1) { // freqs
|
|
| 423 |
try {
|
|
| 424 |
lexicalTable.getData().sortByFreqs(reverse); |
|
| 425 |
StatusLine.setMessage(RCPMessages.SORT_DONE); |
|
| 426 |
} catch (Exception e2) {
|
|
| 427 |
org.txm.rcp.utils.Logger.printStackTrace(e2); |
|
| 428 |
} |
|
| 429 |
} else if (index >= 0) {
|
|
| 430 |
lexicalTable.getData().sort(index, reverse); |
|
| 431 |
} |
|
| 432 |
|
|
| 433 |
previousSortedCol = index; |
|
| 434 |
refreshTable(); |
|
| 435 |
|
|
| 436 |
viewer.getTable().setSortColumn(col.getColumn()); |
|
| 437 |
if (reverse) {
|
|
| 438 |
viewer.getTable().setSortDirection(SWT.DOWN); |
|
| 439 |
} |
|
| 440 |
else {
|
|
| 441 |
viewer.getTable().setSortDirection(SWT.UP); |
|
| 442 |
} |
|
| 443 |
} |
|
| 444 |
|
|
| 445 |
|
|
| 443 | 446 |
private void refreshColNames() throws StatException, CqiClientException {
|
| 444 | 447 |
TableColumn[] cols = viewer.getTable().getColumns(); |
| 445 | 448 |
String[] colnames = lexicalTable.getColNames().asStringsArray(); |
| ... | ... | |
| 454 | 457 |
*/ |
| 455 | 458 |
public void refreshInfos() {
|
| 456 | 459 |
try {
|
| 457 |
this.setContentDescription(TXMCoreMessages.T + iTable.getTotal()
|
|
| 458 |
+ TXMCoreMessages.V + iTable.getNRows()
|
|
| 459 |
+ TXMCoreMessages.FMIN_2 + iTable.getFmin()
|
|
| 460 |
+ TXMCoreMessages.FMAX_2 + iTable.getFmax());
|
|
| 460 |
this.setContentDescription(TXMCoreMessages.T + lexicalTable.getData().getTotal()
|
|
| 461 |
+ TXMCoreMessages.V + lexicalTable.getData().getNRows()
|
|
| 462 |
+ TXMCoreMessages.FMIN_2 + lexicalTable.getData().getFmin()
|
|
| 463 |
+ TXMCoreMessages.FMAX_2 + lexicalTable.getData().getFmax());
|
|
| 461 | 464 |
} catch (Exception e3) {
|
| 462 | 465 |
// TODO Auto-generated catch block |
| 463 | 466 |
org.txm.rcp.utils.Logger.printStackTrace(e3); |
| ... | ... | |
| 481 | 484 |
|
| 482 | 485 |
updateEditorFromResult(); |
| 483 | 486 |
|
| 487 |
this.viewer.getTable().deselectAll(); |
|
| 484 | 488 |
this.viewer.getTable().setFocus(); |
| 485 | 489 |
} |
| 486 | 490 |
|
| 487 | 491 |
@Override |
| 488 | 492 |
public void refresh(boolean update) {
|
| 489 | 493 |
this.refreshTable(); |
| 490 |
this.viewer.getTable().deselectAll(); |
|
| 491 | 494 |
this.refreshInfos(); |
| 492 |
super.refresh(); |
|
| 495 |
super.refresh(update);
|
|
| 493 | 496 |
|
| 494 | 497 |
QueriesView.refresh(); |
| 495 | 498 |
RVariablesView.refresh(); |
| ... | ... | |
| 621 | 624 |
*/ |
| 622 | 625 |
@Deprecated |
| 623 | 626 |
public void exportData(File file) {
|
| 624 |
iTable.exportData(file, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 627 |
lexicalTable.getData().exportData(file, "\t", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
|
| 625 | 628 |
} |
| 626 | 629 |
|
| 627 | 630 |
/** |
| ... | ... | |
| 632 | 635 |
@Deprecated |
| 633 | 636 |
public void importData(File file) {
|
| 634 | 637 |
try {
|
| 635 |
if (iTable.importData(file)) {
|
|
| 638 |
if (lexicalTable.getData().importData(file)) {
|
|
| 636 | 639 |
// fix col names |
| 637 | 640 |
String[] colnames = lexicalTable.getColNames().asStringsArray(); |
| 638 | 641 |
TableColumn[] cols = viewer.getTable().getColumns(); |
| ... | ... | |
| 662 | 665 |
public void updateEditorFromResult() {
|
| 663 | 666 |
super.updateEditorFromResult(); |
| 664 | 667 |
nLinesSpinner.setMinimum(1); |
| 665 |
nLinesSpinner.setMaximum(iTable.getNRows());
|
|
| 666 |
nLinesSpinner.setSelection(iTable.getNRows());
|
|
| 667 |
minfreqspinner.setMinimum(iTable.getFmin());
|
|
| 668 |
minfreqspinner.setMaximum(iTable.getFmax());
|
|
| 668 |
nLinesSpinner.setMaximum(lexicalTable.getData().getNRows());
|
|
| 669 |
nLinesSpinner.setSelection(lexicalTable.getData().getNRows());
|
|
| 670 |
minfreqspinner.setMinimum(lexicalTable.getData().getFmin());
|
|
| 671 |
minfreqspinner.setMaximum(lexicalTable.getData().getFmax());
|
|
| 669 | 672 |
|
| 670 | 673 |
} |
| 671 | 674 |
|
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/editors/LineLabelProvider.java (revision 554) | ||
|---|---|---|
| 80 | 80 |
rownames = table.getRowNames().asStringsArray(); |
| 81 | 81 |
Nrows = table.getNRows(); |
| 82 | 82 |
Ncols = table.getNColumns(); |
| 83 |
for (int i = 0; i < Ncols; i++) |
|
| 83 |
for (int i = 0; i < Ncols; i++) {
|
|
| 84 | 84 |
cols.add(table.getData().getCol(i).asDoubleArray()); |
| 85 |
} |
|
| 85 | 86 |
freqs = table.getData().getRowMargins(); |
| 86 | 87 |
} catch (Exception e) {
|
| 87 | 88 |
// TODO Auto-generated catch block |
| tmp/org.txm.lexicaltable.rcp/src/org/txm/lexicaltable/rcp/handlers/ComputeLexicalTable.java (revision 554) | ||
|---|---|---|
| 33 | 33 |
import org.apache.batik.util.gui.CSSMediaPanel.Dialog; |
| 34 | 34 |
import org.eclipse.core.commands.ExecutionEvent; |
| 35 | 35 |
import org.eclipse.core.commands.ExecutionException; |
| 36 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
| 37 |
import org.eclipse.core.runtime.IStatus; |
|
| 38 |
import org.eclipse.core.runtime.Status; |
|
| 39 | 36 |
import org.eclipse.jface.viewers.ArrayContentProvider; |
| 40 | 37 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 41 | 38 |
import org.eclipse.jface.viewers.LabelProvider; |
| 42 | 39 |
import org.eclipse.jface.window.Window; |
| 43 |
import org.eclipse.osgi.util.NLS; |
|
| 44 | 40 |
import org.eclipse.swt.widgets.Display; |
| 45 |
import org.eclipse.ui.IWorkbenchPage; |
|
| 46 | 41 |
import org.eclipse.ui.IWorkbenchWindow; |
| 47 |
import org.eclipse.ui.PartInitException; |
|
| 48 | 42 |
import org.eclipse.ui.dialogs.ListDialog; |
| 49 | 43 |
import org.eclipse.ui.handlers.HandlerUtil; |
| 50 | 44 |
import org.txm.core.preferences.TXMPreferences; |
| 51 | 45 |
//import org.txm.functions.queryindex.QueryIndex; |
| 52 | 46 |
import org.txm.index.core.functions.Index; |
| 53 | 47 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| 54 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
|
| 55 | 48 |
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences; |
| 56 |
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl; |
|
| 57 | 49 |
import org.txm.lexicaltable.rcp.editors.LexicalTableDialog; |
| 58 | 50 |
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor; |
| 59 |
import org.txm.lexicaltable.rcp.editors.___LexicalTableEditorInput; |
|
| 60 |
import org.txm.rcp.JobsTimer; |
|
| 61 | 51 |
import org.txm.rcp.RCPMessages; |
| 62 |
import org.txm.rcp.StatusLine; |
|
| 63 | 52 |
import org.txm.rcp.editors.TXMEditorPart; |
| 64 | 53 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
| 65 |
import org.txm.rcp.utils.JobHandler; |
|
| 66 |
import org.txm.rcp.views.QueriesView; |
|
| 67 | 54 |
import org.txm.rcp.views.corpora.CorporaView; |
| 68 | 55 |
import org.txm.searchengine.cqp.corpus.Partition; |
| 69 | 56 |
import org.txm.searchengine.cqp.corpus.Property; |
| 70 |
import org.txm.statsengine.r.rcp.views.RVariablesView; |
|
| 71 | 57 |
// TODO: Auto-generated Javadoc |
| 72 | 58 |
/** |
| 73 | 59 |
* if the selection is a Partition : creates a lexical table already filled if |
| ... | ... | |
| 78 | 64 |
|
| 79 | 65 |
|
| 80 | 66 |
static {
|
| 81 |
CorporaView.addDoubleClickListener(LexicalTableImpl.class, ComputeLexicalTable.class);
|
|
| 67 |
CorporaView.addDoubleClickListener(LexicalTable.class, ComputeLexicalTable.class); |
|
| 82 | 68 |
} |
| 83 | 69 |
|
| 84 | 70 |
|
| ... | ... | |
| 152 | 138 |
// Creating from Partition |
| 153 | 139 |
else if (selection instanceof Partition) {
|
| 154 | 140 |
final Property property; |
| 155 |
final int Fmin;
|
|
| 156 |
final int vmax;
|
|
| 141 |
final int fMin;
|
|
| 142 |
final int vMax;
|
|
| 157 | 143 |
|
| 158 | 144 |
final Partition partition = (Partition) selection; |
| 159 | 145 |
|
| ... | ... | |
| 165 | 151 |
|
| 166 | 152 |
if (d.open() == Window.OK) {
|
| 167 | 153 |
property = d.getProperty(); |
| 168 |
Fmin = d.getFmin();
|
|
| 169 |
vmax = d.getMaxLines();
|
|
| 154 |
fMin = d.getFmin();
|
|
| 155 |
vMax = d.getMaxLines();
|
|
| 170 | 156 |
|
| 171 |
lexicalTable = new LexicalTable(partition, property, Fmin);
|
|
| 172 |
lexicalTable.setVMax(vmax);
|
|
| 157 |
lexicalTable = new LexicalTable(partition, property, fMin, vMax);
|
|
| 158 |
lexicalTable.setVMax(vMax);
|
|
| 173 | 159 |
|
| 174 | 160 |
|
| 175 | 161 |
// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(CorporaView.ID); |
| ... | ... | |
| 246 | 232 |
lexicalTable = (LexicalTable) selection; |
| 247 | 233 |
} |
| 248 | 234 |
|
| 235 |
// FIXME: tests |
|
| 236 |
// try {
|
|
| 237 |
// lexicalTable.compute(false); |
|
| 238 |
// } |
|
| 239 |
// catch (Exception e) {
|
|
| 240 |
// // TODO Auto-generated catch block |
|
| 241 |
// e.printStackTrace(); |
|
| 242 |
// } |
|
| 243 |
|
|
| 249 | 244 |
TXMEditorPart.openEditor(lexicalTable, LexicalTableEditor.ID); |
| 250 | 245 |
|
| 251 | 246 |
return true; |
| tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Corpus.java (revision 554) | ||
|---|---|---|
| 1326 | 1326 |
private StructuralUnitProperty textIdStructuralUnitProperty; |
| 1327 | 1327 |
public HashSet<Object> getStoredData(Class class1) {
|
| 1328 | 1328 |
|
| 1329 |
if (!storedData.containsKey(class1)) |
|
| 1329 |
if (!storedData.containsKey(class1)) {
|
|
| 1330 | 1330 |
storedData.put(class1, new HashSet<Object>()); |
| 1331 |
} |
|
| 1331 | 1332 |
|
| 1332 | 1333 |
return storedData.get(class1); |
| 1333 | 1334 |
} |
| ... | ... | |
| 1338 | 1339 |
* @param o a lexicon |
| 1339 | 1340 |
*/ |
| 1340 | 1341 |
public void storeData(Object o) {
|
| 1341 |
if (storedData.containsKey(o.getClass())) |
|
| 1342 |
if (storedData.containsKey(o.getClass())) {
|
|
| 1342 | 1343 |
storedData.put(o.getClass(), new HashSet<Object>()); |
| 1344 |
} |
|
| 1343 | 1345 |
|
| 1344 | 1346 |
HashSet<Object> hash = storedData.get(o.getClass()); |
| 1345 | 1347 |
hash.add(o); |
| ... | ... | |
| 1358 | 1360 |
} |
| 1359 | 1361 |
|
| 1360 | 1362 |
public StructuralUnit getTextStructuralUnit() throws CqiClientException {
|
| 1361 |
if (textStructuralUnit == null) |
|
| 1363 |
if (textStructuralUnit == null) {
|
|
| 1362 | 1364 |
textStructuralUnit = getStructuralUnit(TEXT); |
| 1365 |
} |
|
| 1363 | 1366 |
return textStructuralUnit; |
| 1364 | 1367 |
} |
| 1365 | 1368 |
|
| 1366 | 1369 |
public StructuralUnitProperty getTextIdStructuralUnitProperty() throws CqiClientException {
|
| 1367 |
if (textIdStructuralUnitProperty == null) |
|
| 1370 |
if (textIdStructuralUnitProperty == null) {
|
|
| 1368 | 1371 |
textIdStructuralUnitProperty = getTextStructuralUnit().getProperty(ID); |
| 1372 |
} |
|
| 1369 | 1373 |
return textIdStructuralUnitProperty; |
| 1370 | 1374 |
} |
| 1371 | 1375 |
|
| 1376 |
|
|
| 1372 | 1377 |
/** |
| 1378 |
* Gets the default property (by default: "word"). |
|
| 1379 |
* @return |
|
| 1380 |
* @throws CqiClientException |
|
| 1381 |
*/ |
|
| 1382 |
public Property getDefaultProperty() throws CqiClientException {
|
|
| 1383 |
return this.getProperty(WORD); |
|
| 1384 |
} |
|
| 1385 |
|
|
| 1386 |
/** |
|
| 1373 | 1387 |
* Gets the main corpus parent. |
| 1374 | 1388 |
* @return the first parent of class MainCorpus or the object itself if it is its class. |
| 1375 | 1389 |
*/ |
| tmp/org.txm.ca.core/src/org/txm/ca/core/functions/CA.java (revision 554) | ||
|---|---|---|
| 848 | 848 |
System.err.println("CA.setParameters(): not yet implemented.");
|
| 849 | 849 |
return true; |
| 850 | 850 |
} |
| 851 |
|
|
| 852 |
@Override |
|
| 853 |
public boolean loadParameters() {
|
|
| 854 |
System.err.println("CA.loadParameters(): not yet implemented.");
|
|
| 855 |
return true; |
|
| 856 |
} |
|
| 851 | 857 |
} |
| tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTableFactory.java (revision 554) | ||
|---|---|---|
| 27 | 27 |
* @throws CqiClientException the cqi client exception |
| 28 | 28 |
* @throws RWorkspaceException the r workspace exception |
| 29 | 29 |
*/ |
| 30 |
public static final LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int fMin) throws Exception {
|
|
| 30 |
public static final LexicalTable getLexicalTable(Partition partition, Property analysisProperty, int fMin, int vMax) throws Exception {
|
|
| 31 | 31 |
//long time = System.currentTimeMillis(); |
| 32 | 32 |
List<Lexicon> lexicons = new ArrayList<Lexicon>(); |
| 33 | 33 |
// Set<String> allLexiconEntry = new HashSet<String>(); |
| ... | ... | |
| 81 | 81 |
|
| 82 | 82 |
LexicalTableImpl iTable = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartShortNames().toArray(new String[] {}));
|
| 83 | 83 |
|
| 84 |
LexicalTable table = new LexicalTable(partition, analysisProperty, fMin, iTable); |
|
| 84 |
LexicalTable table = new LexicalTable(partition, analysisProperty, fMin, vMax, iTable);
|
|
| 85 | 85 |
//System.out.println("time build table lexical "+(System.currentTimeMillis()-time));
|
| 86 | 86 |
return table; |
| 87 | 87 |
} |
| tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 554) | ||
|---|---|---|
| 38 | 38 |
public static String SYMBOL_BASE = "LexicalTable_"; //$NON-NLS-1$ |
| 39 | 39 |
|
| 40 | 40 |
/** the statengine data object */ |
| 41 |
ILexicalTable data;
|
|
| 41 |
protected ILexicalTable statsData;
|
|
| 42 | 42 |
|
| 43 |
|
|
| 43 | 44 |
/** The constructor_fmin. */ |
| 44 |
private Integer pFminFilter;
|
|
| 45 |
private Integer pfMinFilter;
|
|
| 45 | 46 |
|
| 46 | 47 |
/** The property. */ |
| 47 | 48 |
private Property pProperty; |
| ... | ... | |
| 57 | 58 |
* @param analysisProperty |
| 58 | 59 |
* @param itable |
| 59 | 60 |
*/ |
| 60 |
public LexicalTable(Corpus corpus, Property analysisProperty, LexicalTableImpl itable) {
|
|
| 61 |
public LexicalTable(Corpus corpus, Property analysisProperty, ILexicalTable itable) {
|
|
| 61 | 62 |
super(corpus); |
| 62 | 63 |
this.pProperty = analysisProperty; |
| 63 |
this.data = itable;
|
|
| 64 |
this.statsData = itable;
|
|
| 64 | 65 |
} |
| 65 | 66 |
|
| 67 |
|
|
| 66 | 68 |
/** |
| 69 |
* |
|
| 70 |
* @param corpus |
|
| 71 |
* @param analysisProperty |
|
| 72 |
* @throws Exception |
|
| 73 |
*/ |
|
| 74 |
public LexicalTable(Corpus corpus, Property analysisProperty) throws Exception {
|
|
| 75 |
this(corpus, analysisProperty, null); |
|
| 76 |
} |
|
| 77 |
|
|
| 78 |
/** |
|
| 79 |
* |
|
| 80 |
* @param corpus |
|
| 81 |
* @throws Exception |
|
| 82 |
*/ |
|
| 83 |
public LexicalTable(Corpus corpus) throws Exception {
|
|
| 84 |
this(corpus, corpus.getDefaultProperty()); |
|
| 85 |
} |
|
| 86 |
|
|
| 87 |
|
|
| 88 |
/** |
|
| 89 |
* |
|
| 90 |
* @param partition |
|
| 91 |
* @param analysisProperty |
|
| 92 |
* @param fMin |
|
| 93 |
* @param vMax |
|
| 94 |
* @param iTable |
|
| 95 |
*/ |
|
| 96 |
public LexicalTable(Partition partition, Property analysisProperty, int fMin, int vMax, ILexicalTable iTable) {
|
|
| 97 |
this(partition, analysisProperty, fMin, vMax, false, iTable); |
|
| 98 |
} |
|
| 99 |
|
|
| 100 |
/** |
|
| 101 |
* |
|
| 102 |
* @param partition |
|
| 103 |
* @param analysisProperty |
|
| 104 |
* @param fMin |
|
| 105 |
* @param vMax |
|
| 106 |
*/ |
|
| 107 |
public LexicalTable(Partition partition, Property analysisProperty, int fMin, int vMax) {
|
|
| 108 |
this(partition, analysisProperty, fMin, vMax, null); |
|
| 109 |
} |
|
| 110 |
|
|
| 111 |
/** |
|
| 112 |
* |
|
| 113 |
* @param parent |
|
| 114 |
* @param analysisProperty |
|
| 115 |
* @param fMin |
|
| 116 |
* @param vMax |
|
| 117 |
* @param useAllOccurrences |
|
| 118 |
* @param iTable |
|
| 119 |
*/ |
|
| 120 |
private LexicalTable(TXMResult parent, Property analysisProperty, int fMin, int vMax, boolean useAllOccurrences, ILexicalTable iTable) {
|
|
| 121 |
super(parent); |
|
| 122 |
this.setParameters(analysisProperty, fMin, vMax, useAllOccurrences); |
|
| 123 |
this.statsData = iTable; |
|
| 124 |
} |
|
| 125 |
|
|
| 126 |
/** |
|
| 67 | 127 |
* Creates the lexical table. |
| 68 | 128 |
* |
| 69 | 129 |
* @param partindex the partindex |
| 70 | 130 |
* @return the lexical table |
| 71 | 131 |
* @throws RWorkspaceException the r workspace exception |
| 72 | 132 |
*/ |
| 133 |
// FIXME: not used? |
|
| 73 | 134 |
public LexicalTable(Index partIndex) throws RWorkspaceException {
|
| 74 | 135 |
super(partIndex); |
| 75 | 136 |
this.pProperty = partIndex.getProperties().get(0); |
| 76 | 137 |
} |
| 77 | 138 |
|
| 139 |
|
|
| 78 | 140 |
/** |
| 79 | 141 |
* |
| 80 | 142 |
* @param partition |
| 81 |
* @param analysisProperty |
|
| 82 |
* @param fMin |
|
| 83 |
* @param itable |
|
| 143 |
* @throws Exception |
|
| 84 | 144 |
*/ |
| 85 |
public LexicalTable(Partition partition, Property analysisProperty, int fMin, LexicalTableImpl itable) {
|
|
| 86 |
super(partition); |
|
| 87 |
this.pFminFilter = fMin; |
|
| 88 |
this.pProperty = analysisProperty; |
|
| 89 |
this.data = itable; |
|
| 90 |
} |
|
| 145 |
protected void _computeFromPartition(Partition partition) throws Exception {
|
|
| 146 |
|
|
| 147 |
//long time = System.currentTimeMillis(); |
|
| 148 |
List<Lexicon> lexicons = new ArrayList<Lexicon>(); |
|
| 149 |
// Set<String> allLexiconEntry = new HashSet<String>(); |
|
| 150 |
for (int i = 0; i < partition.getNPart(); i++) {
|
|
| 151 |
Lexicon l = Lexicon.getLexicon(partition.getParts().get(i), this.pProperty); |
|
| 152 |
lexicons.add(l); |
|
| 153 |
} |
|
| 154 |
//System.out.println("time lexicon build "+(System.currentTimeMillis()-time));
|
|
| 155 |
//time = System.currentTimeMillis(); |
|
| 156 |
// String[] entries = allLexiconEntry.toArray(new String[]{});
|
|
| 157 |
Lexicon ll = Lexicon.getLexicon(partition.getCorpus(), this.pProperty); |
|
| 91 | 158 |
|
| 92 |
|
|
| 93 |
public LexicalTable(Partition partition, Property analysisProperty, int fMin) {
|
|
| 94 |
this(partition, analysisProperty, fMin, null); |
|
| 95 |
} |
|
| 159 |
ArrayList<String> filteredForms = new ArrayList<String>(); |
|
| 160 |
//create a copy and filter line with Fmin; |
|
| 161 |
for (int i = 0 ; i < ll.getFreq().length ; i++) {
|
|
| 162 |
if (ll.getFreq()[i] >= this.pfMinFilter) {
|
|
| 163 |
filteredForms.add(ll.getForms()[i]); |
|
| 164 |
} |
|
| 165 |
} |
|
| 166 |
//System.out.println("remove freq too low "+(System.currentTimeMillis()-time));
|
|
| 167 |
//time = System.currentTimeMillis(); |
|
| 168 |
Map<String, Integer> entries2index = new HashMap<String, Integer>(); |
|
| 169 |
for (int i = 0; i < filteredForms.size(); i++) {
|
|
| 170 |
entries2index.put(filteredForms.get(i), i); |
|
| 171 |
} |
|
| 96 | 172 |
|
| 97 |
|
|
| 98 |
public LexicalTable(Subcorpus subcorpus) throws Exception {
|
|
| 99 |
this(subcorpus, subcorpus.getProperty("word")); //$NON-NLS-1$
|
|
| 173 |
//System.out.println("entries2index "+(System.currentTimeMillis()-time));
|
|
| 174 |
//time = System.currentTimeMillis(); |
|
| 175 |
int[][] mat = new int[filteredForms.size()][lexicons.size()];//DoubleFactory2D.sparse.make(filteredForms.size(), lexicons.size(), 0); |
|
| 176 |
|
|
| 177 |
|
|
| 178 |
Integer id = null; |
|
| 179 |
for (int i = 0; i < lexicons.size(); i++) {
|
|
| 180 |
Lexicon l = lexicons.get(i); |
|
| 181 |
String[] ents = l.getForms(); |
|
| 182 |
int[] freqs = l.getFreq(); |
|
| 183 |
for (int j = 0; j < freqs.length; j++) {
|
|
| 184 |
id = entries2index.get(ents[j]); |
|
| 185 |
// if (entriesFreqs[id] >= 2) |
|
| 186 |
if (id != null) {
|
|
| 187 |
mat[id][i] = freqs[j]; //mat.setQuick(id, i, freqs[j]); |
|
| 188 |
} |
|
| 189 |
} |
|
| 190 |
} |
|
| 191 |
//System.out.println("time build matrix "+(System.currentTimeMillis()-time));
|
|
| 192 |
//time = System.currentTimeMillis(); |
|
| 193 |
//System.out.println("Entries size " + filteredForms.size());
|
|
| 194 |
//System.out.println("mat size " + mat.rows());
|
|
| 195 |
//System.out.println("mat columns " + mat.columns());
|
|
| 196 |
|
|
| 197 |
this.statsData = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartShortNames().toArray(new String[] {}));
|
|
| 198 |
|
|
| 100 | 199 |
} |
| 101 | 200 |
|
| 102 |
public LexicalTable(Subcorpus subcorpus, Property property) throws Exception {
|
|
| 103 |
super(subcorpus); |
|
| 104 |
this.pProperty = property; |
|
| 105 |
} |
|
| 106 | 201 |
|
| 202 |
|
|
| 107 | 203 |
/** |
| 108 | 204 |
* Creates the lexical table. |
| 109 | 205 |
* |
| ... | ... | |
| 113 | 209 |
* @return the lexical table |
| 114 | 210 |
* @throws RWorkspaceException the r workspace exception |
| 115 | 211 |
*/ |
| 116 |
protected void _computeForIndex(List<Index> vocabularies) throws RWorkspaceException {
|
|
| 212 |
protected void _computeFromIndexes(List<Index> vocabularies) throws RWorkspaceException {
|
|
| 213 |
|
|
| 117 | 214 |
System.out.println(LexicalTableCoreMessages.LexicalTableImpl_1 + vocabularies); |
| 118 |
Index partindex = vocabularies.get(0);// FRIGO |
|
| 119 |
Partition partition = partindex.getPartition(); // the Index is computed on a partition |
|
| 215 |
|
|
| 216 |
Index partIndex = vocabularies.get(0);// FRIGO |
|
| 217 |
Partition partition = partIndex.getPartition(); // the Index is computed on a partition |
|
| 120 | 218 |
|
| 121 |
if (!partindex.isComputedWithPartition()) {
|
|
| 219 |
if (!partIndex.isComputedWithPartition()) {
|
|
| 122 | 220 |
throw new IllegalArgumentException("Vocabularies are not computed with a partition. Aborting.");
|
| 123 | 221 |
} |
| 124 | 222 |
|
| 125 |
this.pProperty = partindex.getProperties().get(0);
|
|
| 223 |
this.pProperty = partIndex.getProperties().get(0);
|
|
| 126 | 224 |
|
| 127 | 225 |
HashMap<String, Line> alllines = new HashMap<String, Line>(); |
| 128 | 226 |
// merge lines of all indexes |
| ... | ... | |
| 143 | 241 |
} |
| 144 | 242 |
} |
| 145 | 243 |
|
| 146 |
List<String> colnames = partindex.getPartnames();
|
|
| 244 |
List<String> colnames = partIndex.getPartnames();
|
|
| 147 | 245 |
|
| 148 | 246 |
Collection<Line> lines = alllines.values(); |
| 149 | 247 |
List<String> rownames = new ArrayList<String>(lines.size()); |
| ... | ... | |
| 196 | 294 |
//System.out.println("mat size : ["+(rownames.size() + extra)+"]["+colnames.size()+"]");
|
| 197 | 295 |
//System.out.println("rownames size : "+rownames.size());
|
| 198 | 296 |
//System.out.println("colnames size : "+colnames.size());
|
| 199 |
this.data = new LexicalTableImpl(mat, rownames.toArray(new String[] {}), colnames.toArray(new String[] {}));
|
|
| 297 |
this.statsData = new LexicalTableImpl(mat, rownames.toArray(new String[] {}), colnames.toArray(new String[] {}));
|
|
| 200 | 298 |
} |
| 201 | 299 |
|
| 202 | 300 |
|
| ... | ... | |
| 204 | 302 |
protected boolean _compute(boolean update) throws Exception {
|
| 205 | 303 |
|
| 206 | 304 |
if (this.parent instanceof Subcorpus) {
|
| 305 |
|
|
| 306 |
this.subTask("Computing from Subcorpus.");
|
|
| 307 |
|
|
| 207 | 308 |
Subcorpus subcorpus = (Subcorpus) this.parent; |
| 208 | 309 |
Corpus parentCorpus = subcorpus.getMotherCorpus(); |
| 209 |
this.data = new LexicalTableImpl(getNextName(), new Lexicon(parentCorpus), new Lexicon(subcorpus));
|
|
| 310 |
this.statsData = new LexicalTableImpl(getNextName(), new Lexicon(parentCorpus), new Lexicon(subcorpus));
|
|
| 210 | 311 |
} |
| 211 | 312 |
else if (this.parent instanceof Partition) {
|
| 212 |
_computeForPartition((Partition)this.parent); |
|
| 313 |
|
|
| 314 |
this.subTask("Computing from Partition.");
|
|
| 315 |
|
|
| 316 |
this._computeFromPartition((Partition)this.parent); |
|
| 213 | 317 |
} |
| 214 | 318 |
else if (parent instanceof Index) {
|
| 215 |
_computeForIndex(Arrays.asList((Index)this.parent)); |
|
| 319 |
|
|
| 320 |
this.subTask("Computing from Index.");
|
|
| 321 |
|
|
| 322 |
this._computeFromIndexes(Arrays.asList((Index)this.parent)); |
|
| 216 | 323 |
} |
| 217 | 324 |
|
| 218 |
this.data.cut(this.pVMaxFilter);
|
|
| 325 |
this.statsData.cut(this.pVMaxFilter);
|
|
| 219 | 326 |
|
| 220 | 327 |
return true; |
| 221 | 328 |
} |
| 222 |
|
|
| 223 |
/** |
|
| 224 |
* |
|
| 225 |
* @param partition |
|
| 226 |
* @throws Exception |
|
| 227 |
*/ |
|
| 228 |
protected void _computeForPartition(Partition partition) throws Exception {
|
|
| 229 |
//long time = System.currentTimeMillis(); |
|
| 230 |
List<Lexicon> lexicons = new ArrayList<Lexicon>(); |
|
| 231 |
// Set<String> allLexiconEntry = new HashSet<String>(); |
|
| 232 |
for (int i = 0; i < partition.getNPart(); i++) {
|
|
| 233 |
Lexicon l = Lexicon.getLexicon(partition.getParts().get(i), pProperty); |
|
| 234 |
lexicons.add(l); |
|
| 235 |
} |
|
| 236 |
//System.out.println("time lexicon build "+(System.currentTimeMillis()-time));
|
|
| 237 |
//time = System.currentTimeMillis(); |
|
| 238 |
// String[] entries = allLexiconEntry.toArray(new String[]{});
|
|
| 239 |
Corpus c = partition.getCorpus(); |
|
| 240 |
Lexicon ll = Lexicon.getLexicon(c, pProperty); |
|
| 241 |
|
|
| 242 |
ArrayList<String> filteredForms = new ArrayList<String>(); |
|
| 243 |
//create a copy and filter line with Fmin; |
|
| 244 |
for (int i = 0 ; i < ll.getFreq().length ; i++) {
|
|
| 245 |
if (ll.getFreq()[i] >= pFminFilter) {
|
|
| 246 |
filteredForms.add(ll.getForms()[i]); |
|
| 247 |
} |
|
| 248 |
} |
|
| 249 |
//System.out.println("remove freq too low "+(System.currentTimeMillis()-time));
|
|
| 250 |
//time = System.currentTimeMillis(); |
|
| 251 |
Map<String, Integer> entries2index = new HashMap<String, Integer>(); |
|
| 252 |
for (int i = 0; i < filteredForms.size(); i++) {
|
|
| 253 |
entries2index.put(filteredForms.get(i), i); |
|
| 254 |
} |
|
| 255 |
|
|
| 256 |
//System.out.println("entries2index "+(System.currentTimeMillis()-time));
|
|
| 257 |
//time = System.currentTimeMillis(); |
|
| 258 |
int[][] mat = new int[filteredForms.size()][lexicons.size()];//DoubleFactory2D.sparse.make(filteredForms.size(), lexicons.size(), 0); |
|
| 259 |
|
|
| 260 |
|
|
| 261 |
Integer id= null; |
|
| 262 |
for (int i = 0; i < lexicons.size(); i++) {
|
|
| 263 |
Lexicon l = lexicons.get(i); |
|
| 264 |
String[] ents = l.getForms(); |
|
| 265 |
int[] freqs = l.getFreq(); |
|
| 266 |
for (int j = 0; j < freqs.length; j++) {
|
|
| 267 |
id = entries2index.get(ents[j]); |
|
| 268 |
// if (entriesFreqs[id] >= 2) |
|
| 269 |
if (id != null) {
|
|
| 270 |
mat[id][i] = freqs[j]; //mat.setQuick(id, i, freqs[j]); |
|
| 271 |
} |
|
| 272 |
} |
|
| 273 |
} |
|
| 274 |
//System.out.println("time build matrix "+(System.currentTimeMillis()-time));
|
|
| 275 |
//time = System.currentTimeMillis(); |
|
| 276 |
//System.out.println("Entries size " + filteredForms.size());
|
|
| 277 |
//System.out.println("mat size " + mat.rows());
|
|
| 278 |
//System.out.println("mat columns " + mat.columns());
|
|
| 279 |
|
|
| 280 |
this.data = new LexicalTableImpl(mat, filteredForms.toArray(new String[]{}), partition.getPartShortNames().toArray(new String[] {}));
|
|
| 281 |
|
|
| 282 |
} |
|
| 283 |
|
|
| 329 |
|
|
| 284 | 330 |
@Override |
| 285 | 331 |
public boolean canCompute() {
|
| 286 | 332 |
return this.parent != null; // can be computed on partition or corpus |
| ... | ... | |
| 311 | 357 |
@Override |
| 312 | 358 |
public void clean() {
|
| 313 | 359 |
try {
|
| 314 |
RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(data.getSymbol());
|
|
| 360 |
RWorkspace.getRWorkspaceInstance().removeVariableFromWorkspace(statsData.getSymbol());
|
|
| 315 | 361 |
} catch (RWorkspaceException e) {
|
| 316 | 362 |
// TODO Auto-generated catch block |
| 317 | 363 |
e.printStackTrace(); |
| ... | ... | |
| 319 | 365 |
} |
| 320 | 366 |
|
| 321 | 367 |
public Vector getColMarginsVector() throws StatException {
|
| 322 |
return data.getColMarginsVector();
|
|
| 368 |
return statsData.getColMarginsVector();
|
|
| 323 | 369 |
} |
| 324 | 370 |
|
| 325 | 371 |
public Vector getColNames() {
|
| 326 |
return data.getColNames();
|
|
| 372 |
return statsData.getColNames();
|
|
| 327 | 373 |
} |
| 328 | 374 |
|
| 329 | 375 |
/** |
| ... | ... | |
| 341 | 387 |
} |
| 342 | 388 |
|
| 343 | 389 |
public ILexicalTable getData() {
|
| 344 |
return data;
|
|
| 390 |
return statsData;
|
|
| 345 | 391 |
} |
| 346 | 392 |
|
| 347 | 393 |
@Override |
| ... | ... | |
| 350 | 396 |
} |
| 351 | 397 |
|
| 352 | 398 |
public int getFmin() {
|
| 353 |
return pFminFilter;
|
|
| 399 |
return pfMinFilter;
|
|
| 354 | 400 |
} |
| 355 | 401 |
|
| 356 | 402 |
@Override |
| ... | ... | |
| 364 | 410 |
} |
| 365 | 411 |
|
| 366 | 412 |
public int getNColumns() {
|
| 367 |
return data.getNColumns();
|
|
| 413 |
return statsData.getNColumns();
|
|
| 368 | 414 |
} |
| 369 | 415 |
|
| 370 | 416 |
public int getNRows() {
|
| 371 |
return data.getNRows();
|
|
| 417 |
return statsData.getNRows();
|
|
| 372 | 418 |
} |
| 373 | 419 |
|
| 374 | 420 |
/** |
| ... | ... | |
| 398 | 444 |
} |
| 399 | 445 |
|
| 400 | 446 |
public Vector getRow(int i) throws StatException {
|
| 401 |
return data.getRow(i);
|
|
| 447 |
return statsData.getRow(i);
|
|
| 402 | 448 |
} |
| 403 | 449 |
|
| 404 | 450 |
public Vector getRowMarginsVector() throws StatException {
|
| 405 |
return data.getRowMarginsVector();
|
|
| 451 |
return statsData.getRowMarginsVector();
|
|
| 406 | 452 |
} |
| 407 | 453 |
|
| 408 | 454 |
public Vector getRowNames() {
|
| 409 |
return data.getRowNames();
|
|
| 455 |
return statsData.getRowNames();
|
|
| 410 | 456 |
} |
| 411 | 457 |
|
| 412 | 458 |
@Override |
| ... | ... | |
| 415 | 461 |
if (pProperty != null) {
|
| 416 | 462 |
strb.append(pProperty.getName()+" "); |
| 417 | 463 |
} |
| 418 |
if (data != null) {
|
|
| 419 |
strb.append(data.getFmin() + " / " + this.getNRows());
|
|
| 464 |
if (statsData != null) {
|
|
| 465 |
strb.append(statsData.getFmin() + " / " + this.getNRows());
|
|
| 420 | 466 |
} |
| 421 | 467 |
return strb.toString(); |
| 422 | 468 |
} |
| ... | ... | |
| 471 | 517 |
// } |
| 472 | 518 |
|
| 473 | 519 |
public boolean toTxt(File outfile, String encoding, String colseparator, String txtseparator) {
|
| 474 |
return data.toTxt(outfile, encoding, colseparator, txtseparator);
|
|
| 520 |
return statsData.toTxt(outfile, encoding, colseparator, txtseparator);
|
|
| 475 | 521 |
} |
| 476 | 522 |
|
| 477 | 523 |
public void setParameters(Property prop, Integer fmin, Integer vmax, Boolean useAllOccurrences) {
|
| 478 | 524 |
if (prop != null) this.pProperty = prop; |
| 479 |
if (fmin != null) this.pFminFilter = fmin;
|
|
| 525 |
if (fmin != null) this.pfMinFilter = fmin;
|
|
| 480 | 526 |
if (vmax != null) this.pVMaxFilter = vmax; |
| 481 | 527 |
if (useAllOccurrences != null) this.pUseAllOccurrences = useAllOccurrences; |
| 482 | 528 |
|
| 483 | 529 |
this.dirty = true; |
| 484 | 530 |
} |
| 531 |
|
|
| 532 |
@Override |
|
| 533 |
public boolean loadParameters() {
|
|
| 534 |
System.err.println("LexicalTable.loadParameters(): not yet implemented.");
|
|
| 535 |
return true; |
|
| 536 |
} |
|
| 485 | 537 |
} |
| tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/r/data/LexicalTableImpl.java (revision 554) | ||
|---|---|---|
| 171 | 171 |
public void initSortedIndex() {
|
| 172 | 172 |
int ncol = this.getNColumns(); |
| 173 | 173 |
sortedindex = new int[ncol]; |
| 174 |
for (int i = 0; i < ncol; i++) |
|
| 174 |
for (int i = 0; i < ncol; i++) {
|
|
| 175 | 175 |
sortedindex[i] = i; |
| 176 |
} |
|
| 176 | 177 |
} |
| 177 | 178 |
|
| 179 |
// FIXME: should be moved to an importer RCP extension |
|
| 180 |
@Deprecated |
|
| 178 | 181 |
private static int getNline(File f) {
|
| 179 | 182 |
try {
|
| 180 | 183 |
BufferedReader reader = new BufferedReader(new FileReader(f)); |
| ... | ... | |
| 184 | 187 |
i++; |
| 185 | 188 |
} |
| 186 | 189 |
return i; |
| 187 |
} catch (Exception e) { return 0; }
|
|
| 190 |
} catch (Exception e) {
|
|
| 191 |
return 0; |
|
| 192 |
} |
|
| 188 | 193 |
} |
| 189 | 194 |
|
| 190 | 195 |
// /** |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/SVGGraphicEditor.java (revision 554) | ||
|---|---|---|
| 244 | 244 |
svgComp.resetZoom(); |
| 245 | 245 |
} |
| 246 | 246 |
|
| 247 |
@Override |
|
| 248 |
public boolean isResultUsingParent(TXMResult parent) {
|
|
| 249 |
return source.getParent().equals(parent); |
|
| 250 |
} |
|
| 251 | 247 |
|
| 252 |
|
|
| 253 | 248 |
} |
| tmp/org.txm.rcp/src/main/java/org/txm/rcp/editors/TXMEditorPart.java (revision 554) | ||
|---|---|---|
| 15 | 15 |
import org.eclipse.swt.layout.GridLayout; |
| 16 | 16 |
import org.eclipse.swt.layout.RowLayout; |
| 17 | 17 |
import org.eclipse.swt.widgets.Composite; |
| 18 |
import org.eclipse.swt.widgets.Display; |
|
| 18 | 19 |
import org.eclipse.swt.widgets.Menu; |
| 19 | 20 |
import org.eclipse.swt.widgets.TableColumn; |
| 20 | 21 |
import org.eclipse.ui.IEditorInput; |
| ... | ... | |
| 381 | 382 |
job.setPriority(Job.DECORATE); |
| 382 | 383 |
job.setUser(false); |
| 383 | 384 |
job.schedule(); |
| 385 |
// try {
|
|
| 386 |
// job.join(); |
|
| 387 |
// } |
|
| 388 |
// catch (InterruptedException e) {
|
|
| 389 |
// // TODO Auto-generated catch block |
|
| 390 |
// e.printStackTrace(); |
|
| 391 |
// } |
|
| 384 | 392 |
} |
| 385 | 393 |
|
| 386 | 394 |
// FIXME: old code |
| ... | ... | |
| 461 | 469 |
* Synchronizes the editor with the result and refreshes the corpus view. |
| 462 | 470 |
* Also fires a dirty property change. |
| 463 | 471 |
* This method should be overridden to update the editor result UI area after the result computing. |
| 464 |
*/ |
|
| 465 |
public final void refresh() {
|
|
| 466 |
this.refresh(false); |
|
| 467 |
} |
|
| 468 |
|
|
| 469 |
/** |
|
| 470 |
* Synchronizes the editor with the result and refreshes the corpus view. |
|
| 471 |
* Also fires a dirty property change. |
|
| 472 |
* This method should be overridden to update the editor result UI area after the result computing. |
|
| 473 | 472 |
* @param update |
| 474 | 473 |
*/ |
| 475 | 474 |
public void refresh(boolean update) {
|
| 475 |
|
|
| 476 |
Log.info("TXMEditorPart.refresh(): update = " + update);
|
|
| 477 |
|
|
| 476 | 478 |
this.firePropertyChange(IEditorPart.PROP_DIRTY); |
| 477 | 479 |
this.updateEditorFromResult(); |
| 478 | 480 |
CorporaView.refreshObject(this); |
| ... | ... | |
| 580 | 582 |
* @param matchFlags |
| 581 | 583 |
* @return |
| 582 | 584 |
*/ |
| 583 |
public static TXMEditorPart openEditor(TXMResultEditorInput editorInput, String editorPartId, boolean activate, int matchFlags) {
|
|
| 585 |
public static TXMEditorPart openEditor(final TXMResultEditorInput editorInput, String editorPartId, boolean activate, int matchFlags) {
|
|
| 584 | 586 |
|
| 585 |
compute(editorInput.getResult()); |
|
| 587 |
// Display.getDefault().syncExec(new Runnable() {
|
|
| 588 |
// |
|
| 589 |
// @Override |
|
| 590 |
// public void run() {
|
|
| 591 |
// TODO Auto-generated method stub |
|
| 592 |
compute(editorInput.getResult()); |
|
| 593 |
// } |
|
| 594 |
// }); |
|
| 595 |
|
|
| 596 |
|
|
| 597 |
|
|
| 586 | 598 |
TXMEditorPart editor = null; |
| 587 | 599 |
try {
|
| 600 |
|
|
| 601 |
Log.info("TXMEditorPart.openEditor(): opening editor with id " + editorPartId);
|
|
| 602 |
|
|
| 588 | 603 |
IWorkbenchWindow window =TXMWindows.getActiveWindow(); |
| 589 | 604 |
IWorkbenchPage page = window.getActivePage(); |
| 590 | 605 |
editor = (TXMEditorPart) page.openEditor(editorInput, editorPartId, activate, matchFlags); |
| 591 | 606 |
} catch (Exception e) {
|
| 592 |
System.out.println("Error: could not open editor: "+e.getLocalizedMessage());
|
|
| 607 |
System.err.println("TXMEditorPart.openEditor(): could not open editor: " + e.getLocalizedMessage());
|
|
| 593 | 608 |
org.txm.rcp.utils.Logger.printStackTrace(e); |
| 594 | 609 |
} |
| 595 | 610 |
return editor; |
| tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Chi2.java (revision 554) | ||
|---|---|---|
| 71 | 71 |
return true; |
| 72 | 72 |
} |
| 73 | 73 |
|
| 74 |
@Override |
|
| 75 |
public boolean loadParameters() {
|
|
| 76 |
// TODO Auto-generated method stub |
|
| 77 |
System.err.println("Chi2.loadParameters(): not yet implemented.");
|
|
| 78 |
return true; |
|
| 79 |
} |
|
| 80 |
|
|
| 81 |
|
|
| 74 | 82 |
} |
| tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/Specificites2.java (revision 554) | ||
|---|---|---|
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 | 71 |
|
| 72 |
@Override |
|
| 73 |
public boolean loadParameters() {
|
|
| 74 |
// TODO Auto-generated method stub |
|
| 75 |
System.err.println("Specificites2.loadParameters(): not yet implemented.");
|
|
| 76 |
return true; |
|
| 77 |
} |
|
| 78 |
|
|
| 72 | 79 |
} |
| tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/RelativeFrequency.java (revision 554) | ||
|---|---|---|
| 70 | 70 |
return true; |
| 71 | 71 |
} |
| 72 | 72 |
|
| 73 |
|
|
| 73 |
@Override |
|
| 74 |
public boolean loadParameters() {
|
|
| 75 |
// TODO Auto-generated method stub |
|
| 76 |
System.err.println("RelativeFrequency.loadParameters(): not yet implemented.");
|
|
| 77 |
return true; |
|
| 78 |
} |
|
| 79 |
|
|
| 74 | 80 |
} |
| tmp/org.txm.specificities.core/src/org/txm/functions/contrasts/AbsoluteFrequency.java (revision 554) | ||
|---|---|---|
| 68 | 68 |
return true; |
| 69 | 69 |
} |
| 70 | 70 |
|
| 71 |
@Override |
|
| 72 |
public boolean loadParameters() {
|
|
| 73 |
// TODO Auto-generated method stub |
|
| 74 |
System.err.println("AbsoluteFrequency.loadParameters(): not yet implemented.");
|
|
| 75 |
return true; |
|
| 76 |
} |
|
| 77 |
|
|
| 71 | 78 |
} |
| tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/SpecificitiesSelection.java (revision 554) | ||
|---|---|---|
| 158 | 158 |
return true; |
| 159 | 159 |
} |
| 160 | 160 |
|
| 161 |
|
|
| 161 |
@Override |
|
| 162 |
public boolean loadParameters() {
|
|
| 163 |
// TODO Auto-generated method stub |
|
| 164 |
System.err.println("SpecificitiesSelection.loadParameters(): not yet implemented.");
|
|
| 165 |
return true; |
|
| 166 |
} |
|
| 162 | 167 |
|
| 168 |
|
|
| 163 | 169 |
|
| 164 | 170 |
/* (non-Javadoc) |
| 165 | 171 |
* @see org.txm.core.results.TXMResult#toTxt(java.io.File, java.lang.String, java.lang.String, java.lang.String) |
| tmp/org.txm.specificities.core/src/org/txm/specificities/core/functions/Specificities.java (revision 554) | ||
|---|---|---|
| 43 | 43 |
import org.txm.lexicon.core.corpusengine.cqp.Lexicon; |
| 44 | 44 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
| 45 | 45 |
import org.txm.searchengine.cqp.corpus.Corpus; |
| 46 |
import org.txm.searchengine.cqp.corpus.Subcorpus; |
|
| 47 | 46 |
import org.txm.specificities.core.messages.SpecificitiesCoreMessages; |
| 48 | 47 |
import org.txm.specificities.core.statsengine.r.function.SpecificitiesR; |
| 49 | 48 |
import org.txm.statsengine.core.StatException; |
| ... | ... | |
| 68 | 67 |
private double[][] indices; |
| 69 | 68 |
|
| 70 | 69 |
/** The table. */ |
| 71 |
private LexicalTable table;
|
|
| 70 |
private LexicalTable lexicalTable;
|
|
| 72 | 71 |
|
| 73 | 72 |
/** The rowindex. */ |
| 74 | 73 |
private int[] rowindex = null; |
| ... | ... | |
| 103 | 102 |
/** The symbol. */ |
| 104 | 103 |
private String symbol; |
| 105 | 104 |
|
| 106 |
/** The subcorpus. */ |
|
| 107 |
private Corpus subcorpus; |
|
| 108 |
|
|
| 109 | 105 |
/** The writer. */ |
| 110 | 106 |
@Deprecated |
| 111 | 107 |
private BufferedWriter writer; |
| ... | ... | |
| 124 | 120 |
*/ |
| 125 | 121 |
public Specificities(LexicalTable table, int maxScore) throws CqiClientException, StatException {
|
| 126 | 122 |
super(table); |
| 127 |
this.table = table;
|
|
| 123 |
this.lexicalTable = table;
|
|
| 128 | 124 |
this.pMaxScore = maxScore; |
| 129 | 125 |
} |
| 130 | 126 |
|
| ... | ... | |
| 133 | 129 |
|
| 134 | 130 |
@Override |
| 135 | 131 |
protected boolean _compute(boolean update) throws Exception {
|
| 136 |
SpecificitiesR si = new SpecificitiesR(table.getData()); |
|
| 132 |
|
|
| 133 |
// compute the lexical table |
|
| 134 |
lexicalTable.compute(update); |
|
| 135 |
|
|
| 136 |
if (lexicalTable.getNColumns() < 2) {
|
|
| 137 |
Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS); |
|
| 138 |
return false; |
|
| 139 |
} |
|
| 140 |
|
|
| 141 |
SpecificitiesR si = new SpecificitiesR(lexicalTable.getData()); |
|
| 137 | 142 |
|
| 138 | 143 |
double[][] specIndex = si.getScores(); |
| 139 | 144 |
|
| 140 |
if (table.getPartition() != null) {
|
|
| 145 |
if (lexicalTable.getPartition() != null) {
|
|
| 141 | 146 |
// System.out.println("table="+table);
|
| 142 | 147 |
// System.out.println("rows="+table.getRowNames());
|
| 143 | 148 |
// System.out.println("cols="+table.getColNames());
|
| 144 | 149 |
// System.out.println("prop="+table.getProperty());
|
| 145 |
init(symbol, specIndex, table, Arrays
|
|
| 146 |
.asList(table.getRowNames().asStringsArray()), Arrays.asList(table.getColNames().asStringsArray()), table.getProperty().getName(), this.pMaxScore);
|
|
| 150 |
init(symbol, specIndex, lexicalTable, Arrays
|
|
| 151 |
.asList(lexicalTable.getRowNames().asStringsArray()), Arrays.asList(lexicalTable.getColNames().asStringsArray()), lexicalTable.getProperty().getName(), this.pMaxScore);
|
|
| 147 | 152 |
} |
| 148 | 153 |
else {
|
| 149 |
init(si.getSymbol(), specIndex, table, Arrays
|
|
| 150 |
.asList(table.getRowNames().asStringsArray()), Arrays.asList(table.getColNames().asStringsArray()),
|
|
| 151 |
"TLNONAME: " + table.getProperty().getName(), this.pMaxScore); //$NON-NLS-1$
|
|
| 154 |
init(si.getSymbol(), specIndex, lexicalTable, Arrays
|
|
| 155 |
.asList(lexicalTable.getRowNames().asStringsArray()), Arrays.asList(lexicalTable.getColNames().asStringsArray()),
|
|
| 156 |
"TLNONAME: " + lexicalTable.getProperty().getName(), this.pMaxScore); //$NON-NLS-1$
|
|
| 152 | 157 |
} |
| 153 | 158 |
return true; |
| 154 | 159 |
} |
| ... | ... | |
| 171 | 176 |
*/ |
| 172 | 177 |
protected void init(String symbol, double[][] specIndex, LexicalTable table, List<String> typeFocus, List<String> partFocus, String name, int maxScore) throws StatException {
|
| 173 | 178 |
|
| 174 |
this.table = table;
|
|
| 179 |
this.lexicalTable = table;
|
|
| 175 | 180 |
this.symbol = symbol; |
| 176 | 181 |
|
| 177 | 182 |
if (table == null) {
|
| ... | ... | |
| 188 | 193 |
} |
| 189 | 194 |
|
| 190 | 195 |
this.indices = specIndex; |
| 191 |
this.table = table;
|
|
| 196 |
this.lexicalTable = table;
|
|
| 192 | 197 |
this.colnames = partFocus; |
| 193 | 198 |
this.rownames = typeFocus; |
| 194 | 199 |
|
| ... | ... | |
| 267 | 272 |
* @throws StatException the stat exception |
| 268 | 273 |
*/ |
| 269 | 274 |
public int getNbrPart() throws StatException {
|
| 270 |
if (table != null)
|
|
| 271 |
return table.getNColumns();
|
|
| 275 |
if (lexicalTable != null)
|
|
| 276 |
return lexicalTable.getNColumns();
|
|
| 272 | 277 |
else |
| 273 | 278 |
return getPartShortNames().length; |
| 274 | 279 |
} |
| ... | ... | |
| 280 | 285 |
* @throws StatException the stat exception |
| 281 | 286 |
*/ |
| 282 | 287 |
public int getCorpusSize() throws StatException {
|
| 283 |
return table != null ? table.getData().getTotal() : lexicon.nbrOfToken();
|
|
| 288 |
return lexicalTable != null ? lexicalTable.getData().getTotal() : lexicon.nbrOfToken();
|
|
| 284 | 289 |
} |
| 285 | 290 |
|
| 286 | 291 |
/** |
| ... | ... | |
| 299 | 304 |
* @throws StatException the stat exception |
| 300 | 305 |
*/ |
| 301 | 306 |
public String[] getTypeNames() throws StatException {
|
| 302 |
if (table != null) {
|
|
| 303 |
return (rownames != null && rownames.size() != 0) ? rownames.toArray(new String[] {}) : table.getRowNames().asStringsArray();
|
|
| 307 |
if (lexicalTable != null) {
|
|
| 308 |
return (rownames != null && rownames.size() != 0) ? rownames.toArray(new String[] {}) : lexicalTable.getRowNames().asStringsArray();
|
|
| 304 | 309 |
} else {
|
| 305 | 310 |
return lexicon.getForms(); |
| 306 | 311 |
} |
| ... | ... | |
| 318 | 323 |
if (colnames != null && colnames.size() > 0) {
|
| 319 | 324 |
return colnames.toArray(new String[]{});
|
| 320 | 325 |
} |
| 321 |
else if (table != null) {
|
|
| 326 |
else if (lexicalTable != null) {
|
|
| 322 | 327 |
// return (colnames != null && colnames.size() != 0) ? |
| 323 | 328 |
// colnames.toArray(new String[]{}) :
|
| 324 | 329 |
// table.getColNames().asStringsArray(); |
| ... | ... | |
| 328 | 333 |
* partShortNames.length; i++) { partShortNames[i] =
|
| 329 | 334 |
* parts.get(i).getShortName(); } |
| 330 | 335 |
*/ |
| 331 |
return table.getColNames().asStringsArray();
|
|
| 336 |
return lexicalTable.getColNames().asStringsArray();
|
|
| 332 | 337 |
} else if (this.subCorpus != null) {
|
| 333 |
return new String[] { this.subCorpus.getName(),this.corpus.getName() + " \\ " + this.subCorpus.getName() }; //$NON-NLS-1$
|
|
| 338 |
return new String[] { this.subCorpus.getName(), this.corpus.getName() + " \\ " + this.subCorpus.getName() }; //$NON-NLS-1$
|
|
| 334 | 339 |
} |
| 335 | 340 |
return new String[0]; |
| 336 | 341 |
} |
| ... | ... | |
| 345 | 350 |
//System.out.println("GET FREQUENCIES");
|
| 346 | 351 |
if (frequencies == null) {
|
| 347 | 352 |
//System.out.println("no frequencies");
|
| 348 |
if (table != null) {
|
|
| 353 |
if (lexicalTable != null) {
|
|
| 349 | 354 |
//System.out.println("FROM TABLE");
|
| 350 |
frequencies = RWorkspace.getRWorkspaceInstance().evalToInt2D(table.getData().getSymbol());
|
|
| 355 |
frequencies = RWorkspace.getRWorkspaceInstance().evalToInt2D(lexicalTable.getData().getSymbol());
|
|
| 351 | 356 |
|
| 352 | 357 |
} else {// if table == null : subcorpus specif
|
| 353 | 358 |
//System.out.println("FROM LEXICON");
|
| ... | ... | |
| 381 | 386 |
* @return the lexical table |
| 382 | 387 |
*/ |
| 383 | 388 |
public LexicalTable getLexicalTable() {
|
| 384 |
return table;
|
|
| 389 |
return lexicalTable;
|
|
| 385 | 390 |
} |
| 386 | 391 |
|
| 387 | 392 |
/** |
| ... | ... | |
| 400 | 405 |
* @throws StatException the stat exception |
| 401 | 406 |
*/ |
| 402 | 407 |
public int[] getPartSizes() throws StatException {
|
| 403 |
if (table != null) {
|
|
| 404 |
Vector partsize = table.getColMarginsVector();
|
|
| 408 |
if (lexicalTable != null) {
|
|
| 409 |
Vector partsize = lexicalTable.getColMarginsVector();
|
|
| 405 | 410 |
if (colindex != null) {
|
| 406 | 411 |
partsize = partsize.get(colindex); |
| 407 | 412 |
} |
| ... | ... | |
| 419 | 424 |
* @throws StatException the stat exception |
| 420 | 425 |
*/ |
| 421 | 426 |
public int[] getFormFrequencies() throws StatException {
|
| 422 |
if (table != null) {
|
|
| 427 |
if (lexicalTable != null) {
|
|
| 423 | 428 |
//System.out.println("get freq by table");
|
| 424 |
Vector formFrequencies = table.getRowMarginsVector();
|
|
| 429 |
Vector formFrequencies = lexicalTable.getRowMarginsVector();
|
|
| 425 | 430 |
if (rowindex != null) {
|
| 426 | 431 |
formFrequencies = formFrequencies.get(rowindex); |
| 427 | 432 |
} |
| ... | ... | |
| 486 | 491 |
return true; |
| 487 | 492 |
} |
| 488 | 493 |
|
| 489 |
/** |
|
| 490 |
* Sets the corpus. |
|
| 491 |
* |
|
| 492 |
* @param subcorpus2 the new corpus |
|
| 493 |
*/ |
|
| 494 |
public void setCorpus(Subcorpus subcorpus2) {
|
|
| 495 |
this.subcorpus = subcorpus2; |
|
| 496 |
} |
|
| 497 | 494 |
|
| 498 |
/** |
|
| 499 |
* Gets the corpus. |
|
| 500 |
* |
|
| 501 |
* @return the corpus |
|
| 502 |
*/ |
|
| 503 |
public Corpus getCorpus() {
|
|
| 504 |
return subcorpus; |
|
| 505 |
} |
|
| 506 | 495 |
|
| 507 | 496 |
@Override |
| 508 | 497 |
public void clean() {
|
| ... | ... | |
| 594 | 583 |
@Override |
| 595 | 584 |
public boolean canCompute() {
|
| 596 | 585 |
|
| 597 |
if(this.table == null) {
|
|
| 586 |
if(this.lexicalTable == null) {
|
|
| 598 | 587 |
return false; |
| 599 | 588 |
} |
| 600 | 589 |
|
| 601 |
if (table.getNColumns() < 2) {
|
|
| 602 |
Log.severe(SpecificitiesCoreMessages.ComputeError_NEED_AT_LEAST_2_PARTS); |
|
| 603 |
return false; |
|
| 604 |
} |
|
| 605 |
|
|
| 606 | 590 |
return true; |
| 607 | 591 |
} |
| 608 | 592 |
|
| ... | ... | |
| 631 | 615 |
return true; |
| 632 | 616 |
} |
| 633 | 617 |
|
| 618 |
|
|
| 619 |
|
|
| 620 |
|
|
| 621 |
@Override |
|
| 622 |
public boolean loadParameters() {
|
|
| 623 |
// TODO Auto-generated method stub |
|
| 624 |
System.err.println("Specificities.loadParameters(): not yet implemented.");
|
|
| 625 |
return true; |
|
| 626 |
} |
|
| 627 |
|
|
| 634 | 628 |
|
| 635 | 629 |
|
| 636 | 630 |
|
| tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 554) | ||
|---|---|---|
| 116 | 116 |
} |
| 117 | 117 |
|
| 118 | 118 |
/** |
| 119 |
* Creates a new TXMResult with no parent. |
|
| 120 |
*/ |
|
| 121 |
public TXMResult() {
|
|
| 122 |
this(null); |
|
| 123 |
} |
|
| 124 |
|
|
| 125 |
/** |
|
| 119 | 126 |
* Creates and stores an UUID dedicated to persistence for this result. |
| 120 | 127 |
*/ |
| 121 | 128 |
protected void createUUID() {
|
| ... | ... | |
| 200 | 207 |
} |
| 201 | 208 |
} |
| 202 | 209 |
|
| 203 |
|
|
| 204 | 210 |
/** |
| 205 |
* |
|
| 206 |
* @param parent |
|
| 207 |
* @return true this object is connected to the parent |
|
| 208 |
*/ |
|
| 209 |
// FIXME: what is the usage of this method? |
|
| 210 |
// public boolean isUsingParent(TXMResult parent) {
|
|
| 211 |
// if (this == parent) {
|
|
| 212 |
// return true; |
|
| 213 |
// } |
|
| 214 |
// else if (this.parent == null) {
|
|
| 215 |
// return false; |
|
| 216 |
// } |
|
| 217 |
// else {
|
|
| 218 |
// return this.parent.isUsingParent(parent); |
|
| 219 |
// } |
|
| 220 |
// } |
|
| 221 |
|
|
| 222 |
/** |
|
| 223 | 211 |
* Gets the preferences node qualifier of the result command. |
| 224 | 212 |
* |
| 225 | 213 |
* @return |
| ... | ... | |
| 910 | 898 |
this.dirty = false; // the computing was successful, the result is no more dirty |
| 911 | 899 |
this.hasBeenComputedOnce = true; |
| 912 | 900 |
// FIXME: Debug |
| 913 |
System.err.println("TXMResult.compute(): computing done.");
|
|
| 901 |
System.err.println("TXMResult.compute(): computing of result type " + this.getClass() + " done.");
|
|
| 914 | 902 |
|
| 915 | 903 |
return true; |
| 916 | 904 |
} |
| tmp/org.txm.chartsengine.rcp/src/org/txm/chartsengine/rcp/editors/ChartEditorPart.java (revision 554) | ||
|---|---|---|
| 163 | 163 |
//this.composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); |
| 164 | 164 |
//parent.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); |
| 165 | 165 |
|
| 166 |
this.refresh(); |
|
| 166 |
this.refresh(false);
|
|
| 167 | 167 |
// |
| 168 | 168 |
// } |
| 169 | 169 |
|
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/handlers/ComputeSpecifities.java (revision 554) | ||
|---|---|---|
| 31 | 31 |
import org.eclipse.core.commands.ExecutionException; |
| 32 | 32 |
import org.txm.core.preferences.TXMPreferences; |
| 33 | 33 |
import org.txm.lexicaltable.core.functions.LexicalTable; |
| 34 |
import org.txm.lexicaltable.core.functions.LexicalTableFactory; |
|
| 35 | 34 |
import org.txm.lexicaltable.core.preferences.LexicalTablePreferences; |
| 35 |
import org.txm.lexicaltable.rcp.editors.LexicalTableEditor; |
|
| 36 | 36 |
import org.txm.rcp.RCPMessages; |
| 37 | 37 |
import org.txm.rcp.editors.TXMEditorPart; |
| 38 | 38 |
import org.txm.rcp.handlers.BaseAbstractHandler; |
| ... | ... | |
| 87 | 87 |
else {
|
| 88 | 88 |
LexicalTable lexicalTable = null; |
| 89 | 89 |
|
| 90 |
String defautProperty = "word"; |
|
| 91 |
|
|
| 92 | 90 |
final Integer maxScore = TXMPreferences.getInt(SpecificitiesPreferences.MAX_SCORE, SpecificitiesPreferences.PREFERENCES_NODE); |
| 93 | 91 |
int fMin = TXMPreferences.getInt(LexicalTablePreferences.F_MIN, LexicalTablePreferences.PREFERENCES_NODE); |
| 92 |
int vMax = TXMPreferences.getInt(LexicalTablePreferences.V_MAX, LexicalTablePreferences.PREFERENCES_NODE); |
|
| 94 | 93 |
|
| 95 | 94 |
// creating from Partition |
| 96 | 95 |
if (selection instanceof Partition) {
|
| 97 | 96 |
Partition partition = (Partition) selection; |
| 98 |
lexicalTable = LexicalTableFactory.getLexicalTable(partition, partition.getCorpus().getProperty(defautProperty), fMin); |
|
| 97 |
//lexicalTable = LexicalTableFactory.getLexicalTable(partition, partition.getCorpus().getProperty(defautProperty), fMin); |
|
| 98 |
lexicalTable = new LexicalTable(partition, partition.getCorpus().getDefaultProperty(), fMin, vMax); |
|
| 99 | 99 |
} |
| 100 | 100 |
// creating from Subcorpus |
| 101 | 101 |
else if (selection instanceof Subcorpus) {
|
| 102 | 102 |
Subcorpus corpus = (Subcorpus) selection; |
| 103 |
lexicalTable = LexicalTableFactory.getLexicalTable(corpus, corpus.getProperty(defautProperty)); |
|
| 103 |
//lexicalTable = LexicalTableFactory.getLexicalTable(corpus, corpus.getProperty(defautProperty)); |
|
| 104 |
lexicalTable = new LexicalTable(corpus, corpus.getDefaultProperty()); |
|
| 104 | 105 |
} |
| 105 | 106 |
// creating from Lexical Table |
| 106 | 107 |
else if (selection instanceof LexicalTable) {
|
| ... | ... | |
| 112 | 113 |
return null; |
| 113 | 114 |
} |
| 114 | 115 |
specificities = new Specificities(lexicalTable, maxScore); |
| 116 |
|
|
| 115 | 117 |
} |
| 116 | 118 |
|
| 117 | 119 |
TXMEditorPart.openEditor(specificities, SpecificitiesEditor.ID); |
| tmp/org.txm.specificities.rcp/src/org/txm/specificities/rcp/editors/SpecificitiesEditor.java (revision 554) | ||
|---|---|---|
| 36 | 36 |
import org.eclipse.jface.viewers.Viewer; |
| 37 | 37 |
import org.eclipse.osgi.util.NLS; |
| 38 | 38 |
import org.eclipse.swt.SWT; |
| 39 |
import org.eclipse.swt.events.SelectionEvent; |
|
| 40 |
import org.eclipse.swt.events.SelectionListener; |
|
| 41 | 39 |
import org.eclipse.swt.layout.GridData; |
| 42 | 40 |
import org.eclipse.swt.layout.GridLayout; |
| 43 | 41 |
import org.eclipse.swt.widgets.Composite; |
| ... | ... | |
| 47 | 45 |
import org.eclipse.swt.widgets.Spinner; |
| 48 | 46 |
import org.eclipse.swt.widgets.Table; |
| 49 | 47 |
import org.eclipse.swt.widgets.TableColumn; |
| 50 |
import org.txm.core.results.TXMResult; |
|
| 51 | 48 |
import org.txm.objects.TxmObject; |
Formats disponibles : Unified diff