Révision 617
tmp/org.txm.index.core/src/org/txm/index/core/preferences/IndexPreferences.java (revision 617) | ||
---|---|---|
18 | 18 |
|
19 | 19 |
public static final String PROPERTIES = "properties"; //$NON-NLS-1$ |
20 | 20 |
public static final String QUERY = "query"; //$NON-NLS-1$ |
21 |
public static final String FMIN_FILTER = "fmin"; //$NON-NLS-1$
|
|
22 |
public static final String FMAX_FILTER = "fmax"; //$NON-NLS-1$
|
|
23 |
public static final String VMAX_FILTER = "vmax"; //$NON-NLS-1$
|
|
24 |
public static final String NLINESPERPAGE = "nlines"; //$NON-NLS-1$
|
|
21 |
public static final String F_MIN = "fmin"; //$NON-NLS-1$
|
|
22 |
public static final String F_MAX = "fmax"; //$NON-NLS-1$
|
|
23 |
public static final String V_MAX = "vmax"; //$NON-NLS-1$
|
|
24 |
public static final String N_LINES_PER_PAGE = "nlines"; //$NON-NLS-1$
|
|
25 | 25 |
public static final String PROPERTIES_SEPARATOR = "properties_separator"; //$NON-NLS-1$ |
26 | 26 |
|
27 |
public static final String NTOPINDEX = "n_top_index";
|
|
27 |
public static final String N_TOP_INDEX = "n_top_index";
|
|
28 | 28 |
|
29 | 29 |
@Override |
30 | 30 |
public void initializeDefaultPreferences() { |
... | ... | |
33 | 33 |
preferences.put(PROPERTIES, "word"); //$NON-NLS-1$ |
34 | 34 |
preferences.put(PROPERTIES_SEPARATOR, "_"); //$NON-NLS-1$ |
35 | 35 |
preferences.put(QUERY, ""); //$NON-NLS-1$ |
36 |
preferences.putInt(FMIN_FILTER, 1);
|
|
37 |
preferences.putInt(FMAX_FILTER, Integer.MAX_VALUE);
|
|
38 |
preferences.putInt(VMAX_FILTER, Integer.MAX_VALUE);
|
|
39 |
preferences.putInt(NLINESPERPAGE, 100);
|
|
36 |
preferences.putInt(F_MIN, 1);
|
|
37 |
preferences.putInt(F_MAX, Integer.MAX_VALUE);
|
|
38 |
preferences.putInt(V_MAX, Integer.MAX_VALUE);
|
|
39 |
preferences.putInt(N_LINES_PER_PAGE, 100);
|
|
40 | 40 |
|
41 | 41 |
// FIXME: shared charts rendering preferences |
42 | 42 |
//ChartsEnginePreferences.initializeChartsEngineSharedPreferences(preferences); |
tmp/org.txm.index.core/src/org/txm/index/core/functions/Index.java (revision 617) | ||
---|---|---|
95 | 95 |
/** The partnames. The corpus name if built with a Corpus or the parts names if built with a Partition */ |
96 | 96 |
protected List<String> partnames = new ArrayList<String>(); |
97 | 97 |
|
98 |
/** The writer. */ |
|
99 |
private BufferedWriter writer; |
|
100 |
|
|
101 |
|
|
98 | 102 |
/** The fmax filter value parameter. */ |
99 |
@Parameter(key=IndexPreferences.FMAX_FILTER)
|
|
103 |
@Parameter(key=IndexPreferences.F_MAX)
|
|
100 | 104 |
protected Integer pFmaxFilter; |
105 |
|
|
101 | 106 |
/** The fmin filter value parameter. */ |
102 |
@Parameter(key=IndexPreferences.FMIN_FILTER)
|
|
107 |
@Parameter(key=IndexPreferences.F_MIN)
|
|
103 | 108 |
protected Integer pFminFilter; |
109 |
|
|
104 | 110 |
/** The number of lines shown per page parameter */ |
105 |
@Parameter(key=IndexPreferences.NLINESPERPAGE)
|
|
111 |
@Parameter(key=IndexPreferences.N_LINES_PER_PAGE)
|
|
106 | 112 |
protected Integer pNLinesPerPage; |
113 |
|
|
107 | 114 |
/** The word properties shown. */ |
108 | 115 |
@Parameter |
109 | 116 |
protected List<Property> pProperties; |
117 |
|
|
110 | 118 |
/** The string used to separated property values. */ |
111 | 119 |
@Parameter(key=IndexPreferences.PROPERTIES_SEPARATOR) |
112 | 120 |
protected String pPropertiesSeparator; // the separator of properties values //$NON-NLS-1$ |
121 |
|
|
113 | 122 |
/** The CQP query. */ |
114 | 123 |
@Parameter |
115 | 124 |
protected Query pQuery; |
125 |
|
|
116 | 126 |
/** The line index of the current index page. */ |
117 |
@Parameter(key=IndexPreferences.NTOPINDEX)
|
|
127 |
@Parameter(key=IndexPreferences.N_TOP_INDEX)
|
|
118 | 128 |
private Integer pTopIndex; |
129 |
|
|
119 | 130 |
/** The vmax filter value parameter. */ |
120 |
@Parameter(key=IndexPreferences.VMAX_FILTER)
|
|
131 |
@Parameter(key=IndexPreferences.V_MAX)
|
|
121 | 132 |
protected Integer pVmaxFilter; |
122 | 133 |
|
123 |
/** The writer. */ |
|
124 |
private BufferedWriter writer; |
|
125 | 134 |
|
126 | 135 |
/** |
127 |
* Create a CQL query using an Index lines |
|
128 |
* |
|
129 |
* @param selection the selection |
|
130 |
* @return the query |
|
131 |
*/ |
|
132 |
public static String createQuery(List<Line> lines) { |
|
133 |
String query = ""; //$NON-NLS-1$ |
|
134 |
if (lines.size() == 0) return query; |
|
135 |
|
|
136 |
Line line = lines.get(0); |
|
137 |
int nbToken = line.getUnitsProperties().get(0).size(); |
|
138 |
int nbProps = line.getProperties().size(); |
|
139 |
int nbLines = lines.size(); |
|
140 |
List<Property> props = line.getProperties(); |
|
141 |
for (int t = 0; t < nbToken; t++) { |
|
142 |
query += "["; //$NON-NLS-1$ |
|
143 |
for (int p = 0; p < nbProps; p++) { |
|
144 |
if (props.get(p) instanceof StructuralUnitProperty) { |
|
145 |
query += "_."+((StructuralUnitProperty)props.get(p)).getFullName() + "=\""; //$NON-NLS-1$ //$NON-NLS-2$ |
|
146 |
} else { |
|
147 |
query += props.get(p) + "=\""; //$NON-NLS-1$ |
|
148 |
} |
|
149 |
for (int l = 0; l < nbLines; l++) { |
|
150 |
line = lines.get(l); |
|
151 |
List<List<String>> values = line.getUnitsProperties(); |
|
152 |
String s = values.get(p).get(t); |
|
153 |
s = Query.addBackSlash(s); |
|
154 |
query += s + "|"; //$NON-NLS-1$ |
|
155 |
} |
|
156 |
query = query.substring(0, query.length() - 1); |
|
157 |
query += "\" & "; //$NON-NLS-1$ |
|
158 |
} |
|
159 |
query = query.substring(0, query.length() - 3); |
|
160 |
query += "] "; //$NON-NLS-1$ |
|
161 |
} |
|
162 |
query = query.substring(0, query.length() - 1); |
|
163 |
return query; |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 | 136 |
* compute a index, given a corpus, a query and analysis properties. |
168 | 137 |
* |
169 | 138 |
* @param corpus the corpus |
... | ... | |
187 | 156 |
super(partition); |
188 | 157 |
} |
189 | 158 |
|
159 |
|
|
190 | 160 |
@Override |
191 | 161 |
protected boolean _compute() throws Exception { |
192 | 162 |
lines.clear(); |
... | ... | |
228 | 198 |
getAllLines(); |
229 | 199 |
|
230 | 200 |
} else { |
231 |
System.out.println("Error: Index parent is nor a Corpus nor a partition.");
|
|
201 |
System.out.println("Error: Index parent is neither a Corpus nor a partition.");
|
|
232 | 202 |
return false; |
233 | 203 |
} |
234 | 204 |
} |
... | ... | |
246 | 216 |
return true; |
247 | 217 |
} |
248 | 218 |
|
219 |
|
|
220 |
|
|
249 | 221 |
/** |
222 |
* Create a CQL query using an Index lines |
|
223 |
* |
|
224 |
* @param selection the selection |
|
225 |
* @return the query |
|
226 |
*/ |
|
227 |
public static String createQuery(List<Line> lines) { |
|
228 |
String query = ""; //$NON-NLS-1$ |
|
229 |
if (lines.size() == 0) return query; |
|
230 |
|
|
231 |
Line line = lines.get(0); |
|
232 |
int nbToken = line.getUnitsProperties().get(0).size(); |
|
233 |
int nbProps = line.getProperties().size(); |
|
234 |
int nbLines = lines.size(); |
|
235 |
List<Property> props = line.getProperties(); |
|
236 |
for (int t = 0; t < nbToken; t++) { |
|
237 |
query += "["; //$NON-NLS-1$ |
|
238 |
for (int p = 0; p < nbProps; p++) { |
|
239 |
if (props.get(p) instanceof StructuralUnitProperty) { |
|
240 |
query += "_."+((StructuralUnitProperty)props.get(p)).getFullName() + "=\""; //$NON-NLS-1$ //$NON-NLS-2$ |
|
241 |
} else { |
|
242 |
query += props.get(p) + "=\""; //$NON-NLS-1$ |
|
243 |
} |
|
244 |
for (int l = 0; l < nbLines; l++) { |
|
245 |
line = lines.get(l); |
|
246 |
List<List<String>> values = line.getUnitsProperties(); |
|
247 |
String s = values.get(p).get(t); |
|
248 |
s = Query.addBackSlash(s); |
|
249 |
query += s + "|"; //$NON-NLS-1$ |
|
250 |
} |
|
251 |
query = query.substring(0, query.length() - 1); |
|
252 |
query += "\" & "; //$NON-NLS-1$ |
|
253 |
} |
|
254 |
query = query.substring(0, query.length() - 3); |
|
255 |
query += "] "; //$NON-NLS-1$ |
|
256 |
} |
|
257 |
query = query.substring(0, query.length() - 1); |
|
258 |
return query; |
|
259 |
} |
|
260 |
|
|
261 |
|
|
262 |
|
|
263 |
|
|
264 |
/** |
|
250 | 265 |
* This method alter the index first column frequencies using a table stored in the R workspace |
251 | 266 |
* |
252 | 267 |
* @param referenceCorpus the R table variable name |
... | ... | |
300 | 315 |
@Override |
301 | 316 |
public boolean saveParameters() { |
302 | 317 |
|
303 |
if (pFmaxFilter != null) this.saveParameter(IndexPreferences.FMAX_FILTER, this.pFmaxFilter);
|
|
318 |
if (pFmaxFilter != null) this.saveParameter(IndexPreferences.F_MAX, this.pFmaxFilter);
|
|
304 | 319 |
|
305 |
if (pFminFilter != null) this.saveParameter(IndexPreferences.FMIN_FILTER, this.pFminFilter);
|
|
320 |
if (pFminFilter != null) this.saveParameter(IndexPreferences.F_MIN, this.pFminFilter);
|
|
306 | 321 |
|
307 |
if (pNLinesPerPage != null) this.saveParameter(IndexPreferences.NLINESPERPAGE, this.pNLinesPerPage);
|
|
322 |
if (pNLinesPerPage != null) this.saveParameter(IndexPreferences.N_LINES_PER_PAGE, this.pNLinesPerPage);
|
|
308 | 323 |
|
309 | 324 |
if (pProperties != null) this.saveParameter(IndexPreferences.PROPERTIES, WordProperty.fromListToPreferenceString(pProperties)); |
310 | 325 |
|
... | ... | |
312 | 327 |
|
313 | 328 |
if (pQuery != null) this.saveParameter(IndexPreferences.QUERY, this.pQuery.getQueryString()); |
314 | 329 |
|
315 |
if (pTopIndex != null) this.saveParameter(IndexPreferences.NTOPINDEX, this.pTopIndex);
|
|
330 |
if (pTopIndex != null) this.saveParameter(IndexPreferences.N_TOP_INDEX, this.pTopIndex);
|
|
316 | 331 |
|
317 |
if (pVmaxFilter != null) this.saveParameter(IndexPreferences.VMAX_FILTER, this.pVmaxFilter);
|
|
332 |
if (pVmaxFilter != null) this.saveParameter(IndexPreferences.V_MAX, this.pVmaxFilter);
|
|
318 | 333 |
|
319 | 334 |
return true; |
320 | 335 |
} |
tmp/org.txm.rcp/src/main/java/org/txm/rcp/views/cmdparameters/TXMResultDebugView.java (revision 617) | ||
---|---|---|
30 | 30 |
import org.eclipse.jface.viewers.ISelectionChangedListener; |
31 | 31 |
import org.eclipse.jface.viewers.SelectionChangedEvent; |
32 | 32 |
import org.eclipse.swt.SWT; |
33 |
import org.eclipse.swt.custom.StyledText; |
|
33 | 34 |
import org.eclipse.swt.widgets.Composite; |
34 |
import org.eclipse.swt.widgets.Label; |
|
35 | 35 |
import org.eclipse.ui.part.ViewPart; |
36 | 36 |
import org.txm.chartsengine.core.results.ChartResult; |
37 | 37 |
import org.txm.core.results.TXMResult; |
... | ... | |
48 | 48 |
public class TXMResultDebugView extends ViewPart implements ISelectionChangedListener { |
49 | 49 |
|
50 | 50 |
|
51 |
protected Label currentEditorLabel;
|
|
51 |
protected StyledText displayArea;
|
|
52 | 52 |
|
53 | 53 |
/** |
54 | 54 |
* Creates the view. |
... | ... | |
64 | 64 |
|
65 | 65 |
@Override |
66 | 66 |
public void createPartControl(Composite parent) { |
67 |
currentEditorLabel = new Label(parent, SWT.NONE);
|
|
67 |
displayArea = new StyledText (parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.WRAP);
|
|
68 | 68 |
} |
69 | 69 |
|
70 | 70 |
@Override |
... | ... | |
87 | 87 |
buffer.append("Simple name: " + result.getSimpleName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
88 | 88 |
buffer.append("Name: " + result.getName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
89 | 89 |
buffer.append("Valid filename: " + result.getValidFileName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
90 |
buffer.append("Details:" + result.getDetails() + "\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
90 |
buffer.append("Empty name: " + result.getEmptyName() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
91 |
buffer.append("Details: " + result.getDetails() + "\n\n"); //$NON-NLS-1$ //$NON-NLS-2$ |
|
91 | 92 |
|
92 |
// FIXME: Debug: |
|
93 |
buffer.append("selected object = " + result + ", visible = " + result.isVisible()); |
|
93 |
// Command preferences |
|
94 |
buffer.append("\n"); |
|
95 |
buffer.append(result.dumpPreferences()); |
|
96 |
buffer.append("\n"); |
|
97 |
|
|
98 |
// Object parameters |
|
99 |
buffer.append(result.dumpParameters()); |
|
100 |
|
|
101 |
// Hierarchy |
|
102 |
buffer.append("\n"); |
|
103 |
buffer.append("Selected object = " + result + "\n"); |
|
104 |
buffer.append("Node visible = " + result.isVisible() + "\n"); |
|
94 | 105 |
if (result instanceof ChartResult) { |
95 |
buffer.append("chart object = " + ((ChartResult)result).getChart() + ", chart type = " + ((ChartResult)result).getChartType());
|
|
106 |
buffer.append("Chart object = " + ((ChartResult)result).getChart() + ", chart type = " + ((ChartResult)result).getChartType() + "\n");
|
|
96 | 107 |
} |
97 |
buffer.append("selection full path name = " + result.getFullPathSimpleName() + " - " + result.getName()); |
|
98 |
buffer.append("direct children count = " + result.getResults().size() |
|
99 |
+ ", direct visible children count = " + result.getChildren(true).size() + ", children count = " + result.getDeepChildren().size()); |
|
100 |
buffer.append("root parent = " + result.getRootParent() + ", main corpus parent = " + Corpus.getParentMainCorpus(result) + ", first parent corpus = " + Corpus.getFirstParentCorpus(result)); |
|
108 |
buffer.append("Selection full path name = " + result.getFullPathSimpleName() + " - " + result.getName() + "\n"); |
|
109 |
buffer.append("Direct children count = " + result.getResults().size() + ", direct visible children count = " + result.getChildren(true).size() + ", children count = " + result.getDeepChildren().size()); |
|
110 |
buffer.append("Root parent = " + result.getRootParent() + ", main corpus parent = " + Corpus.getParentMainCorpus(result) + ", first parent corpus = " + Corpus.getFirstParentCorpus(result)); |
|
101 | 111 |
|
102 | 112 |
|
103 |
try { |
|
104 |
// Command preferences |
|
105 |
buffer.append("\n"); |
|
106 |
buffer.append("\n"); |
|
107 |
buffer.append(result.dumpPreferences()); |
|
108 |
buffer.append("\n"); |
|
109 |
|
|
110 |
// Object parameters |
|
111 |
buffer.append(result.dumpParameters()); |
|
112 |
|
|
113 |
|
|
114 |
} |
|
115 |
catch(Exception e) { |
|
116 |
System.out.println("Error: "+e.getLocalizedMessage()); |
|
117 |
} |
|
113 |
displayArea.setText(buffer.toString()); |
|
118 | 114 |
|
119 |
currentEditorLabel.setText(buffer.toString()); |
|
120 |
|
|
121 | 115 |
} |
122 | 116 |
|
123 | 117 |
} |
tmp/org.txm.core/src/java/org/txm/core/results/TXMResult.java (revision 617) | ||
---|---|---|
41 | 41 |
* Unique ID of the object built with : class + date + number |
42 | 42 |
*/ |
43 | 43 |
protected String uniqueID; |
44 |
protected String path; |
|
45 |
public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYYYMMDD");
|
|
44 |
//protected String path;
|
|
45 |
public static final DateFormat ID_TIME_FORMAT = new SimpleDateFormat("YYMMDD"); |
|
46 | 46 |
/** Editor can use this to test if the result need to be saved */ |
47 | 47 |
protected boolean hasBeenComputedOnce = false; |
48 | 48 |
|
49 |
public static final Pattern fileNamePattern = Pattern.compile("[^a-zA-Z0-9\\.-]+"); //$NON-NLS-1$ |
|
50 |
public static final String UNDERSCORE = "_"; |
|
51 |
|
|
52 |
|
|
49 | 53 |
/** |
50 | 54 |
* The weight, essentially used for sorting purpose. |
51 | 55 |
*/ |
... | ... | |
304 | 308 |
|
305 | 309 |
StringBuilder str = new StringBuilder(); |
306 | 310 |
|
307 |
str.append("Command preferences\n"); //$NON-NLS-1$ |
|
308 |
str.append(TXMPreferences.getKeysAndValues(TXMPreferences.scope, this.preferencesNodeQualifier)); |
|
309 |
str.append("\nDefault preferences\n"); //$NON-NLS-1$ |
|
311 |
str.append("Default command preferences\n"); //$NON-NLS-1$ |
|
310 | 312 |
str.append(TXMPreferences.getKeysAndValues(DefaultScope.INSTANCE, this.preferencesNodeQualifier)); |
311 | 313 |
|
314 |
str.append("\nCommand preferences\n"); //$NON-NLS-1$ |
|
315 |
str.append(TXMPreferences.getKeysAndValues(TXMPreferences.scope, this.preferencesNodeQualifier)); |
|
316 |
|
|
312 | 317 |
return str.toString(); |
313 | 318 |
} |
314 | 319 |
|
... | ... | |
333 | 338 |
|
334 | 339 |
str.append("Parameters (type = " + parametersType + " / " + Parameter.types[parametersType] + ")\n"); //$NON-NLS-1$ |
335 | 340 |
|
336 |
List<Field> fields = new ArrayList<Field>(); |
|
337 |
Class<?> clazz = this.getClass(); |
|
338 |
while (clazz != Object.class) { |
|
339 |
fields.addAll(Arrays.asList(clazz.getDeclaredFields())); |
|
340 |
clazz = clazz.getSuperclass(); |
|
341 |
} |
|
341 |
List<Field> fields = this.getAllFields(); |
|
342 | 342 |
|
343 | 343 |
for (Field f : fields) { |
344 | 344 |
Parameter parameter = f.getAnnotation(Parameter.class); |
... | ... | |
1211 | 1211 |
*/ |
1212 | 1212 |
public abstract String getDetails(); |
1213 | 1213 |
|
1214 |
// /** |
|
1215 |
// * Gets some details of the result to compute. Shown in progress dialogs. |
|
1216 |
// * |
|
1217 |
// * @return the message to show |
|
1218 |
// */ |
|
1219 |
// public abstract String getComputingMessage(); |
|
1220 |
|
|
1221 |
|
|
1222 | 1214 |
/** |
1223 | 1215 |
* Convenience method to get a shared name when the result is empty (not yet computed). |
1224 | 1216 |
* @return the String "*" |
... | ... | |
1236 | 1228 |
return this.uniqueID; |
1237 | 1229 |
} |
1238 | 1230 |
|
1239 |
public static final Pattern filenamePattern = Pattern.compile("[^a-zA-Z0-9\\._-]+"); //$NON-NLS-1$ |
|
1240 |
public static final String UNDERSCORE = "_"; |
|
1241 | 1231 |
/** |
1242 | 1232 |
* Gets a string representing the result and that can be used as a file |
1243 | 1233 |
* name. |
... | ... | |
1247 | 1237 |
// FIXME: to discuss and/or to move in export layer |
1248 | 1238 |
public String getValidFileName() { |
1249 | 1239 |
try { |
1250 |
return filenamePattern.matcher(this.getName()).replaceAll(UNDERSCORE); //$NON-NLS-1$
|
|
1240 |
fileNamePattern.matcher(this.getName()).replaceAll(UNDERSCORE); //$NON-NLS-1$
|
|
1251 | 1241 |
} catch (Exception e) { |
1252 | 1242 |
} |
1253 | 1243 |
return ""; |
tmp/org.txm.lexicon.core/src/org/txm/lexicon/core/corpusengine/cqp/Lexicon.java (revision 617) | ||
---|---|---|
34 | 34 |
import java.io.OutputStreamWriter; |
35 | 35 |
import java.io.UnsupportedEncodingException; |
36 | 36 |
import java.util.Arrays; |
37 |
import java.util.HashSet; |
|
38 | 37 |
import java.util.Map; |
39 | 38 |
|
40 | 39 |
import org.eclipse.core.runtime.IProgressMonitor; |
... | ... | |
63 | 62 |
* {@link Subcorpus}) and a {@link Property}. |
64 | 63 |
* @author sloiseau |
65 | 64 |
*/ |
66 |
public class Lexicon { |
|
65 |
public class Lexicon extends TXMResult {
|
|
67 | 66 |
|
68 | 67 |
/** The nolex. */ |
69 | 68 |
protected static int nolex = 1; |
... | ... | |
122 | 121 |
// } |
123 | 122 |
|
124 | 123 |
public Lexicon(Corpus corpus) { |
124 |
super(corpus); |
|
125 | 125 |
this.corpus = corpus; |
126 | 126 |
} |
127 | 127 |
|
128 |
/** |
|
129 |
* Convert the Lexicon into a Vector object. |
|
130 |
* |
|
131 |
* @return the vector |
|
132 |
* @throws StatException the stat exception |
|
133 |
*/ |
|
134 |
public Vector asVector() throws StatException { |
|
135 |
String symbol = prefixR + (nolex++); |
|
136 |
VectorImpl v = new VectorImpl(freqs, symbol); |
|
137 |
v.setRNames(getForms()); |
|
138 |
this.symbol = v.getSymbol(); |
|
139 |
return v; |
|
128 |
|
|
129 |
@Override |
|
130 |
public boolean saveParameters() throws Exception { |
|
131 |
// TODO Auto-generated method stub |
|
132 |
return true; |
|
140 | 133 |
} |
141 | 134 |
|
142 |
public boolean compute(IProgressMonitor monitor) throws Exception { |
|
135 |
@Override |
|
136 |
public boolean loadParameters() throws Exception { |
|
137 |
// TODO Auto-generated method stub |
|
138 |
return true; |
|
139 |
} |
|
140 |
|
|
141 |
@Override |
|
142 |
public void clean() { |
|
143 |
// TODO Auto-generated method stub |
|
144 |
|
|
145 |
} |
|
146 |
|
|
147 |
@Override |
|
148 |
public boolean canCompute() throws Exception { |
|
149 |
return corpus != null && pProperty != null; |
|
150 |
} |
|
151 |
|
|
152 |
@Override |
|
153 |
protected boolean _compute() throws Exception { |
|
143 | 154 |
if (corpus instanceof MainCorpus) { |
144 | 155 |
return computeWithMainCorpus((MainCorpus)corpus, pProperty, monitor); |
145 |
} else if (corpus instanceof Subcorpus) { |
|
156 |
} |
|
157 |
else if (corpus instanceof Subcorpus) { |
|
146 | 158 |
return computewithSubCorpus((Subcorpus)corpus, pProperty, monitor); |
147 |
} else { |
|
148 |
System.out.println("Error: Lexicon parent is nor a Maincorpus nor a Subcorpus."); |
|
159 |
} |
|
160 |
else { |
|
161 |
System.out.println("Error: Lexicon parent is neither a Maincorpus nor a Subcorpus."); |
|
149 | 162 |
return false; |
150 | 163 |
} |
151 | 164 |
} |
152 |
|
|
165 |
|
|
153 | 166 |
/** |
154 |
* Compute number of tokens. / this.nbr |
|
155 |
*/ |
|
156 |
private void computeNumberOfTokens() { |
|
157 |
numberOfTokens = 0; |
|
158 |
for (int i = 0; i < freqs.length; i++) { |
|
159 |
numberOfTokens += freqs[i]; |
|
160 |
// System.out.println(numberOfTokens); |
|
161 |
// if (freqs[i] != 1) System.out.println(freqs[i]); |
|
162 |
} |
|
163 |
} |
|
164 |
|
|
165 |
/** |
|
166 | 167 |
* Gets the lexicon relative to a given property. |
167 | 168 |
* |
168 | 169 |
* @param property |
... | ... | |
176 | 177 |
protected boolean computeWithMainCorpus(MainCorpus corpus, Property property, IProgressMonitor monitor) throws CqiClientException { |
177 | 178 |
// System.out.println("in "+this.getCqpId()+" look for cached lexicon "+property); |
178 | 179 |
// System.out.println("not found"); |
179 |
if (monitor != null) monitor.subTask("Computing lexicon size...");
|
|
180 |
this.subTask("Computing lexicon size...");
|
|
180 | 181 |
Log.finest(TXMCoreMessages.LEXICON + corpus.getName()); |
181 | 182 |
int lexiconSize; |
182 | 183 |
try { |
183 |
lexiconSize = CorpusManager.getCorpusManager().getCqiClient() |
|
184 |
.lexiconSize(property.getQualifiedName()); |
|
184 |
lexiconSize = CorpusManager.getCorpusManager().getCqiClient().lexiconSize(property.getQualifiedName()); |
|
185 | 185 |
} catch (Exception e) { |
186 | 186 |
throw new CqiClientException(e); |
187 | 187 |
} |
... | ... | |
193 | 193 |
|
194 | 194 |
int[] freqs; |
195 | 195 |
try { |
196 |
if (monitor != null) monitor.subTask("Computing lexicon frequencies..."); |
|
197 |
freqs = CorpusManager.getCorpusManager().getCqiClient().id2Freq( |
|
198 |
property.getQualifiedName(), ids); |
|
196 |
this.subTask("Computing lexicon frequencies..."); |
|
197 |
freqs = CorpusManager.getCorpusManager().getCqiClient().id2Freq(property.getQualifiedName(), ids); |
|
199 | 198 |
} catch (Exception e) { |
200 | 199 |
throw new CqiClientException(e); |
201 | 200 |
} |
... | ... | |
204 | 203 |
return true; |
205 | 204 |
} |
206 | 205 |
|
206 |
/** |
|
207 |
* |
|
208 |
* @param corpus |
|
209 |
* @param property |
|
210 |
* @param monitor |
|
211 |
* @return |
|
212 |
* @throws CqiClientException |
|
213 |
*/ |
|
207 | 214 |
protected boolean computewithSubCorpus(Subcorpus corpus, Property property, IProgressMonitor monitor) throws CqiClientException { |
208 | 215 |
|
209 | 216 |
//System.out.println("not found"); |
... | ... | |
212 | 219 |
int[][] fdist = null; |
213 | 220 |
Subcorpus tmp = null; |
214 | 221 |
try { |
215 |
if (monitor != null) monitor.subTask("Computing lexicon frequencies...");
|
|
222 |
this.subTask("Computing lexicon frequencies...");
|
|
216 | 223 |
tmp = corpus.createSubcorpus(new Query("[]"), "S"+corpus.getNextSubcorpusCounter(), true); //$NON-NLS-1$ |
217 | 224 |
if (tmp != null) { |
218 | 225 |
fdist = CorpusManager.getCorpusManager().getCqiClient().fdist1( |
... | ... | |
242 | 249 |
init(corpus, property, freqs, ids); |
243 | 250 |
return true; |
244 | 251 |
} |
252 |
|
|
253 |
|
|
254 |
/** |
|
255 |
* Convert the Lexicon into a Vector object. |
|
256 |
* |
|
257 |
* @return the vector |
|
258 |
* @throws StatException the stat exception |
|
259 |
*/ |
|
260 |
public Vector asVector() throws StatException { |
|
261 |
String symbol = prefixR + (nolex++); |
|
262 |
VectorImpl v = new VectorImpl(freqs, symbol); |
|
263 |
v.setRNames(getForms()); |
|
264 |
this.symbol = v.getSymbol(); |
|
265 |
return v; |
|
266 |
} |
|
245 | 267 |
|
268 |
|
|
269 |
/** |
|
270 |
* Compute number of tokens. / this.nbr |
|
271 |
*/ |
|
272 |
private void computeNumberOfTokens() { |
|
273 |
numberOfTokens = 0; |
|
274 |
for (int i = 0; i < freqs.length; i++) { |
|
275 |
numberOfTokens += freqs[i]; |
|
276 |
// System.out.println(numberOfTokens); |
|
277 |
// if (freqs[i] != 1) System.out.println(freqs[i]); |
|
278 |
} |
|
279 |
} |
|
280 |
|
|
281 |
|
|
282 |
|
|
283 |
@Override |
|
246 | 284 |
public boolean delete() { |
247 |
if (corpus != null) corpus.removeData(this); |
|
285 |
if (corpus != null) { |
|
286 |
corpus.removeData(this); |
|
287 |
} |
|
248 | 288 |
return true; |
249 | 289 |
} |
250 | 290 |
|
... | ... | |
269 | 309 |
*/ |
270 | 310 |
@Override |
271 | 311 |
public boolean equals(Object obj) { |
272 |
if (!(obj instanceof Lexicon)) |
|
312 |
if (!(obj instanceof Lexicon)) {
|
|
273 | 313 |
return false; |
314 |
} |
|
274 | 315 |
Lexicon other = (Lexicon) obj; |
275 | 316 |
|
276 |
if (other.nbrOfType() != this.nbrOfType()) |
|
317 |
if (other.nbrOfType() != this.nbrOfType()) {
|
|
277 | 318 |
return false; |
278 |
return (Arrays.equals(freqs, other.getFreq()) && Arrays.equals(
|
|
279 |
getForms(), other.getForms()));
|
|
319 |
}
|
|
320 |
return (Arrays.equals(freqs, other.getFreq()) && Arrays.equals(getForms(), other.getForms()));
|
|
280 | 321 |
} |
281 | 322 |
|
282 | 323 |
/** |
... | ... | |
289 | 330 |
} |
290 | 331 |
|
291 | 332 |
public String getDetails() { |
292 |
//FIXME: the hierarchy of Lexicon and Index should be redefined |
|
293 |
// Index should not store a Lexicon? |
|
294 |
// + Lexicon should extend Index? |
|
295 |
// try { |
|
296 |
// Object[] params = new Object[]{this.corpus.getSimpleName(),index.getQuery().getQueryString(), index.getProperties(), index.getFmin(), index.getFmax()}; |
|
297 |
// String str; |
|
298 |
// if(this.parent instanceof Partition) { |
|
299 |
// str = LexiconCoreMessages.DetailsFromPartition; |
|
300 |
// } |
|
301 |
// else { |
|
302 |
// str = LexiconCoreMessages.DetailsFromCorpus; |
|
303 |
// } |
|
304 |
// return NLS.bind(str, params); |
|
305 |
// } |
|
306 |
// catch(Exception e) { |
|
307 |
// return ""; |
|
308 |
// } |
|
309 |
return this.corpus.getName()+" "+this.pProperty.getName(); |
|
333 |
return this.corpus.getName() + " " + this.pProperty.getName(); //$NON-NLS-1$ |
|
310 | 334 |
} |
311 | 335 |
|
312 | 336 |
//TODO: move this into a Lexicon chart renderer |
... | ... | |
337 | 361 |
*/ |
338 | 362 |
public String[] getForms() { |
339 | 363 |
if (forms == null) { |
340 |
if(ids == null) |
|
364 |
if(ids == null) {
|
|
341 | 365 |
return new String[0]; |
366 |
} |
|
342 | 367 |
try { |
343 |
forms = CorpusManager.getCorpusManager().getCqiClient().id2Str( |
|
344 |
pProperty.getQualifiedName(), ids); |
|
368 |
forms = CorpusManager.getCorpusManager().getCqiClient().id2Str(pProperty.getQualifiedName(), ids); |
|
345 | 369 |
} catch (Exception e) { |
346 | 370 |
// TODO Auto-generated catch block |
347 | 371 |
org.txm.utils.logger.Log.printStackTrace(e); |
... | ... | |
363 | 387 |
if (forms == null) { |
364 | 388 |
try { |
365 | 389 |
number = Math.min(number, ids.length); |
366 |
if (number <= 0) |
|
390 |
if (number <= 0) {
|
|
367 | 391 |
return new String[0]; |
392 |
} |
|
368 | 393 |
int[] subpositions = new int[number]; |
369 | 394 |
System.arraycopy(ids, 0, subpositions, 0, number); |
370 |
return CorpusManager.getCorpusManager().getCqiClient().id2Str( |
|
371 |
pProperty.getQualifiedName(), subpositions); |
|
395 |
return CorpusManager.getCorpusManager().getCqiClient().id2Str(pProperty.getQualifiedName(), subpositions); |
|
372 | 396 |
} catch (Exception e) { |
373 | 397 |
// TODO Auto-generated catch block |
374 | 398 |
org.txm.utils.logger.Log.printStackTrace(e); |
... | ... | |
376 | 400 |
} |
377 | 401 |
} else { |
378 | 402 |
number = Math.min(number, ids.length); |
379 |
if (number <= 0) |
|
403 |
if (number <= 0) {
|
|
380 | 404 |
return new String[0]; |
405 |
} |
|
381 | 406 |
String[] subforms = new String[number]; |
382 | 407 |
System.arraycopy(ids, 0, subforms, 0, number); |
383 | 408 |
return subforms; |
... | ... | |
408 | 433 |
} |
409 | 434 |
catch(Exception e) { |
410 | 435 |
} |
411 |
return ""; |
|
436 |
return ""; //$NON-NLS-1$
|
|
412 | 437 |
} |
413 | 438 |
|
414 | 439 |
/** |
... | ... | |
434 | 459 |
* |
435 | 460 |
* @return the symbol |
436 | 461 |
*/ |
437 |
public String getSymbol() |
|
438 |
{ |
|
462 |
public String getSymbol() { |
|
439 | 463 |
return this.symbol; |
440 | 464 |
} |
441 | 465 |
|
... | ... | |
474 | 498 |
* {@link Subcorpus#getLexicon(Property)}. |
475 | 499 |
*/ |
476 | 500 |
protected void init(TXMResult corpus, Property property, int[] freq, int[] ids) { |
477 |
if (freq.length != ids.length) |
|
501 |
if (freq.length != ids.length) {
|
|
478 | 502 |
throw new IllegalArgumentException(LexiconCoreMessages.Lexicon_0); |
503 |
} |
|
479 | 504 |
this.freqs = freq; |
480 | 505 |
this.ids = ids; |
481 | 506 |
this.forms = null; |
... | ... | |
490 | 515 |
* @return the size of the corpus or subcorpus. |
491 | 516 |
*/ |
492 | 517 |
public int nbrOfToken() { |
493 |
if (numberOfTokens <= 0) |
|
518 |
if (numberOfTokens <= 0) {
|
|
494 | 519 |
computeNumberOfTokens(); |
520 |
} |
|
495 | 521 |
return numberOfTokens; |
496 | 522 |
} |
497 | 523 |
|
... | ... | |
509 | 535 |
this.pProperty = property; |
510 | 536 |
} |
511 | 537 |
|
538 |
@Override |
|
512 | 539 |
public boolean setParameters(TXMParameters parameters) { |
513 | 540 |
try { |
514 | 541 |
Property p = (Property) parameters.get("properties"); |
... | ... | |
570 | 597 |
return true; |
571 | 598 |
} |
572 | 599 |
|
573 |
public boolean validateParameters() { |
|
574 |
return corpus != null && pProperty != null; |
|
575 |
} |
|
576 |
|
|
577 | 600 |
public void setProperty(Property property) { |
578 | 601 |
this.pProperty = property; |
579 | 602 |
} |
603 |
|
|
604 |
|
|
580 | 605 |
} |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/editors/IndexEditor.java (revision 617) | ||
---|---|---|
753 | 753 |
if (index.getFilterFmin() != null) { |
754 | 754 |
this.fMinSpinner.setSelection(index.getFilterFmin()); |
755 | 755 |
} else { |
756 |
this.fMinSpinner.setSelection(this.getIntParameterValue(IndexPreferences.FMIN_FILTER));
|
|
756 |
this.fMinSpinner.setSelection(this.getIntParameterValue(IndexPreferences.F_MIN));
|
|
757 | 757 |
} |
758 | 758 |
|
759 | 759 |
if (index.getFilterFmax() != null) { |
760 | 760 |
this.fMaxSpinner.setSelection(index.getFilterFmax()); |
761 | 761 |
} else { |
762 |
this.fMaxSpinner.setSelection(this.getIntParameterValue(IndexPreferences.FMAX_FILTER));
|
|
762 |
this.fMaxSpinner.setSelection(this.getIntParameterValue(IndexPreferences.F_MAX));
|
|
763 | 763 |
} |
764 | 764 |
|
765 | 765 |
if (index.getFilterVmax() != null) { |
766 | 766 |
this.vMaxSpinner.setSelection(index.getFilterVmax()); |
767 | 767 |
} else { |
768 |
this.vMaxSpinner.setSelection(this.getIntParameterValue(IndexPreferences.VMAX_FILTER));
|
|
768 |
this.vMaxSpinner.setSelection(this.getIntParameterValue(IndexPreferences.V_MAX));
|
|
769 | 769 |
} |
770 | 770 |
|
771 | 771 |
if (index.getNLinesPerPage() != null) { |
772 | 772 |
this.nLinesPerPageSpinner.setSelection(index.getNLinesPerPage()); |
773 | 773 |
} else { |
774 |
this.nLinesPerPageSpinner.setSelection(this.getIntParameterValue(IndexPreferences.NLINESPERPAGE));
|
|
774 |
this.nLinesPerPageSpinner.setSelection(this.getIntParameterValue(IndexPreferences.N_LINES_PER_PAGE));
|
|
775 | 775 |
} |
776 | 776 |
|
777 | 777 |
queryWidget.setFocus(); |
tmp/org.txm.index.rcp/src/org/txm/index/rcp/preferences/IndexPreferencesPage.java (revision 617) | ||
---|---|---|
19 | 19 |
|
20 | 20 |
@Override |
21 | 21 |
protected void createFieldEditors() { |
22 |
this.addField(new IntegerFieldEditor(IndexPreferences.NLINESPERPAGE, "Number of lines per result page", this.getFieldEditorParent()));
|
|
22 |
this.addField(new IntegerFieldEditor(IndexPreferences.N_LINES_PER_PAGE, "Number of lines per result page", this.getFieldEditorParent()));
|
|
23 | 23 |
} |
24 | 24 |
} |
tmp/org.txm.searchengine.cqp.core/src/org/txm/functions/diagnostic/Diagnostic.java (revision 617) | ||
---|---|---|
54 | 54 |
import org.txm.searchengine.cqp.clientExceptions.CqiClientException; |
55 | 55 |
import org.txm.searchengine.cqp.corpus.Corpus; |
56 | 56 |
import org.txm.searchengine.cqp.corpus.CorpusManager; |
57 |
import org.txm.searchengine.cqp.corpus.Part; |
|
58 |
import org.txm.searchengine.cqp.corpus.Partition; |
|
59 | 57 |
import org.txm.searchengine.cqp.corpus.Property; |
60 | 58 |
import org.txm.searchengine.cqp.corpus.StructuralUnit; |
61 | 59 |
import org.txm.searchengine.cqp.corpus.StructuralUnitProperty; |
... | ... | |
72 | 70 |
/** The corpus. */ |
73 | 71 |
Corpus corpus; |
74 | 72 |
|
75 |
/** The partition. */ |
|
76 |
Partition partition; |
|
77 |
|
|
78 |
/** The maxvalue. */ |
|
79 |
@Parameter(key=CQPPreferences.MAXVALUE) |
|
80 |
Integer pMaxValue; |
|
81 |
|
|
82 | 73 |
// Numbers |
83 | 74 |
/** The T. */ |
84 | 75 |
int T = 0; // number of word |
... | ... | |
126 | 117 |
|
127 | 118 |
private File diagfile; |
128 | 119 |
|
120 |
|
|
121 |
/** The maxvalue. */ |
|
122 |
@Parameter(key=CQPPreferences.MAXVALUE) |
|
123 |
Integer pMaxValue; |
|
124 |
|
|
125 |
|
|
126 |
|
|
129 | 127 |
/** |
130 | 128 |
* Instantiates a new diagnostic. |
131 | 129 |
* |
... | ... | |
641 | 639 |
this.worked(1); |
642 | 640 |
|
643 | 641 |
String txmhome = TXMPreferences.getString(TBXPreferences.USER_TXM_HOME, TBXPreferences.PREFERENCES_NODE); |
644 |
String filename = corpus.getParent().getName()+"-"+corpus.getName(); //$NON-NLS-1$
|
|
642 |
String filename = corpus.getParent().getName() + "-" + corpus.getName(); //$NON-NLS-1$
|
|
645 | 643 |
filename = AsciiUtils.buildId(filename); |
646 | 644 |
diagfile = new File(txmhome, "results/" + filename + "-infos.html"); //$NON-NLS-1$ //$NON-NLS-2$ |
647 | 645 |
|
648 | 646 |
this.toHTML(diagfile); |
649 |
|
|
650 |
dirty = false; |
|
651 | 647 |
return true; |
652 | 648 |
} |
653 | 649 |
|
... | ... | |
673 | 669 |
// nothing to do |
674 | 670 |
return true; |
675 | 671 |
} |
672 |
|
|
676 | 673 |
|
677 | 674 |
@Override |
678 | 675 |
public boolean saveParameters() { |
679 |
if (pMaxValue != null) this.saveParameter(CQPPreferences.MAXVALUE, pMaxValue);
|
|
676 |
// nothing to do
|
|
680 | 677 |
return true; |
681 | 678 |
} |
682 | 679 |
} |
tmp/org.txm.referencer.core/src/org/txm/functions/referencer/Referencer.java (revision 617) | ||
---|---|---|
103 | 103 |
/** The nlines. */ |
104 | 104 |
int nlines; |
105 | 105 |
|
106 |
/** The hierarchic sort. */ |
|
107 |
@Parameter(key=ReferencerPreferences.SORTBYFREQ) |
|
108 |
private boolean pHierarchicSort; |
|
109 |
@Parameter |
|
110 |
List<StructuralUnitProperty> pPattern; |
|
111 |
/** The prop. */ |
|
112 |
@Parameter |
|
113 |
Property pProperty; |
|
114 |
|
|
115 |
/** The query. */ |
|
116 |
@Parameter |
|
117 |
Query pQuery; |
|
118 |
|
|
119 | 106 |
/** The processed idx. */ |
120 | 107 |
HashMap<Integer, Line> processedIdx; |
121 | 108 |
|
... | ... | |
127 | 114 |
|
128 | 115 |
/** The writer. */ |
129 | 116 |
private BufferedWriter writer; |
130 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
/** The hierarchic sort. */ |
|
123 |
@Parameter(key=ReferencerPreferences.SORT_BY_FREQ) |
|
124 |
private boolean pHierarchicSort; |
|
125 |
|
|
126 |
@Parameter |
|
127 |
List<StructuralUnitProperty> pPattern; |
|
128 |
|
|
129 |
/** The prop. */ |
|
130 |
@Parameter |
|
131 |
Property pProperty; |
|
132 |
|
|
133 |
/** The query. */ |
|
134 |
@Parameter |
|
135 |
Query pQuery; |
|
136 |
|
|
137 |
|
|
138 |
|
|
139 |
|
|
140 |
|
|
131 | 141 |
/** |
132 | 142 |
* Instantiates a new referencer. |
133 | 143 |
* |
... | ... | |
216 | 226 |
return false; |
217 | 227 |
} |
218 | 228 |
catch(CqiClientException e) { |
219 |
// TODO Auto-generated catch block |
|
220 | 229 |
e.printStackTrace(); |
221 | 230 |
return false; |
222 | 231 |
} |
... | ... | |
323 | 332 |
* @return the name |
324 | 333 |
*/ |
325 | 334 |
public String getName() { |
326 |
return getCorpus().getName()+": "+pQuery; //$NON-NLS-1$
|
|
335 |
return getCorpus().getName() + ": " + pQuery; //$NON-NLS-1$
|
|
327 | 336 |
} |
328 | 337 |
|
329 | 338 |
/** |
... | ... | |
402 | 411 |
|
403 | 412 |
@Override |
404 | 413 |
public String getSimpleName() { |
405 |
if (pQuery != null) return pQuery.toString(); |
|
406 |
else return getName(); |
|
414 |
if (pQuery != null) { |
|
415 |
return pQuery.toString(); |
|
416 |
} |
|
417 |
else { |
|
418 |
return getName(); |
|
419 |
} |
|
407 | 420 |
} |
408 | 421 |
|
409 | 422 |
/** |
... | ... | |
416 | 429 |
} |
417 | 430 |
|
418 | 431 |
public int getV() { |
419 |
if (matches == null) return 0; |
|
432 |
if (matches == null) { |
|
433 |
return 0; |
|
434 |
} |
|
420 | 435 |
return matches.size(); |
421 | 436 |
} |
422 | 437 |
|
... | ... | |
553 | 568 |
|
554 | 569 |
s = this.getStringParameterValue(ReferencerPreferences.PROPERTY); |
555 | 570 |
this.pProperty = getCorpus().getProperty(s); |
556 |
|
|
557 |
//this.pHierarchicSort = this.getBooleanParameterValue(ReferencerPreferences.SORTBYFREQ); |
|
558 | 571 |
return true; |
559 | 572 |
} |
560 | 573 |
|
tmp/org.txm.referencer.core/src/org/txm/functions/referencer/ReferencerPreferences.java (revision 617) | ||
---|---|---|
11 | 11 |
|
12 | 12 |
/** The Constant SORTBYFREQ. */ |
13 | 13 |
//FIXME: to extract to referencer plug-in |
14 |
public static final String SORTBYFREQ = "sorttype"; //$NON-NLS-1$
|
|
14 |
public static final String SORT_BY_FREQ = "sorttype"; //$NON-NLS-1$
|
|
15 | 15 |
|
16 | 16 |
public static final String QUERY = "query"; //$NON-NLS-1$ |
17 | 17 |
public static final String PROPERTY = "property"; //$NON-NLS-1$ |
... | ... | |
21 | 21 |
public void initializeDefaultPreferences() { |
22 | 22 |
Preferences preferences = DefaultScope.INSTANCE.getNode(PREFERENCES_NODE); |
23 | 23 |
|
24 |
preferences.putBoolean(SORTBYFREQ, false); //$NON-NLS-1$
|
|
24 |
preferences.putBoolean(SORT_BY_FREQ, false); //$NON-NLS-1$
|
|
25 | 25 |
|
26 | 26 |
preferences.put(QUERY, ""); //$NON-NLS-1$ |
27 | 27 |
preferences.put(PROPERTY, "word"); //$NON-NLS-1$ |
tmp/org.txm.lexicaltable.core/src/org/txm/lexicaltable/core/functions/LexicalTable.java (revision 617) | ||
---|---|---|
199 | 199 |
for (int i = 0; i < partition.getNPart(); i++) { |
200 | 200 |
Lexicon l = new Lexicon(partition.getParts().get(i)); |
201 | 201 |
l.setProperty(this.pProperty); |
202 |
l.compute(null);
|
|
202 |
l.compute(this.monitor);
|
|
203 | 203 |
lexicons.add(l); |
204 | 204 |
} |
205 | 205 |
//System.out.println("time lexicon build "+(System.currentTimeMillis()-time)); |
... | ... | |
207 | 207 |
// String[] entries = allLexiconEntry.toArray(new String[]{}); |
208 | 208 |
Lexicon ll = new Lexicon(partition.getCorpus()); |
209 | 209 |
ll.setProperty(this.pProperty); |
210 |
ll.compute(null);
|
|
210 |
ll.compute(this.monitor);
|
|
211 | 211 |
|
212 | 212 |
ArrayList<String> filteredForms = new ArrayList<String>(); |
213 | 213 |
//create a copy and filter line with Fmin; |
... | ... | |
360 | 360 |
Corpus parentCorpus = subcorpus.getMotherCorpus(); |
361 | 361 |
Lexicon l1 = new Lexicon(parentCorpus); |
362 | 362 |
l1.setProperty(pProperty); |
363 |
l1.compute(null);
|
|
363 |
l1.compute(this.monitor);
|
|
364 | 364 |
Lexicon l2 = new Lexicon(subcorpus); |
365 | 365 |
l2.setProperty(pProperty); |
366 |
l2.compute(null);
|
|
366 |
l2.compute(this.monitor);
|
|
367 | 367 |
this.statsData = new LexicalTableImpl(getNextName(), l1, l2); |
368 | 368 |
} |
369 | 369 |
else if (this.parent instanceof Partition) { |
... | ... | |
413 | 413 |
return true; |
414 | 414 |
} |
415 | 415 |
|
416 |
/** |
|
417 |
* |
|
418 |
* @return |
|
419 |
*/ |
|
416 | 420 |
protected static String getNextName() { |
417 |
return SYMBOL_BASE+(LEXICALTABLE_COUNTER++);
|
|
421 |
return SYMBOL_BASE + (LEXICALTABLE_COUNTER++);
|
|
418 | 422 |
} |
419 | 423 |
|
420 | 424 |
@Override |
... | ... | |
480 | 484 |
return ""; |
481 | 485 |
} |
482 | 486 |
|
487 |
/** |
|
488 |
* Gets the columns count. |
|
489 |
* @return |
|
490 |
*/ |
|
483 | 491 |
public int getNColumns() { |
484 | 492 |
return statsData.getNColumns(); |
485 | 493 |
} |
Formats disponibles : Unified diff