Revision 1065

tmp/org.txm.treetagger.core/src/org/txm/treetagger/core/TreeTaggerEngine.java (revision 1065)
32 32
			return false;
33 33
		}
34 34
		
35
		options = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.OPTIONS).split("  ");
35
		//options = TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.OPTIONS).split("  ");
36 36
		
37 37
		return ttBinaryDirectory != null && ttBinaryDirectory.exists() && ttModelsDirectory != null && ttModelsDirectory.exists();
38 38
	}
tmp/org.txm.treetagger.core/src/org/txm/treetagger/core/preferences/TreeTaggerPreferences.java (revision 1065)
42 42
	 */
43 43
	public static final String MODELS_PATH = "models_path"; //$NON-NLS-1$
44 44
	
45
	public static final String OPTIONS = "options"; //$NON-NLS-1$
45
	//public static final String OPTIONS = "options"; //$NON-NLS-1$
46 46
	
47
	public static final String OPTIONS_LEX = "lex"; //$NON-NLS-1$
48
	public static final String OPTIONS_WC = "wc"; //$NON-NLS-1$
49
	public static final String OPTIONS_UNKNOWN = "unknown"; //$NON-NLS-1$
50
	public static final String OPTIONS_DEBUG = "debug"; //$NON-NLS-1$
51
	public static final String OPTIONS_CAPHEURISTIC = "cap_heuristic"; //$NON-NLS-1$
52
	public static final String OPTIONS_HYPHENHEURISTIC = "hyphen_heuristic"; //$NON-NLS-1$
53
	public static final String OPTIONS_PROB = "prob"; //$NON-NLS-1$
54
	
47 55
	public static final String FIX_APOSTROPHES = "fix_apostrophes"; //$NON-NLS-1$
48 56

  
49 57
	
......
75 83
		preferences.put(INSTALL_PATH, installPath);
76 84
		preferences.put(MODELS_PATH, installPath + "/models"); //$NON-NLS-1$
77 85
		preferences.putBoolean(FIX_APOSTROPHES, false);
78

  
86
		
87
		preferences.putBoolean(OPTIONS_DEBUG, false);
88
		preferences.putBoolean(OPTIONS_CAPHEURISTIC, false);
89
		preferences.putBoolean(OPTIONS_HYPHENHEURISTIC, false);
90
		preferences.putBoolean(OPTIONS_UNKNOWN, true);
91
		preferences.putBoolean(OPTIONS_PROB, false);
92
		
79 93
		// FIXME: need to validate this code + need to check if it's still useful
80 94
		String bversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_BINARIES_VERSION);
81 95
		String mversion = TreeTaggerPreferences.getInstance().getString(INSTALLED_MODELS_VERSION);
......
97 111
					BufferedReader reader = IOUtils.getReader(previousPreferenceFile, "ISO-8859-1"); //$NON-NLS-1$
98 112
					previousProperties.load(reader);
99 113
					
100
					String [] keys= {INSTALL_PATH, MODELS_PATH, OPTIONS};
114
					String [] keys= {INSTALL_PATH, MODELS_PATH};
