Révision 418

tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/messages/messages.properties (revision 418)
1 1

  
2
Cooccurrence_0   = Coocurrence : 
3
Cooccurrence_1   = ** Echec de la recherche de 'n' ou 'o' : 
4
Cooccurrence_10  = \ propriétés : 
5
Cooccurrence_102 = ** Erreur : argument négatif dans la fonction 'factln'
6
Cooccurrence_103 = ** Erreur : argument négatif dans la fonction 'rbicoln'
7
Cooccurrence_105 = Occ\	Fréq\	CoFréq\	Indice\	DistMoy\	Mode
8
Cooccurrence_106 = \n
9
Cooccurrence_107 = ** Erreur : 
10
Cooccurrence_11  = Occ
11
Cooccurrence_12  = Fréq
12
Cooccurrence_13  = CoFréq
13
Cooccurrence_14  = Indice
14
Cooccurrence_15  = DistMoy
15
Cooccurrence_16  = Mode
16
Cooccurrence_2   = Cooc : 
17
Cooccurrence_22  = Erreur: ref_forms.length ! ref_freqs.length
18
Cooccurrence_23  = Erreur: pas de cooccurrents
19
Cooccurrence_4   = \ F : 
20
Cooccurrence_5   = ** Impossible de calculer des cooccurrences avec cette concordance
21
Cooccurrence_6   = Occ\	Fréq\	CoFréq\	Indice\	DistMoy\	Mode
22
Cooccurrence_7   = \ Occ :
23
Cooccurrence_8   = \ Indice:
24
Cooccurrence_9   = \ DistMoy:
2
Cooccurrence_0         = Coocurrence : 
3
Cooccurrence_1         = ** Echec de la recherche de 'n' ou 'o' : 
4
Cooccurrence_10        = \ propriétés : 
5
Cooccurrence_102       = ** Erreur : argument négatif dans la fonction 'factln'
6
Cooccurrence_103       = ** Erreur : argument négatif dans la fonction 'rbicoln'
7
Cooccurrence_105       = Occ\	Fréq\	CoFréq\	Indice\	DistMoy\	Mode
8
Cooccurrence_106       = \n
9
Cooccurrence_107       = ** Erreur : 
10
Cooccurrence_11        = Occ
11
Cooccurrence_12        = Fréq
12
Cooccurrence_13        = CoFréq
13
Cooccurrence_14        = Indice
14
Cooccurrence_15        = DistMoy
15
Cooccurrence_16        = Mode
16
Cooccurrence_2         = Cooc : 
17
Cooccurrence_22        = Erreur: ref_forms.length ! ref_freqs.length
18
Cooccurrence_23        = Erreur: pas de cooccurrents
19
Cooccurrence_4         = \ F : 
20
Cooccurrence_5         = ** Impossible de calculer des cooccurrences avec cette concordance
21
Cooccurrence_6         = Occ\	Fréq\	CoFréq\	Indice\	DistMoy\	Mode
22
Cooccurrence_7         = \ Occ :
23
Cooccurrence_8         = \ Indice:
24
Cooccurrence_9         = \ DistMoy:
25

  
26
CooccurrencesEditor_27 = build queries
27
CooccurrencesEditor_28 = get matches
28
CooccurrencesEditor_29 = build line signatures
29
CooccurrencesEditor_30 = counting
30
CooccurrencesEditor_31 = build lexical table
31
CooccurrencesEditor_32 = get specif scores
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/messages/messages_ru.properties (revision 418)
1

  
2
CooccurrencesEditor_27 = Расчет запроса
3
CooccurrencesEditor_28 = Расчет ответов
4
CooccurrencesEditor_29 = Расчет подписей к строкам
5
CooccurrencesEditor_30 = Подсчет
6
CooccurrencesEditor_31 = Расчет словарной таблицы
7
CooccurrencesEditor_32 = Расчет показателей специфичности\	
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/messages/messages_fr.properties (revision 418)
1 1

  
2
Cooccurrence_0   = Coocurrence: 
3
Cooccurrence_1   = ** Error: can't find 'n' or 'o': 
4
Cooccurrence_10  = \ properties: 
5
Cooccurrence_102 = ** Error: negative argument in 'factln' function
6
Cooccurrence_103 = ** Error: negative argument in 'rbicoln' function
7
Cooccurrence_105 = Occ\	Freq\	CoFreq\	Score\	MeanDist\	Mode
8
Cooccurrence_106 = \n
9
Cooccurrence_107 = ** Error: 
10
Cooccurrence_11  = Occ
11
Cooccurrence_12  = Freq
12
Cooccurrence_13  = CoFreq
13
Cooccurrence_14  = Score
14
Cooccurrence_15  = MeanDist
15
Cooccurrence_16  = Mode
16
Cooccurrence_2   = Cooc: 
17
Cooccurrence_22  = Error: ref_forms.length ! ref_freqs.length
18
Cooccurrence_23  = Error: no cooccurrents
19
Cooccurrence_4   = \ F: 
20
Cooccurrence_5   = ** Impossible to compute cooccurrences with this concordance 
21
Cooccurrence_6   = Occ\	Freq\	CoFreq\	Score\	MeanDist\	Mode
22
Cooccurrence_7   = \ Occ:
23
Cooccurrence_8   = \ Score:
24
Cooccurrence_9   = \ MeanDist:
2
Cooccurrence_0         = Coocurrence: 
3
Cooccurrence_1         = ** Error: can't find 'n' or 'o': 
4
Cooccurrence_10        = \ properties: 
5
Cooccurrence_102       = ** Error: negative argument in 'factln' function
6
Cooccurrence_103       = ** Error: negative argument in 'rbicoln' function
7
Cooccurrence_105       = Occ\	Freq\	CoFreq\	Score\	MeanDist\	Mode
8
Cooccurrence_106       = \n
9
Cooccurrence_107       = ** Error: 
10
Cooccurrence_11        = Occ
11
Cooccurrence_12        = Freq
12
Cooccurrence_13        = CoFreq
13
Cooccurrence_14        = Score
14
Cooccurrence_15        = MeanDist
15
Cooccurrence_16        = Mode
16
Cooccurrence_2         = Cooc: 
17
Cooccurrence_22        = Error: ref_forms.length ! ref_freqs.length
18
Cooccurrence_23        = Error: no cooccurrents
19
Cooccurrence_4         = \ F: 
20
Cooccurrence_5         = ** Impossible to compute cooccurrences with this concordance 
21
Cooccurrence_6         = Occ\	Freq\	CoFreq\	Score\	MeanDist\	Mode
22
Cooccurrence_7         = \ Occ:
23
Cooccurrence_8         = \ Score:
24
Cooccurrence_9         = \ MeanDist:
25

  
26
CooccurrencesEditor_27 = Calcul des requêtes
27
CooccurrencesEditor_28 = Calcul des retours
28
CooccurrencesEditor_29 = Calcul des signatures de lignes
29
CooccurrencesEditor_30 = Comptage
30
CooccurrencesEditor_31 = Calcul de la table lexicale
31
CooccurrencesEditor_32 = Calcul des indices de spécificité\	
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/messages/CooccurrenceCoreMessages.java (revision 418)
26 26
	public static String Cooccurrence_8;
