Révision 1090

tmp/org.txm.index.core/src/org/txm/index/core/functions/Lexicon.java (revision 1090)
104 104
	 * @param parent
105 105
	 */
106 106
	public Lexicon(Corpus parent)	{
107
		super(parent);
107
		this(null, parent);
108 108
	}
109 109

  
110 110
	/**
......
112 112
	 * @param uuid
113 113
	 */
114 114
	public Lexicon(String uuid)	{
115
		super(uuid);
115
		this(uuid, null);
116 116
	}
117 117
	
118
	/**
119
	 * 
120
	 * @param uuid
121
	 * @param parent
122
	 */
123
	public Lexicon(String uuid, TXMResult parent)	{
124
		super(uuid, parent);
125
	}
126

  
127
	
118 128
	@Override
119 129
	public Corpus getParent() {
120 130
		return (Corpus)super.getParent();
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 1090)
123 123

  
124 124
	// contains the sum of distances
125 125
	/** The distancescounts. */
126
	HashMap<String, Integer> distancescounts = new HashMap<String, Integer>();
126
	HashMap<String, Integer> distancesCounts = new HashMap<String, Integer>();
127 127

  
128 128
	/** The FA. */
129 129
	int FA = -1;
......
210 210
	@Parameter(key=CooccurrencePreferences.MIN_RIGHT)
211 211
	protected Integer pMinRightContextSize;
212 212
	
213
	/** The cooccurents properties to show. */
213
	/** The cooccurrents properties to display. */
214 214
	@Parameter(key=CooccurrencePreferences.UNIT_PROPERTIES)
215 215
	protected List<WordProperty> pProperties;
216 216
	
......
222 222
	@Parameter(key=CooccurrencePreferences.MIN_SCORE)
223 223
	protected Double pScoreMinFilter;
224 224
	
225
	/** The structural unit context limit. */
225
	/**
226
	 * The structural unit context limit.
227
	 * In null then the unit property is used. 
228
	 */
226 229
	@Parameter(key=CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT, electric=false)
227 230
	protected StructuralUnit pStructuralUnitLimit;
228 231

  
......
245 248

  
246 249

  
247 250

  
248
	/**
249
	 * 
250
	 * @param watcher
251
	 * @param pQuery
252
	 * @param pProperties
253
	 * @param pStructuralUnitLimit
254
	 * @param minleft
255
	 * @param maxleft
256
	 * @param minright
257
	 * @param maxright
258
	 * @param minf
259
	 * @param minscore
260
	 * @param mincof
261
	 * @param pIncludeXpivot
262
	 * @param buildLexicalTableWithCooccurrents
263
	 * @return
264
	 * @throws CqiClientException 
265
	 * @throws CqiServerError 
266
	 * @throws IOException 
267
	 * @throws StatException 
268
	 */
251
	@Override
