public void trainClassifier(File dir, String... args) throws Exception { String[] malletArgs = new String[args.length + 5]; System.arraycopy(args, 0, malletArgs, 0, args.length); malletArgs[malletArgs.length - 5] = "--train"; malletArgs[malletArgs.length - 4] = "true"; malletArgs[malletArgs.length - 3] = "--model-file"; malletArgs[malletArgs.length - 2] = new File(dir, MODEL_NAME).getPath(); malletArgs[malletArgs.length - 1] = getTrainingDataFile(dir).getPath(); String leaveMyLoggingAloneMallet = "java.util.logging.config.file"; String propValue = System.getProperty(leaveMyLoggingAloneMallet); System.setProperty(leaveMyLoggingAloneMallet, "anything-but-null"); try { SimpleTagger.main(malletArgs); } finally { System.getProperties().remove(leaveMyLoggingAloneMallet); if (propValue != null) { System.setProperty(leaveMyLoggingAloneMallet, propValue); } } }
crf = train(trainingData, testData, eval, ordersOption.value, defaultOption.value, forbiddenOption.value, allowedOption.value, test(new NoopTransducerTrainer(crf), eval, testData); for (int i = 0; i < testData.size(); i++) { Sequence input = (Sequence)testData.get(i).getData(); Sequence[] outputs = apply(crf, input, nBestOption.value); int k = outputs.length; boolean error = false;
crf = train(trainingData, testData, eval, ordersOption.value, defaultOption.value, forbiddenOption.value, allowedOption.value, test(new NoopTransducerTrainer(crf), eval, testData); for (int i = 0; i < testData.size(); i++) { Sequence input = (Sequence)testData.get(i).getData(); Sequence[] outputs = apply(crf, input, nBestOption.value); int k = outputs.length; boolean error = false;
crf = train(trainingData, testData, eval, ordersOption.value, defaultOption.value, forbiddenOption.value, allowedOption.value, test(new NoopTransducerTrainer(crf), eval, testData); for (int i = 0; i < testData.size(); i++) { Sequence input = (Sequence)testData.get(i).getData(); Sequence[] outputs = apply(crf, input, nBestOption.value); int k = outputs.length; boolean error = false;
public void trainClassifier(File dir, String... args) throws Exception { String[] malletArgs = new String[args.length + 5]; System.arraycopy(args, 0, malletArgs, 0, args.length); malletArgs[malletArgs.length - 5] = "--train"; malletArgs[malletArgs.length - 4] = "true"; malletArgs[malletArgs.length - 3] = "--model-file"; malletArgs[malletArgs.length - 2] = new File(dir, MODEL_NAME).getPath(); malletArgs[malletArgs.length - 1] = getTrainingDataFile(dir).getPath(); String leaveMyLoggingAloneMallet = "java.util.logging.config.file"; String propValue = System.getProperty(leaveMyLoggingAloneMallet); System.setProperty(leaveMyLoggingAloneMallet, "anything-but-null"); try { SimpleTagger.main(malletArgs); } finally { System.getProperties().remove(leaveMyLoggingAloneMallet); if (propValue != null) { System.setProperty(leaveMyLoggingAloneMallet, propValue); } } }