101 115
					for (String k : keys) {
102 116
						if (previousProperties.getProperty(previousProperties.getProperty(k)) != null) {
103 117
							preferences.put(k, installPath);
tmp/org.txm.treetagger.core/src/org/txm/importer/xmltxm/Annotate.groovy (revision 1065)
209 209
			File infile = ttsrcfile;
210 210
			File outfile = ttoutfile;
211 211

  
212
			// TODO: why org.txm.utils.treetagger.TreeTagger tt = ..., throw IllegalAccessError ???
213
			String opt = TreeTaggerPreferences.getString(TreeTaggerPreferences.OPTIONS, TreeTaggerPreferences.PREFERENCES_NODE);
214
			if (options == null) {
215
				if (opt == null) opt = "";
216
				options = opt.split("  ");
217
			}
218

  
219 212
			def tt = new TreeTagger(TreeTaggerPreferences.getString(TreeTaggerPreferences.INSTALL_PATH, TreeTaggerPreferences.PREFERENCES_NODE)+"/bin/", options);
220 213
			tt.settoken();
221 214
			tt.setlemma();
222
			tt.setquiet();
223 215
			tt.setsgml();
224
			tt.setnounknown();
216
			if (TreeTaggerPreferences.getBoolean(TreeTaggerPreferences.OPTIONS_UNKNOWN, TreeTaggerPreferences.PREFERENCES_NODE)) {
217
				tt.setnounknown();
218
			}
225 219
			tt.seteostag("<s>");
226
			tt.debug(debug);
220
			if (TreeTaggerPreferences.getBoolean(TreeTaggerPreferences.OPTIONS_DEBUG, TreeTaggerPreferences.PREFERENCES_NODE)) {
221
				tt.debug(true);
222
			} else {
223
				tt.setquiet();
224
			}
225
			if (TreeTaggerPreferences.getBoolean(TreeTaggerPreferences.OPTIONS_CAPHEURISTIC, TreeTaggerPreferences.PREFERENCES_NODE)) {
226
				tt.setcapheuristics();
227
			}
228
			if (TreeTaggerPreferences.getBoolean(TreeTaggerPreferences.OPTIONS_HYPHENHEURISTIC, TreeTaggerPreferences.PREFERENCES_NODE)) {
229
				tt.sethyphenheuristics();
230
			}
231
			if (TreeTaggerPreferences.getBoolean(TreeTaggerPreferences.OPTIONS_PROB, TreeTaggerPreferences.PREFERENCES_NODE)) {
232
				tt.setprob();
233
			}
234
			
235
			String lex = TreeTaggerPreferences.getString(TreeTaggerPreferences.OPTIONS_LEX, TreeTaggerPreferences.PREFERENCES_NODE);
236
			if (lex !=null && lex.length() > 0) {
237
				tt.setlex(lex);
238
			}
239
			String wc = TreeTaggerPreferences.getString(TreeTaggerPreferences.OPTIONS_WC, TreeTaggerPreferences.PREFERENCES_NODE);
240
			if (wc !=null && wc.length() > 0) {
241
				tt.setwc(wc);
242
			}
227 243
			tt.treetagger(modelfile.getAbsolutePath(), infile.getAbsolutePath(), outfile.getAbsolutePath())
228 244
			infile.delete();
229 245
		} catch(Exception e) {
230 246
			Log.printStackTrace(e);
231
			System.out.println("Failed to apply TreeTagger on $f input file with the $modelfile model file.");
247
			System.out.println("Failed to apply TreeTagger on $ttsrcfile input file with the $modelfile model file.");
232 248
			return false;
233 249
		}
234 250
		return true;
tmp/org.txm.rcp/OSGI-INF/l10n/bundle.properties (revision 1065)
3 3
#Thu Jul 25 14:46:50 CEST 2013
4 4

  
5 5
Bundle-Name = org.txm.rcp
6

  
6 7
Bundle-Vendor = Textometrie.org
7 8

  
8 9
category.description   = Textometry Functions
......
442 443

  
443 444
page.name    = User
444 445
page.name.0  = Advanced
446
page.name.1  = Debug
445 447
page.name.10 = Correspondence Analysis
446 448
page.name.12 = Export
447 449
page.name.16 = Referencer
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_ru.properties (revision 1065)
6 6
category.name        = TXM
7 7
category.name.0      = TXM
8 8

  
9

  
10 9
command.description     = \u00D0\u009F\u00D0\u00B5\u00D1\u0080\u00D0\u00B5\u00D0\u00B7\u00D0\u00B0\u00D0\u00B3\u00D1\u0080\u00D1\u0083\u00D0\u00B7\u00D0\u00B8\u00D1\u0082\u00D1\u008C TXM
11 10
command.description.0   = \u00D0\u009A\u00D0\u00BE\u00D0\u00BD\u00D0\u00B2\u00D0\u00B5\u00D1\u0080\u00D1\u0082\u00D0\u00B8\u00D1\u0080\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D1\u0082\u00D1\u008C \u00D1\u0081\u00D1\u0082\u00D0\u00B0\u00D1\u0080\u00D1\u008B\u00D0\u00B9 \u00D0\u00B1\u00D0\u00B8\u00D0\u00BD\u00D0\u00B0\u00D1\u0080\u00D0\u00BD\u00D1\u008B\u00D0\u00B9 \u00D1\u0084\u00D0\u00B0\u00D0\u00B9\u00D0\u00BB
12 11
command.description.1   = Reset corpora
......
331 330

  
332 331
page.name    = \u00D0\u009F\u00D0\u00BE\u00D0\u00BB\u00D1\u008C\u00D0\u00B7\u00D0\u00BE\u00D0\u00B2\u00D0\u00B0\u00D1\u0082\u00D0\u00B5\u00D0\u00BB\u00D1\u008C
333 332
page.name.0  = \u00D0\u0094\u00D0\u00BE\u00D0\u00BF\u00D0\u00BE\u00D0\u00BB\u00D0\u00BD\u00D0\u00B8\u00D1\u0082\u00D0\u00B5\u00D0\u00BB\u00D1\u008C\u00D0\u00BD\u00D0\u00BE
333
page.name.1  = Debug
334 334
page.name.10 = \u00D0\u00B0\u00D0\u00BD\u00D0\u00B0\u00D0\u00BB\u00D0\u00B8\u00D0\u00B7 \u00D1\u0081\u00D0\u00BE\u00D0\u00BE\u00D1\u0082\u00D0\u00B2\u00D0\u00B5\u00D1\u0082\u00D1\u0081\u00D1\u0082\u00D0\u00B2\u00D0\u00B8\u00D0\u00B9
335 335
page.name.12 = \u00D0\u00AD\u00D0\u00BA\u00D1\u0081\u00D0\u00BF\u00D0\u00BE\u00D1\u0080\u00D1\u0082
336 336
page.name.16 = \u00D0\u00A1\u00D1\u0081\u00D1\u008B\u00D0\u00BB\u00D0\u00BA\u00D0\u00B8
tmp/org.txm.rcp/OSGI-INF/l10n/bundle_fr.properties (revision 1065)
3 3
#Thu Jul 25 14:48:07 CEST 2013
4 4

  
5 5
Bundle-Name = org.txm.rcp
6

  
6 7
Bundle-Vendor = Textometrie.org
7 8

  
8 9
category.description = Commandes de Textometrie
......
462 463

  
463 464
page.name    = Utilisateur
464 465
page.name.0  = Avanc\u00E9
466
page.name.1  = Debug
465 467
page.name.10 = Analyse des correspondances
466 468
page.name.11 = Cooccurrences
467 469
page.name.12 = Export
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/handlers/Train.java (revision 1065)
342 342

  
343 343
					// Call treetagger-train
344 344
					if (ttSrcFile.exists() && lexique2.exists() && openclassfile.exists()) {
345
						System.out.println("Running ");
345
						System.out.println("Running treetagger-train...");
346 346
						String treetaggerBinDirectory = new File(TreeTaggerPreferences.getInstance().getString(TreeTaggerPreferences.INSTALL_PATH), "bin").getAbsolutePath();
347 347
						if (!treetaggerBinDirectory.endsWith("/")) treetaggerBinDirectory += "/";
348 348

  
tmp/org.txm.treetagger.rcp/src/org/txm/treetagger/rcp/preferences/TreeTaggerPreferencePage.java (revision 1065)
29 29

  
30 30
import org.eclipse.jface.preference.BooleanFieldEditor;
31 31
import org.eclipse.jface.preference.DirectoryFieldEditor;
32
import org.eclipse.jface.preference.StringFieldEditor;
32
import org.eclipse.jface.preference.FileFieldEditor;
33
import org.eclipse.swt.SWT;
34
import org.eclipse.swt.layout.GridData;
35
import org.eclipse.swt.layout.GridLayout;
36
import org.eclipse.swt.widgets.Group;
33 37
import org.eclipse.ui.IWorkbench;
34 38
import org.txm.rcp.preferences.RCPPreferencesPage;
35 39
import org.txm.rcp.preferences.TXMPreferenceStore;
......
44 48
 *
45 49
 */
46 50
public class TreeTaggerPreferencePage extends RCPPreferencesPage {
47

  
48 51
	
49 52
	@Override
50 53
	public void createFieldEditors() {
54
		
51 55
		this.addField(new DirectoryFieldEditor(TreeTaggerPreferences.INSTALL_PATH, TreeTaggerUIMessages.TreeTaggerPreferencePage_1, this.getFieldEditorParent()));
52 56
		this.addField(new DirectoryFieldEditor(TreeTaggerPreferences.MODELS_PATH, TreeTaggerUIMessages.TreeTaggerPreferencePage_2, this.getFieldEditorParent()));
53
		this.addField(new StringFieldEditor(TreeTaggerPreferences.OPTIONS, TreeTaggerUIMessages.TreeTaggerPreferencePage_3, this.getFieldEditorParent()));
57
		
58
		//this.addField(new StringFieldEditor(TreeTaggerPreferences.OPTIONS, TreeTaggerUIMessages.TreeTaggerPreferencePage_3, this.getFieldEditorParent()));
59
		Group runOptions = new Group(this.getFieldEditorParent(), SWT.BORDER);
60
		runOptions.setText("TreeTagger process run options");
61
		GridData gdata = new GridData(GridData.FILL, GridData.FILL, true, false, 3, 1);
62
		runOptions.setLayoutData(gdata);
63
		runOptions.setLayout(new GridLayout(3, false));
64
		
65
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.OPTIONS_UNKNOWN, "Print the token rather than <unknown> for unknown lemmas", runOptions));
66
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.OPTIONS_CAPHEURISTIC, "Look up unknown capitalized words in the list of lower-case words", runOptions));
67
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.OPTIONS_HYPHENHEURISTIC, "Turn on the heuristics fur guessing the parts of speech of unknown hyphenated words", runOptions));
68
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.OPTIONS_PROB, "Print tag probabilities", runOptions));
69
		this.addField(new FileFieldEditor(TreeTaggerPreferences.OPTIONS_LEX, "Read auxiliary lexicon entries from a file", runOptions));
70
		this.addField(new FileFieldEditor(TreeTaggerPreferences.OPTIONS_WC, "Read a word-class automaton from a file", runOptions));
71
		
72
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.OPTIONS_DEBUG, "Activate debug messages", runOptions));
73
		runOptions.setLayout(new GridLayout(3, false));
74
		
54 75
		this.addField(new BooleanFieldEditor(TreeTaggerPreferences.FIX_APOSTROPHES, TreeTaggerUIMessages.TreeTaggerPreferencePage_0, this.getFieldEditorParent()));
55 76
	}
56 77
	
57
	
58 78
	@Override
59 79
	public void init(IWorkbench workbench) {
60 80
		this.setPreferenceStore(new TXMPreferenceStore(TreeTaggerPreferences.getInstance().getPreferencesNodeQualifier()));

Also available in: Unified diff