27 27
	public static String Cooccurrence_9;
28 28

  
29
	public static String CooccurrencesEditor_27;
30
	public static String CooccurrencesEditor_28;
31
	public static String CooccurrencesEditor_29;
32
	public static String CooccurrencesEditor_30;
33
	public static String CooccurrencesEditor_31;
34
	public static String CooccurrencesEditor_32;
35

  
29 36
	
30 37
	//FIXME: unused keys
31 38
	public static String Cooccurrence_0;
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/functions/Cooccurrence.java (revision 418)
46 46
import org.txm.concordance.core.functions.Line;
47 47
import org.txm.cooccurrence.core.functions.comparators.CLineComparator;
48 48
import org.txm.cooccurrence.core.messages.CooccurrenceCoreMessages;
49
import org.txm.functions.Function;
49
import org.txm.cooccurrence.core.preferences.CooccurrencePreferences;
50
import org.txm.core.preferences.TXMPreferences;
51
import org.txm.core.results.TXMParameters;
52
import org.txm.functions.ProgressWatcher;
53
import org.txm.functions.TXMCommand;
50 54
import org.txm.index.core.functions.Index;
51
import org.txm.lexicaltable.core.functions.LexicalTable;
52
import org.txm.lexicaltable.core.functions.LexicalTableFactory;
53 55
import org.txm.lexicaltable.core.statsengine.r.data.LexicalTableImpl;
54 56
import org.txm.searchengine.cqp.clientExceptions.CqiClientException;
55 57
import org.txm.searchengine.cqp.clientExceptions.UnexpectedAnswerException;
......
61 63
import org.txm.searchengine.cqp.corpus.query.Match;
62 64
import org.txm.searchengine.cqp.corpus.query.Query;
63 65
import org.txm.searchengine.cqp.serverException.CqiServerError;
64
import org.txm.specificities.core.functions.SpecificitesResult;
65 66
import org.txm.specificities.core.statsengine.r.function.SpecificitiesImpl;
66
import org.txm.lexicaltable.core.statsengine.data.ILexicalTable;
67 67
import org.txm.statsengine.core.StatException;
68 68
import org.txm.statsengine.r.core.RWorkspace;
69 69
import org.txm.statsengine.r.core.exceptions.RWorkspaceException;
......
76 76
 * @author mdecorde