269 252
	protected boolean _compute() throws CqiClientException, IOException, CqiServerError, StatException {
270 253
		//FIXME: debug
271 254
		//System.out.println("cooc: "+corpus+" "+query+" "+properties+" "+limit+" "+maxLeft+" "+minLeft+" "+minRight+" "+maxRight+" "+minFreq+" "+minCof+" "+minScore+" "+includeXpivot);
......
282 265
			this.counts.clear();
283 266
			this.dist.clear();
284 267
			this.distances.clear();
285
			this.distancescounts.clear();
268
			this.distancesCounts.clear();
286 269
			this.indexfreqs.clear();
287 270
			this.keysToString.clear();
288 271
			this.occproperties.clear();
......
416 399
	//FIXME: useless? 
417 400
	public void clearMemory() {
418 401
		if (distances != null) distances.clear();
419
		if (distancescounts != null) distancescounts.clear();
402
		if (distancesCounts != null) distancesCounts.clear();
420 403
		if (counts != null) counts.clear();
421 404
		if (indexfreqs != null) indexfreqs.clear();
422 405
		if (counted != null) counted.clear();
......
655 638
	}
656 639

  
657 640
	/**
658
	 * Gets the structure.
641
	 * Gets the structural unit limit.
659 642
	 *
660 643
	 * @return the structure
661 644
	 */
662
	public StructuralUnit getStructure() {
645
	public StructuralUnit getStructuralUnitLimit() {
663 646
		return this.pStructuralUnitLimit;
664 647
	}
665 648

  
......
816 799
			boolean includeXpivot = (Boolean) parameters.getBoolean(CooccurrencePreferences.INCLUDE_X_PIVOT);
817 800
			
818 801
			String queryString = ""; //$NON-NLS-1$
819
			if(parameters.get(CooccurrencePreferences.QUERY) != null)	{
820
				queryString = parameters.get(CooccurrencePreferences.QUERY).toString();
802
			if(parameters.get(TXMPreferences.QUERY) != null)	{
803
				queryString = parameters.get(TXMPreferences.QUERY).toString();
821 804
			}
822 805
			CQLQuery query = new CQLQuery(queryString);
823 806
			
......
856 839
	}
857 840

  
858 841
	/**
859
	 * Sets the structure.
842
	 * Sets the structural unit limit.
860 843
	 *
861 844
	 * @param su the new structure
862 845
	 */
863
	public void setStructure(StructuralUnit su) {
846
	public void setStructuralUnitLimt(StructuralUnit su) {
864 847
		pStructuralUnitLimit = su;
865 848
	}
866 849

  
......
1154 1137

  
1155 1138
				if (!distances.containsKey(signaturestr)) {
1156 1139
					distances.put(signaturestr, 0.0);
1157
					distancescounts.put(signaturestr, 0);
1140
					distancesCounts.put(signaturestr, 0);
1158 1141
				}
1159 1142

  
1160 1143
				if (counted.containsKey(position)) {
......
1179 1162
					}
1180 1163

  
1181 1164
					distances.put(signaturestr, (distances.get(signaturestr)) + dist);
1182
					distancescounts.put(signaturestr, (distancescounts.get(signaturestr)) + 1);
1165
					distancesCounts.put(signaturestr, (distancesCounts.get(signaturestr)) + 1);
1183 1166

  
1184 1167
				}
1185 1168

  
......
1268 1251
			if (counts.containsKey(signaturestr)) {
1269 1252
				CLine cline = new CLine(this, specifrownames[ii], props, counts
1270 1253
						.get(signaturestr), indexfreqs.get(specifrownames[ii]), scores[ii][1],
1271
						((float) (distances.get(signaturestr) / distancescounts
1254
						((float) (distances.get(signaturestr) / distancesCounts
1272 1255
								.get(signaturestr))) - 1.0f, -1);
1273 1256
				//System.out.println(cline);
1274 1257
				if (cline.freq >= this.pFminFilter	&& cline.nbocc >= this.pFCoocFilter && cline.score >= 0 && cline.score >= this.pScoreMinFilter) {
......
1486 1469
		if (this.getIncludeXPivot() && maxempan == 0) maxempan = 1;  
1487 1470
		
1488 1471
		String maxempanstr = "within " + maxempan + " "; //$NON-NLS-1$ //$NON-NLS-2$
1489
		if (this.getStructure() != null) maxempanstr += this.getStructure().getName(); 
1472
		if (this.getStructuralUnitLimit() != null) maxempanstr += this.getStructuralUnitLimit().getName(); 
1490 1473
		
1491 1474
		query = "("+this.getQuery()+" []* "+query+") | ("+query+" []* "+this.getQuery()+") "+maxempanstr; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
1492 1475
		
tmp/org.txm.searchengine.cqp.core/src/org/txm/searchengine/cqp/corpus/Partition.java (revision 1090)
809 809
	}
810 810

  
811 811

  
812
	/**
813
	 * Returns the first parent object that is a Partition.
814
	 * Returns the object itself if its class is one of the the three listed below.
815
	 * @return
816
	 */
817
	synchronized public static Partition getFirstParentPartition(TXMResult result) {
818
		return (Partition) result.getFirstParent(Partition.class);
819
	}
812 820

  
813 821
}
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/statsengine/r/data/LexicalTableImpl.java (revision 1090)
143 143
		//TODO: implement the R function : rw.callFunction("lexicons2LexicalTable", new QuantitativeDataStructure[] { corpusLexiconV, subcorpusLexiconV }, symbol); //$NON-NLS-1$
144 144
		
145 145
		rw.eval(symbol+" <- matrix(0, ncol = 2, nrow=length("+corpusLexiconV.getSymbol()+"))");
146
		rw.eval("colnames("+symbol+") <- c(\""+corpusLexicon.getCorpus().getName()+"-"+subcorpusLexicon.getCorpus().getName()+"\", \""+subcorpusLexicon.getCorpus().getName()+"\")");
146
		rw.eval("colnames("+symbol+") <- c(\""+corpusLexicon.getParent().getName()+"-"+subcorpusLexicon.getParent().getName()+"\", \""+subcorpusLexicon.getParent().getName()+"\")");
147 147
		System.out.println("forms: "+Arrays.toString(corpusLexicon.getForms()));
148 148
		rw.addVectorToWorkspace("ltnames", corpusLexicon.getForms());
149 149
		rw.eval("rownames("+symbol+") <- ltnames");
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 1090)
455 455
		}
456 456
	}
457 457

  
458
	/**
459
	 * Get the corpus this lexical table is bound to.
460
	 * 
461
	 * @return the corpus or null if the LexicalTable was build without a Corpus or thiout a Partition (built with a Corpus)
462
	 */
463
	public Corpus getCorpus() {
464
		return Corpus.getFirstParentCorpus(this);
465
	}
466 458

  
467 459
	public ILexicalTable getData() {
468 460
		return statsData;
......
522 514
	}
523 515

  
524 516
	/**
525
	 * Gets the partition this lexical table is bound to.
517
	 * Gets the corpus used by this lexical table.
526 518
	 * 
519
	 * @return the corpus
520
	 */
521
	public Corpus getCorpus() {
522
		return Corpus.getFirstParentCorpus(this);
523
	}
524

  
525
	
526
	/**
527
	 * Gets the parent partition of this lexical table.
528
	 * 
527 529
	 * @return the partition
528 530
	 */
529 531
	public Partition getPartition() {
530
		if (parent instanceof Partition) {
531
			return ((Partition)parent);
532
		}
533
		if (parent instanceof Index) {
534
			return ((Index)parent).getPartition();
535
		}
536
		else {
537
			return null;
538
		}
532
		return Partition.getFirstParentPartition(this);
539 533
	}
540 534

  
541 535
	/**
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorporaDirectory.java (revision 1090)
175 175
						@Override
176 176
						public void run() {
177 177
							RestartTXM.reloadViews();
178
							System.err.println(TXMUIMessages.AddBase_10);
179
							StatusLine.setMessage(TXMUIMessages.AddBase_10);
178
							System.err.println(TXMUIMessages.info_txmIsReady);
179
							StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
180 180
						}
181 181
					});
182 182
				} catch (ThreadDeath td) { 
tmp/org.txm.rcp/src/main/java/org/txm/rcp/commands/workspace/LoadBinaryCorpus.java (revision 1090)
246 246
							RestartTXM.reloadViews();
247 247
							//System.out.println("Select newly loaded corpus: "+base2.getCorpora().values());
248 248
							CorporaView.select(base2.getChildren(MainCorpus.class));
249
							System.err.println(TXMUIMessages.AddBase_10);
250
							StatusLine.setMessage(TXMUIMessages.AddBase_10);
249
							System.err.println(TXMUIMessages.info_txmIsReady);
250
							StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
251 251
						}
252 252
					});
253 253
				} catch (ThreadDeath td) { 
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/results/DeleteObject.java (revision 1090)
58 58
import org.txm.rcp.messages.TXMUIMessages;
59 59
import org.txm.rcp.preferences.RCPPreferences;
60 60
import org.txm.rcp.utils.JobHandler;
61
import org.txm.rcp.views.corpora.CorporaView;
61 62
import org.txm.searchengine.cqp.corpus.Corpus;
62 63
import org.txm.searchengine.cqp.corpus.MainCorpus;
63 64
import org.txm.searchengine.cqp.corpus.Partition;
......
187 188
				org.txm.Toolbox.restartWorkspace(null);
188 189
				Toolbox.getEngineManager(EngineType.SEARCH).restartEngines();
189 190
				
190
				Log.info(TXMUIMessages.AddBase_10);
191
				StatusLine.setMessage(TXMUIMessages.AddBase_10);
191
				Log.info(TXMUIMessages.info_txmIsReady);
192
				StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
192 193
			}
193 194
			
194 195
			Display.getDefault().syncExec(new Runnable() {
195 196
				@Override
196 197
				public void run() {
197 198
					try {
199
						// FIXME: why this is commented? became useless? I needed to add the line below for the refresh CorporaView.refresh();
198 200
//						RestartTXM.reloadViews();
199 201
						
202
						CorporaView.refresh();
203
						
200 204
						//close corresponding editors
201 205
						for(Object obj : allObjectDeleted) {
202 206
							closeEditorOfSelection(obj);
tmp/org.txm.rcp/src/main/java/org/txm/rcp/handlers/scripts/ExecuteImportScript.java (revision 1090)
284 284
								public void run() {
285 285
									RestartTXM.reloadViews();
286 286
									CorporaView.select(base2.getChildren(MainCorpus.class));
287
									System.out.println(TXMUIMessages.AddBase_10);
288
									StatusLine.setMessage(TXMUIMessages.AddBase_10);
287
									System.out.println(TXMUIMessages.info_txmIsReady);
288
									StatusLine.setMessage(TXMUIMessages.info_txmIsReady);
289 289
								}
290 290
							});
291 291
							this.releaseSemaphore();
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/TXMUIMessages.java (revision 1090)
14 14
	
15 15
	public static String About_Menu_Label;
16 16
	public static String AdapterFactory_0;
17
	public static String AddBase_10;
17
	public static String info_txmIsReady;
18 18
	public static String AddBase_17;
19 19
	public static String AddBase_19;
20 20
	public static String AddBase_1;
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages.properties (revision 1090)
5 5
About_Menu_Label = About TXM...
6 6

  
7 7
AdapterFactory_0 = ** Warning: the corpus {0} is corrupted. Some commands won''t work correctly.
8

  
9 8

  
10 9
AddBase_1  = New corpus: {0}.
11
AddBase_10 = TXM is ready.
12 10
AddBase_17 = ** Cannot read the file {0}
13 11
AddBase_19 = Warning
14 12
AddBase_2  = ** Failed to load corpus  from directory: {0}.\nWe cannot find the necessary components
......
703 701

  
704 702
error_invalidRegularExpression = Invalid regular expression: {0}
705 703

  
704
info_txmIsReady = TXM is ready.
705

  
706 706
preferences_advanced_enableResultsPersistence        = Enable automatic save of all results (persistence)
707 707
preferences_advanced_showAllResultNodesInCorporaView = Show all result nodes in corpora view
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_ru.properties (revision 1090)
3 3

  
4 4
AdapterFactory_0 = ** Предупреждение: корпус {0} поврежден. Некоторые команды могут быть недоступны или функционировать некорркетно.
5 5

  
6

  
7 6
AddBase_1  = Новый корпус: {0}.
8
AddBase_10 = Платформа TXM готова к использованию.
9 7
AddBase_17 = ** Файл {0} недоступен
10 8
AddBase_19 = Внимание
11 9
AddBase_2  = ** Ошибка загрузки корпуса из папки: {0}.\nНевозможно найти необходимые составные элементы.
......
571 569

  
572 570
error_invalidRegularExpression = Некорректное регулярное выражение: {0}
573 571

  
572
info_txmIsReady = Платформа TXM готова к использованию.
573

  
574 574
preferences_advanced_enableResultsPersistence        = 
575 575
preferences_advanced_showAllResultNodesInCorporaView = 
tmp/org.txm.rcp/src/main/java/org/txm/rcp/messages/messages_fr.properties (revision 1090)
3 3
#Mon Feb 10 10:26:04 CET 2014
4 4

  
5 5
About_Menu_Label = À propos de TXM...
6

  
7 6

  
8 7
AdapterFactory_0 = ** Avertissement : le corpus {0} est corrompu. Certaines commandes ne fonctionneront pas correctement.
9 8

  
10 9
AddBase_1  = Nouveau corpus : {0}.
11
AddBase_10 = TXM est prêt.
12 10
AddBase_17 = ** Impossible de lire le fichier {0}
13 11
AddBase_19 = Attention
14 12
AddBase_2  = ** Échec du chargement du corpus à partir du dossier : {0}.\nImpossible de trouver les composants nécessaires.
......
642 640

  
643 641
error_invalidRegularExpression = Expression régulière invalide : {0}
644 642

  
643
info_txmIsReady = TXM est prêt.
644

  
645 645
preferences_advanced_enableResultsPersistence        = Activer la sauvegarde automatique de tous les résultats (perstistance)
646 646
preferences_advanced_showAllResultNodesInCorporaView = Afficher les noeuds de tous les résultats dans la vue corpus
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 1090)
584 584
		Field[] fields = clazz.getDeclaredFields();
585 585
		for (Field f : fields) {
586 586
			Parameter parameter = f.getAnnotation(Parameter.class);
587
			if (parameter == null || parameter.type() != Parameter.COMPUTING) {
587
			if (parameter == null
588
					|| parameter.type() != Parameter.COMPUTING
589
					// FIXME: non electric mode tests
590
					//|| parameter.electric() == false 
591
					) {
588 592
				continue;
589 593
			}
590 594

  
591 595
			String name;
592
			if (!"".equals(parameter.key()))	{
596
			if (!parameter.key().isEmpty())	{
593 597
				name = parameter.key();
594
			} else {
598
			}
599
			else {
595 600
				name = f.getName();
596 601
			}
597 602

  
......
1628 1633
	 */
1629 1634
	synchronized protected boolean compute(IProgressMonitor monitor, boolean deepComputing, boolean updateLastParameters) throws Exception {
1630 1635

  
1636
		// FIXME: see if this skipComputing tests is still useful? is it possible to directly return instead?
1637
		// en fait voir ChartResult.compute() if(super.compute(monitor, true, false)), je pense que le prob vient du fait que si on retourne false dans TXMResult.compute() alors renderChart() ne sera pas appelé 
1631 1638
		boolean skipComputing = false;
1632 1639

  
1633 1640
		this.monitor = monitor;
tmp/org.txm.core/src/java/org/txm/core/results/Parameter.java (revision 1090)
36 36
	public String key() default "";
37 37
	
38 38
	/**
39
	 * The parameter electric mode. If true the result is computed as soon the parameter is updated 
39
	 * The parameter electric mode. If true the result is computed as soon the parameter is updated.
40 40
	 * @return
41 41
	 */
42 42
	public boolean electric() default true;
43 43
	
44 44
	/**
45
	 * To determine what kind of parameters has been changed between tWo computing/rendering and do only computing, rendering or both.
45
	 * To determine what kind of parameters has been changed between two computing/rendering and do only computing, rendering or both.
46 46
	 * @return
47 47
	 */
48 48
	public int type() default Parameter.COMPUTING;
tmp/org.txm.concordance.rcp/src/org/txm/concordance/rcp/editors/ConcordanceEditor.java (revision 1090)
770 770
		viewer.setInput(lines);
771 771
		viewer2.setInput(lines);
772 772

  
773
		navigationWidget.setInfoLineText(""+(from + 1), //$NON-NLS-1$
774
				" - "+(to + 1) + " / " + concordance.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$
773
		navigationWidget.setInfoLineText("" + (from + 1), //$NON-NLS-1$
774
				" - " + (to + 1) + " / " + concordance.getNLines()); //$NON-NLS-1$ //$NON-NLS-2$
775 775

  
776 776
		navigationWidget.setPreviousEnabled(concordance.getTopIndex() > 0);
777 777
		navigationWidget.setFirstEnabled(concordance.getTopIndex() > 0);
778
		navigationWidget.setNextEnabled((concordance.getTopIndex()+concordance.getNLinePerPage()) < concordance.getNLines() - 1);
779
		navigationWidget.setLastEnabled((concordance.getTopIndex()+concordance.getNLinePerPage()) < concordance.getNLines() - 1);
778
		navigationWidget.setNextEnabled((concordance.getTopIndex() + concordance.getNLinePerPage()) < concordance.getNLines() - 1);
779
		navigationWidget.setLastEnabled((concordance.getTopIndex() + concordance.getNLinePerPage()) < concordance.getNLines() - 1);
780 780
		navigationWidget.layout();
781 781
		navigationWidget.getParent().layout();
782 782

  
783 783
		refreshReferenceColumnTitle();
784 784
		viewer.getControl().setRedraw(true);
785 785
		viewer2.getControl().setRedraw(true);
786
		
787 786
	}
788 787

  
789 788

  
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/editors/CooccurrencesEditor.java (revision 1090)
156 156
	AssistedQueryWidget queryWidget;
157 157

  
158 158
	/** The props area. */
159
	@Parameter(key=CooccurrencePreferences.UNIT_PROPERTIES)
159
	@Parameter(key=TXMPreferences.UNIT_PROPERTIES)
160 160
	PropertiesSelector<WordProperty> propertiesSelector;
161

  
162 161
	
163 162
	
164 163
	
......
662 661
				Log.severe(CooccurrenceUIMessages.bind(CooccurrenceUIMessages.editor_error, e.getLocalizedMessage()));
663 662
				org.txm.rcp.utils.Logger.printStackTrace(e);
664 663
			}
665
//			viewer.refresh();
666 664
			TXMEditor.packColumns(this.viewer);
667 665
		}
