Revision 1065 tmp/org.txm.treetagger.core/src/org/txm/importer/xmltxm/Annotate.groovy

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;

Also available in: Unified diff