77 77
 * 
78 78
 */
79
public class Cooccurrence extends Function  {
79
public class Cooccurrence extends TXMCommand  {
80 80

  
81 81
	/** The voc. */
82 82
	Index voc;
......
105 105
	StructuralUnit limit;
106 106

  
107 107
	/** The maxleft. */
108
	int maxleft;
108
	int maxLeft;
109 109

  
110 110
	/** The maxright. */
111
	int maxright;
111
	int maxRight;
112 112

  
113 113
	/** The minleft. */
114
	int minleft = 1;
114
	int minLeft = 1;
115 115

  
116 116
	/** The minright. */
117
	int minright = 1;
117
	int minRight = 1;
118 118

  
119 119
	/** The lines. */
120 120
	List<CLine> lines = new ArrayList<CLine>();
......
156 156
	private Query contextquery;
157 157

  
158 158
	/** The minf. */
159
	private int minf;
159
	private int minFreq;
160 160

  
161 161
	/** The minscore. */
162
	private double minscore;
162
	private double minScore;
163 163

  
164 164
	/** The mincof. */
165
	private int mincof;
165
	private int minCof;
166 166

  
167 167
	/** The anticontextquery. */
168 168
	private Query anticontextquery;
......
266 266
	 * @param query the query
267 267
	 * @param properties the properties
268 268
	 * @param limit the limit
269
	 * @param maxleft the maxleft
270
	 * @param minleft the minleft
271
	 * @param minright the minright
272
	 * @param maxright the maxright
273
	 * @param minf the minf
274
	 * @param mincof the mincof
275
	 * @param minscore the minscore
269
	 * @param maxLeft the maxleft
270
	 * @param minLeft the minleft
271
	 * @param minRight the minright
272
	 * @param maxRight the maxright
273
	 * @param minFreq the minf
274
	 * @param minCof the mincof
275
	 * @param minsSore the minscore
276 276
	 * @param includeXpivot the include xpivot
277 277
	 * @throws Exception the exception
278 278
	 */
279
	@Deprecated
279 280
	public Cooccurrence(Corpus corpus, Query query, List<Property> properties,
280
			StructuralUnit limit, int maxleft, int minleft, int minright,
281
			int maxright, int minf, int mincof, double minscore, boolean includeXpivot, boolean buildLexicalTableWithCooccurrents)
281
			StructuralUnit limit, int maxLeft, int minLeft, int minRight,
282
			int maxRight, int minFreq, int minCof, double minsSore, boolean includeXpivot, boolean buildLexicalTableWithCooccurrents)
282 283
					throws Exception {
283 284
		
284 285
		super(corpus);
285 286
		
286
		long time = System.currentTimeMillis();
287 287

  
288 288
		// System.out.println(Messages.Cooccurrence_0);
289 289
		this.corpus = corpus;
......
293 293

  
294 294
		this.properties = properties;
295 295
		this.limit = limit;
296
		this.minleft = minleft;
297
		this.maxleft = maxleft;
298
		this.minright = minright;
299
		this.maxright = maxright;
300
		this.minf = minf;
301
		this.minscore = minscore;
302
		this.mincof = mincof;
296
		this.minLeft = minLeft;
297
		this.maxLeft = maxLeft;
298
		this.minRight = minRight;
299
		this.maxRight = maxRight;
300
		this.minFreq = minFreq;
301
		this.minScore = minsSore;
302
		this.minCof = minCof;
303 303
		this.includeXpivot = includeXpivot;
304 304
		this.buildLexicalTableWithCooccurrents = buildLexicalTableWithCooccurrents;
305 305

  
306 306
		//System.out.println("-- Done"); //$NON-NLS-1$
307 307
	}
308 308

  
309

  
310
	/**
311
	 * Creates an empty <link>Cooccurrence</link> object, child of the specified <link>Corpus</link>.
312
	 * @param corpus
313
	 */
314
	public Cooccurrence(Corpus corpus) {
315
		this(corpus, null);
316
	}
317

  
318
	/**
319
	 * Creates an empty <link>Cooccurrence</link> object, child of the specified <link>Corpus</link>.
320
	 * @param corpus
321
	 * @param parameters
322
	 */
323
	public Cooccurrence(Corpus corpus, TXMParameters parameters) {
324
		super(corpus, parameters);
325
		this.corpus = corpus;
326
	}
327

  
328
	
309 329
	public boolean getIncludeXPivot() {
310 330
		return includeXpivot;
311 331
	}
......
348 368
		getLines();
349 369
	}