668 666
	}
......
671 669
	@Override
672 670
	public void updateEditorFromResult(boolean update) {
673 671

  
672
		// clear the UI for non-electric parameters
673
		// FIXME: doesn't work
674
		if(this.getResult().hasParameterChanged(CooccurrencePreferences.STRUCTURAL_UNIT_LIMIT))	{
675
			viewer.setInput(null);
676
			return;
677
		}
678
		
674 679
		String txt = "tp " + cooc.getNumberOfKeyword() + ", vc " + cooc.getNumberOfDifferentCooccurrents() + ", tc " + cooc.getNumberOfCooccurrents(); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
675 680
		try {
676 681
			txt += ", T " + cooc.getCorpus().getSize();  //$NON-NLS-1$
tmp/org.txm.cooccurrence.rcp/src/org/txm/cooccurrence/rcp/handlers/___CooccurrencesToConcordances.java (revision 1090)
111 111
		if (cooc.getIncludeXPivot() && maxempan == 0) maxempan = 1;  
112 112
		
113 113
		String maxempanstr = "within " + maxempan + " "; //$NON-NLS-1$ //$NON-NLS-2$
114
		if (cooc.getStructure() != null) maxempanstr += cooc.getStructure().getName(); 
114
		if (cooc.getStructuralUnitLimit() != null) maxempanstr += cooc.getStructuralUnitLimit().getName(); 
115 115
		
116 116
		query = "("+cooc.getQuery()+" []* "+query+") | ("+query+" []* "+cooc.getQuery()+") "+maxempanstr; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
117 117
		

Formats disponibles : Unified diff