Revision 1137 tmp/org.txm.groovy.core/src/groovy/org/txm/scripts/importer/xtz/xtzLoader.groovy

xtzLoader.groovy (revision 1137)
41 41
String userDir = System.getProperty("user.home");
42 42

  
43 43
def MONITOR;
44
boolean debug = org.txm.utils.logger.Log.isPrintingErrors();
45
BaseParameters params;
46
try {params = paramsBinding;MONITOR=monitor} catch (Exception)
47
{	println "DEV MODE";//exception means we debug
48
	debug = true
49
	params = new BaseParameters(new File(userDir, "xml/srcmfmadridxmltxm/import.xml"))
50
	params.load()
51
	if (!org.txm.Toolbox.isInitialized()) {
44
Project project;
52 45

  
53
		TokenizerClasses.loadFromNode(params.getTokenizerElement(params.getCorpusElement()));
54
		Toolbox.setParam(Toolbox.INSTALL_DIR,new File("/usr/lib/TXM"));
55
		//Toolbox.setParam(Toolbox.INSTALL_DIR,new File("C:\\Program Files\\TXM"));//For Windows
56
		Toolbox.setParam(Toolbox.METADATA_ENCODING, "UTF-8");
57
		Toolbox.setParam(Toolbox.METADATA_COLSEPARATOR, ",");
58
		Toolbox.setParam(Toolbox.METADATA_TXTSEPARATOR, "\"");
59
		//Toolbox.setParam(Toolbox.TREETAGGER_MODELS_PATH,new File("C:\\Program Files\\treetagger\\models"));//for Windows
60
		Toolbox.setParam(Toolbox.USER_TXM_HOME, new File(System.getProperty("user.home"), "TXM"));
61
	}
62
}
46
try {project=projectBinding;MONITOR=monitor} catch (Exception)
47
{	}
48
if (project == null) { println "no project set. Aborting"; return; }
63 49

  
64
if (params == null) { println "no parameters. Aborting"; return; }
65

  
66
//params.getKeyValueParameters().put(ImportKeys.CLEAN, "false")
67
//params.getKeyValueParameters().put(ImportKeys.MULTITHREAD, "false")
68
//params.getKeyValueParameters().put(ImportKeys.DEBUG, "false")
69
//params.getKeyValueParameters().put(ImportKeys.UPDATECORPUS, "false")
70

  
71
XTZImport i = new XTZImport(params);
50
XTZImport i = new XTZImport(project);
72 51
/*
73 52
 * To customize the XTZ import, replace the importer, compiler, annotater or pager objects before calling process()
74 53
		i.importer = new XTZImporter(i)
......
77 56
		i.pager = new XTZPager(i)
78 57
 */
79 58
i.process();
80
readyToLoad = i.isSuccessful
59
readyToLoad = i.isSuccessful && project.save()

Also available in: Unified diff