350 370

  
351
	public void clearMemory() {
352
		distances = null;
353
		distancescounts = null;
354
		counts = null;
355
		indexfreqs = null;
356
		counted = null;
357
		m1 = null;
358
		m2 = null;
359
		m3 = null;
360
		allsignaturesstr = null;
361
		lt = null;
362
		keysToString = null;
363
		occproperties = null;
364
		count = null;
365
		dist = null;
366
		freq = null;
367
		scores = null;
368
	}
369 371

  
370 372
	/**
371 373
	 * Step query limits.
......
378 380
		{
379 381
			String tempquery =""; //$NON-NLS-1$
380 382
			String lname = limit.getName();
381
			if (minleft > 0 ) { // test if there is a left context
382
				tempquery += "(<"	+ lname + ">[]* </" + lname + ">){" + (maxleft) + "," + (maxleft) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
383
			if (minLeft > 0 ) { // test if there is a left context
384
				tempquery += "(<"	+ lname + ">[]* </" + lname + ">){" + (maxLeft) + "," + (maxLeft) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
383 385
			}
384 386
			// (<p>[]*</p>){0, 50} "je" (<p>[]*</p>){0, 50}
385 387
			tempquery +=" <" + lname + ">[]* " + query.getQueryString() + " []* </" + lname + "> "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
386
			if (minright > 0) { // test if there is a right context
387
				tempquery+="(<" + lname + ">[]* </" + lname + ">){" + (maxright) + "," + (maxright) + "}";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
388
			if (minRight > 0) { // test if there is a right context
389
				tempquery+="(<" + lname + ">[]* </" + lname + ">){" + (maxRight) + "," + (maxRight) + "}";  //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
388 390
			}
389 391
			this.contextquery = new Query(tempquery);
390 392

  
391 393
			if (includeXpivot) {
392 394
				String anticontextquerystring = ""; //$NON-NLS-1$
393
				if (minleft > 1)// minleft = 2..N
394
					anticontextquerystring += "(<" + lname + ">[]* </" + lname + ">){" + (minleft - 1) + "," + (minleft - 1) + "} <" + lname + ">[]* "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
395
				if (minLeft > 1)// minleft = 2..N
396
					anticontextquerystring += "(<" + lname + ">[]* </" + lname + ">){" + (minLeft - 1) + "," + (minLeft - 1) + "} <" + lname + ">[]* "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
395 397
				anticontextquerystring += query.getQueryString();
396
				if (minright > 1) // minright = 2..N
397
					anticontextquerystring += " []* </" + lname + "> (<" + lname + ">[]* </" + lname + ">){" + (minright - 1) + "," + (minright - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
398
				if (minRight > 1) // minright = 2..N
399
					anticontextquerystring += " []* </" + lname + "> (<" + lname + ">[]* </" + lname + ">){" + (minRight - 1) + "," + (minRight - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
398 400
				this.anticontextquery = new Query(anticontextquerystring);
399 401
			} else {
400 402
				String anticontextquerystring = ""; //$NON-NLS-1$
401
				if (minleft > 0)// minleft = 2..N
402
					anticontextquerystring += "(<" + lname + ">[]* </" + lname + ">){" + (minleft - 1) + "," + (minleft - 1) + "} <" + lname + ">[]* "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
403
				if (minLeft > 0)// minleft = 2..N
404
					anticontextquerystring += "(<" + lname + ">[]* </" + lname + ">){" + (minLeft - 1) + "," + (minLeft - 1) + "} <" + lname + ">[]* "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
403 405
				anticontextquerystring += query.getQueryString();
404
				if (minright > 0) // minright = 2..N
405
					anticontextquerystring += " []* </" + lname + "> (<" + lname + ">[]* </" + lname + ">){" + (minright - 1) + "," + (minright - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
406
				if (minRight > 0) // minright = 2..N
407
					anticontextquerystring += " []* </" + lname + "> (<" + lname + ">[]* </" + lname + ">){" + (minRight - 1) + "," + (minRight - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
406 408
				this.anticontextquery = new Query(anticontextquerystring);
407 409
			}
408 410
		} else // word context
409 411
		{
410 412
			String tempquery =""; //$NON-NLS-1$
411
			if (minleft > 0 ) { // test if there is a left context
412
				tempquery += "[]{"	+ maxleft + "," + maxleft + "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
413
			if (minLeft > 0 ) { // test if there is a left context
414
				tempquery += "[]{"	+ maxLeft + "," + maxLeft + "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
413 415
			}
414 416
			tempquery+= query.getQueryString();
415 417

  
416
			if (minright > 0) { // test if there is a right context
417
				tempquery+=" []{" + maxright + "," + maxright + "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
418
			if (minRight > 0) { // test if there is a right context
419
				tempquery+=" []{" + maxRight + "," + maxRight + "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
418 420
			}
419 421
			this.contextquery = new Query(tempquery); 
420 422
			String anticontextquerystring = ""; //$NON-NLS-1$
421
			if (minleft > 1)
422
				anticontextquerystring += "[]{" + (minleft - 1) + ", " + (minleft - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
423
			if (minLeft > 1)
424
				anticontextquerystring += "[]{" + (minLeft - 1) + ", " + (minLeft - 1) + "}"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
423 425
			anticontextquerystring += query.getQueryString();
424
			if (minright > 1)
425
				anticontextquerystring += "[]{" + (minright -1) + "," + (minright -1)+ "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
426
			if (minRight > 1)
427
				anticontextquerystring += "[]{" + (minRight -1) + "," + (minRight -1)+ "} "; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
426 428
			this.anticontextquery = new Query(anticontextquerystring);
427 429
		}
428 430
		return true;
......
834 836
						((float) (distances.get(signaturestr) / distancescounts
835 837
								.get(signaturestr))) - 1.0f, -1);
836 838
				//System.out.println(cline);
837
				if (cline.freq >= this.minf	&& cline.nbocc >= this.mincof && Math.abs(cline.score) >= this.minscore)
839
				if (cline.freq >= this.minFreq	&& cline.nbocc >= this.minCof && Math.abs(cline.score) >= this.minScore)
838 840
				{
839 841
					if (cline.score >= Integer.MAX_VALUE - 5)
840 842
						cline.score = Float.MAX_EXPONENT;
......
910 912
			// System.out.println("CONC PROPS :"+conc.getViewProperties());
911 913
			properties = conc.getViewProperties();
912 914
			limit = null;
913
			maxleft = conc.getLeftContextSize();
914
			maxright = conc.getRightContextSize();
915
			maxLeft = conc.getLeftContextSize();
916
			maxRight = conc.getRightContextSize();
915 917
			this.conclines = conclines;
916 918
			return true;
917 919
		} catch (CqiClientException e) {
......
933 935
		seuil_score = score;
934 936
	}
935 937

  
938

  
936 939
	/**
940
	 * 
941
	 * @param watcher
942
	 * @param query
943
	 * @param properties
944
	 * @param limit
945
	 * @param minleft
946
	 * @param maxleft
947
	 * @param minright
948
	 * @param maxright
949
	 * @param minf
950
	 * @param minscore
951
	 * @param mincof
952
	 * @param includeXpivot
953
	 * @param buildLexicalTableWithCooccurrents
954
	 * @return
955
	 */
