public static ACRFEvaluator createEvaluator (String spec) throws EvalError { if (spec.indexOf ('(') >= 0) { // assume it's Java code, and don't screw with it. return (ACRFEvaluator) interpreter.eval (spec); } else { LinkedList toks = new LinkedList (Arrays.asList (spec.split ("\\s+"))); return createEvaluator (toks); } }
public static void main (String[] args) throws IOException, EvalError doProcessOptions (GenericAcrfTui.class, args); Timing timing = new Timing (); testing.addThruPipe (testSource); ACRF.Template[] tmpls = parseModelFile (modelFile.value); ACRFEvaluator eval = createEvaluator (evalOption.value); Inferencer inf = createInferencer (inferencerOption.value); Inferencer maxInf = createInferencer (maxInferencerOption.value); acrf.setViterbiInferencer (maxInf); ACRFTrainer trainer = createTrainer(); System.err.println ("ACRF Trainer = "+trainer); trainer.train (acrf, training, null, testing, eval, 9999);
GenericAcrfTui.main(grmmArgs); Files.move(new File("acrf.ser.gz"), outputFile.getAbsoluteFile());
public static void main (String[] args) throws IOException, EvalError doProcessOptions (GenericAcrfTui.class, args); Timing timing = new Timing (); testing.addThruPipe (testSource); ACRF.Template[] tmpls = parseModelFile (modelFile.value); ACRFEvaluator eval = createEvaluator (evalOption.value); Inferencer inf = createInferencer (inferencerOption.value); Inferencer maxInf = createInferencer (maxInferencerOption.value); acrf.setViterbiInferencer (maxInf); ACRFTrainer trainer = createTrainer(); System.err.println ("ACRF Trainer = "+trainer); trainer.train (acrf, training, null, testing, eval, 9999);
GenericAcrfTui.main(grmmArgs); Files.move(new File("acrf.ser.gz"), outputFile.getAbsoluteFile());
public static void main (String[] args) throws IOException, EvalError doProcessOptions (GenericAcrfTui.class, args); Timing timing = new Timing (); testing.addThruPipe (testSource); ACRF.Template[] tmpls = parseModelFile (modelFile.value); ACRFEvaluator eval = createEvaluator (evalOption.value); Inferencer inf = createInferencer (inferencerOption.value); Inferencer maxInf = createInferencer (maxInferencerOption.value); acrf.setViterbiInferencer (maxInf); ACRFTrainer trainer = createTrainer(); System.err.println ("ACRF Trainer = "+trainer); trainer.train (acrf, training, null, testing, eval, 9999);
public static ACRFEvaluator createEvaluator (String spec) throws EvalError { if (spec.indexOf ('(') >= 0) { // assume it's Java code, and don't screw with it. return (ACRFEvaluator) interpreter.eval (spec); } else { LinkedList toks = new LinkedList (Arrays.asList (spec.split ("\\s+"))); return createEvaluator (toks); } }
public static ACRFEvaluator createEvaluator (String spec) throws EvalError { if (spec.indexOf ('(') >= 0) { // assume it's Java code, and don't screw with it. return (ACRFEvaluator) interpreter.eval (spec); } else { LinkedList toks = new LinkedList (Arrays.asList (spec.split ("\\s+"))); return createEvaluator (toks); } }
private static ACRFEvaluator createEvaluator (LinkedList toks) { String type = (String) toks.removeFirst (); if (type.equalsIgnoreCase ("SEGMENT")) { int slice = Integer.parseInt ((String) toks.removeFirst ()); if (toks.size() % 2 != 0) throw new RuntimeException ("Error in --eval "+evalOption.value+": Every start tag must have a continue."); int numTags = toks.size () / 2; String[] startTags = new String [numTags]; String[] continueTags = new String [numTags]; for (int i = 0; i < numTags; i++) { startTags[i] = (String) toks.removeFirst (); continueTags[i] = (String) toks.removeFirst (); } return new MultiSegmentationEvaluatorACRF (startTags, continueTags, slice); } else if (type.equalsIgnoreCase ("LOG")) { return new DefaultAcrfTrainer.LogEvaluator (); } else if (type.equalsIgnoreCase ("SERIAL")) { List evals = new ArrayList (); while (!toks.isEmpty ()) { evals.add (createEvaluator (toks)); } return new AcrfSerialEvaluator (evals); } else { throw new RuntimeException ("Error in --eval "+evalOption.value+": illegal evaluator "+type); } }
private static ACRFEvaluator createEvaluator (LinkedList toks) { String type = (String) toks.removeFirst (); if (type.equalsIgnoreCase ("SEGMENT")) { int slice = Integer.parseInt ((String) toks.removeFirst ()); if (toks.size() % 2 != 0) throw new RuntimeException ("Error in --eval "+evalOption.value+": Every start tag must have a continue."); int numTags = toks.size () / 2; String[] startTags = new String [numTags]; String[] continueTags = new String [numTags]; for (int i = 0; i < numTags; i++) { startTags[i] = (String) toks.removeFirst (); continueTags[i] = (String) toks.removeFirst (); } return new MultiSegmentationEvaluatorACRF (startTags, continueTags, slice); } else if (type.equalsIgnoreCase ("LOG")) { return new DefaultAcrfTrainer.LogEvaluator (); } else if (type.equalsIgnoreCase ("SERIAL")) { List evals = new ArrayList (); while (!toks.isEmpty ()) { evals.add (createEvaluator (toks)); } return new AcrfSerialEvaluator (evals); } else { throw new RuntimeException ("Error in --eval "+evalOption.value+": illegal evaluator "+type); } }
private static ACRFEvaluator createEvaluator (LinkedList toks) { String type = (String) toks.removeFirst (); if (type.equalsIgnoreCase ("SEGMENT")) { int slice = Integer.parseInt ((String) toks.removeFirst ()); if (toks.size() % 2 != 0) throw new RuntimeException ("Error in --eval "+evalOption.value+": Every start tag must have a continue."); int numTags = toks.size () / 2; String[] startTags = new String [numTags]; String[] continueTags = new String [numTags]; for (int i = 0; i < numTags; i++) { startTags[i] = (String) toks.removeFirst (); continueTags[i] = (String) toks.removeFirst (); } return new MultiSegmentationEvaluatorACRF (startTags, continueTags, slice); } else if (type.equalsIgnoreCase ("LOG")) { return new DefaultAcrfTrainer.LogEvaluator (); } else if (type.equalsIgnoreCase ("SERIAL")) { List evals = new ArrayList (); while (!toks.isEmpty ()) { evals.add (createEvaluator (toks)); } return new AcrfSerialEvaluator (evals); } else { throw new RuntimeException ("Error in --eval "+evalOption.value+": illegal evaluator "+type); } }