956
	public boolean compute(ProgressWatcher watcher, Query query, List<Property> properties, StructuralUnit limit, int minleft, int maxleft, int minright,
957
			int maxright, int minf, double minscore, int mincof, boolean includeXpivot, boolean buildLexicalTableWithCooccurrents)	{
958
		
959
		this.query = query;
960
		this.properties = properties;
961
		this.limit = limit;
962
		this.minLeft = minleft;
963
		this.maxLeft = maxleft;
964
		this.minRight = minright;
965
		this.maxRight = maxright;
966
		this.minFreq = minf;
967
		this.minScore = minscore;
968
		this.minCof = mincof;
969
		this.includeXpivot = includeXpivot;
970
		this.buildLexicalTableWithCooccurrents = buildLexicalTableWithCooccurrents;
971

  
972
		//FIXME: debug
973
		System.out.println("cooc: "+corpus+" "+query+" "+properties+" "+limit+" "+maxleft+" "+minleft+" "+minright+" "+maxright+" "+minf+" "+mincof+" "+minscore+" "+includeXpivot);
974
		
975
		this.setCurrentMonitor(watcher);
976
		monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_27);
977
		try {
978
			if (!this.stepQueryLimits()) {
979
				return false;
980
			}	
981
			
982
			monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_28);
983
			if (!this.stepGetMatches()) {
984
				return false;
985
			}
986
			monitor.worked(10);
987
			
988
			monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_29);
989
			if (!this.stepBuildSignatures())
990
				return false;
991
			monitor.worked(10);
992
			
993
			monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_30);
994
			if (!this.stepCount())	{
995
				return false;
996
			}
997
			monitor.worked(10);
998
			
999
			monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_31);
1000
			this.acquireSemaphore();
1001
			if (!this.stepBuildLexicalTable())	{
1002
				return false;
1003
			}
1004
			monitor.worked(10);
1005
			this.releaseSemaphore();
1006
			
1007
			monitor.subTask(CooccurrenceCoreMessages.CooccurrencesEditor_32);
1008
			this.acquireSemaphore();
1009
			if (!this.stepGetScores())	{
1010
				return false;
1011
			}
1012
			monitor.worked(10);
1013
			this.releaseSemaphore();
1014
			
1015
			this.clearMemory();
1016
		}
1017
		// user canceling
1018
		catch(ThreadDeath e) {
1019
			return false;
1020
		}
1021
		catch(Exception e) {
1022
			e.printStackTrace();
1023
			return false;
1024
		}
1025
		
1026
		return true;
1027

  
1028
	}
1029
	
1030
	
1031
	@Override
1032
	public boolean compute(ProgressWatcher watcher) {
1033
		if(this.compute(
1034
				watcher,
1035
				new Query(this.getStringParameterValue(CooccurrencePreferences.QUERY)),
1036
				(List<Property>) parameters.get("properties"),
1037
				(StructuralUnit) parameters.get("limit"),
1038
				this.getIntParameterValue(CooccurrencePreferences.MIN_LEFT),
1039
				this.getIntParameterValue(CooccurrencePreferences.MAX_LEFT),
1040
				this.getIntParameterValue(CooccurrencePreferences.MIN_RIGHT),
1041
				this.getIntParameterValue(CooccurrencePreferences.MAX_RIGHT),
1042
				this.getIntParameterValue(CooccurrencePreferences.MIN_FREQ),
1043
				this.getIntParameterValue(CooccurrencePreferences.MIN_SCORE),
1044
				this.getIntParameterValue(CooccurrencePreferences.MIN_COUNT),
1045
				this.getBooleanParameterValue(CooccurrencePreferences.INCLUDE_X_PIVOT),
1046
				this.getBooleanParameterValue(CooccurrencePreferences.PARTIAL_LEXICAL_TABLE)))	{
1047
			
1048
			// persistence
1049
			TXMPreferences.putLocalParameters(this, parameters);
1050
			return true;
1051
		}
1052
		return false;
1053
	}
1054
	
1055
	/**
937 1056
	 * Compute.
938 1057
	 *
939 1058
	 * @return true, if successful
940 1059
	 */
1060
	//FIXME: not used? or may in portal? in any case, need to use other method compute() now
941 1061
	public boolean compute() {
942 1062
		if (conclines == null || conc == null || P == -1 || FA == -1
943 1063
				|| properties == null || corpus == null) {
......
1515 1635
	 * @param maxleft the new max left
1516 1636
	 */
1517 1637
	public void setMaxLeft(int maxleft) {
1518
		this.maxleft = maxleft;
1638
		this.maxLeft = maxleft;
1519 1639
	}
1520 1640

  
1521 1641
	/**
......
1524 1644
	 * @param minleft the new min left
1525 1645
	 */
1526 1646
	public void setMinLeft(int minleft) {
1527
		this.minleft = minleft;
1647
		this.minLeft = minleft;
1528 1648
	}
1529 1649

  
1530 1650
	/**
......
1533 1653
	 * @param maxright the new max right
1534 1654
	 */
1535 1655
	public void setMaxRight(int maxright) {
1536
		this.maxright = maxright;
1656
		this.maxRight = maxright;
1537 1657
	}
1538 1658

  
1539 1659
	/**
......
1542 1662
	 * @param minright the new min right
1543 1663
	 */
1544 1664
	public void setMinRight(int minright) {
1545
		this.minright = minright;
1665
		this.minRight = minright;
1546 1666
	}
1547 1667

  
1548 1668
	/**
......
1551 1671
	 * @return the max left
1552 1672
	 */
1553 1673
	public int getMaxLeft() {
1554
		return maxleft;
1674
		return maxLeft;
1555 1675
	}
1556 1676

  
1557 1677
	/**
......
1560 1680
	 * @return the min left
1561 1681
	 */
1562 1682
	public int getMinLeft() {
1563
		return minleft;
1683
		return minLeft;
1564 1684
	}
1565 1685

  
1566 1686
	/**
......
1569 1689
	 * @return the max right
1570 1690
	 */
1571 1691
	public int getMaxRight() {
1572
		return maxright;
1692
		return maxRight;
1573 1693
	}
1574 1694

  
1575 1695
	/**
......
1578 1698
	 * @return the min right
1579 1699
	 */
1580 1700
	public int getMinRight() {
1581
		return minright;
1701
		return minRight;
1582 1702
	}
1583 1703

  
1584 1704
	/** The nocooc. */
......
1646 1766
		try {
1647 1767
			this.writer.flush();
1648 1768
			this.writer.close();	
1649
		} catch (IOException e) {
1769
		} catch (NullPointerException e) {
1770
			// do nothing
1771
		} catch (Exception e) {
1650 1772
			// TODO Auto-generated catch block
1651 1773
			org.txm.utils.logger.Log.printStackTrace(e);
1652 1774
		}
1653 1775
	}
1654 1776

  
1777
	//FIXME: useless?
1778
	public void clearMemory() {
1779
		distances = null;
1780
		distancescounts = null;
1781
		counts = null;
1782
		indexfreqs = null;
1783
		counted = null;
1784
		m1 = null;
1785
		m2 = null;
1786
		m3 = null;
1787
		allsignaturesstr = null;
1788
		lt = null;
1789
		keysToString = null;
1790
		occproperties = null;
1791
		count = null;
1792
		dist = null;
1793
		freq = null;
1794
		scores = null;
1795
	}
1655 1796
	
1656 1797
	@Override
1657 1798
	public String getName() {
......
1661 1802

  
1662 1803
	@Override
1663 1804
	public String getSimpleName() {
1664
		return query + " (" + (maxleft-1) + ", " + (maxright-1) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1805
		return query + " (" + (maxLeft-1) + ", " + (maxRight-1) + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1665 1806
	}
1666 1807

  
1667 1808
	@Override
1668 1809
	public String getDetails() {
1669
		return this.toInfos();
1670
	}
1671

  
1672
	/**
1673
	 * To infos.
1674
	 *
1675
	 * @return the string
1676
	 */
1677
	public String toInfos() {
1678 1810
		StringBuffer buf = new StringBuffer(60);
1679 1811
		buf.append("Cooc: \n"); //$NON-NLS-1$
1680 1812
		buf.append(" Corpus: " + this.corpus + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
1681 1813
		buf.append(" Query: " + this.query + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
1682 1814
		buf.append(" Properties: " + this.properties + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
1683 1815
		buf.append(" Structure: " + this.limit + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
1684
		buf.append(" Empans: " + (this.minleft-1) + "<left<" + (this.maxleft-1) + " ; " + (this.minright-1) + "<right<" + (this.maxright-1) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
1816
		buf.append(" Empans: " + (this.minLeft-1) + "<left<" + (this.maxLeft-1) + " ; " + (this.minRight-1) + "<right<" + (this.maxRight-1) + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
1685 1817
		buf.append(" Filters: freq>" + this.seuil_freq + " ; count>" + seuil_count + " ; score>" + seuil_score + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
1686 1818
		return buf.toString();
1687 1819
	}
1688 1820

  
1689 1821

  
1822

  
1823

  
1690 1824
}
tmp/org.txm.cooccurrence.core/src/org/txm/cooccurrence/core/preferences/CooccurrencePreferences.java (revision 418)
39 39
	public static final String MIN_RIGHT = PREFERENCES_PREFIX + "min_right"; //$NON-NLS-1$
40 40
	public static final String MAX_RIGHT = PREFERENCES_PREFIX + "max_right"; //$NON-NLS-1$
41 41

  
42
	public static final String INCLUDE_X_PIVOT = PREFERENCES_PREFIX + "include_x_pivot"; //$NON-NLS-1$
42 43
	public static final String PARTIAL_LEXICAL_TABLE = PREFERENCES_PREFIX + "partial_lexical_table"; //$NON-NLS-1$
43 44
	
45
	// local result preferences
46
	public static final String QUERY = PREFERENCES_PREFIX + "query"; //$NON-NLS-1$
47

  
48
	
44 49
	/**
45 50
	 * 
46 51
	 */
......
52 57
	public void initializeDefaultPreferences() {
53 58
		Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE);
54 59
		
55
		preferences.put(SCORE_FORMAT, "E00");
60
		preferences.put(SCORE_FORMAT, "E00"); //$NON-NLS-1$
56 61
		preferences.putInt(MIN_FREQ, 2);
57 62
		preferences.putInt(MIN_COUNT, 2);
58 63
		preferences.putDouble(MIN_SCORE, 2.0);
......
62 67
		preferences.putInt(MIN_RIGHT, 0);
63 68
		preferences.putInt(MAX_RIGHT, 10);
64 69
		
70
		preferences.put(QUERY, ""); //$NON-NLS-1$
65 71
		
72
		
66 73
	}
67 74
	
68 75
}

Formats disponibles : Unified diff