@Test public void testTrainAndWriteModel() throws Exception{ File modelOutFile = new File(UNITTEST_MODEL); File effectiveModelFile = new File(UNITTEST_MODEL_GZ); if (effectiveModelFile.exists()) effectiveModelFile.delete(); JNETApplication.train(new File(UNITTEST_MODEL_DATA), modelOutFile, FEATURE_CONFIG_FILE_SNOWBALL_STEMMER, 2, false); assertTrue(effectiveModelFile.exists()); }
static void train(final File trainFile, final File outFile, final File featureConfigFile, final int number_iter, final boolean maxEnt) { final ArrayList<String> ppdSentences = Utils.readFile(trainFile); final ArrayList<Sentence> sentences = new ArrayList<Sentence>(); NETagger tagger; if (featureConfigFile != null) tagger = new NETagger(featureConfigFile); else tagger = new NETagger(); tagger.set_Number_Iterations(number_iter); tagger.set_Max_Ent(maxEnt); for (final String ppdSentence : ppdSentences) sentences.add(tagger.PPDtoUnits(ppdSentence)); tagger.train(sentences); tagger.writeModel(outFile.toString()); }
JNETApplication { static void train(final File trainFile, final File outFile, final File featureConfigFile, final int number_iter, final boolean maxEnt) { final ArrayList<String> ppdSentences = Utils.readFile(trainFile); final ArrayList<Sentence> sentences = new ArrayList<Sentence>(); NETagger tagger; if (featureConfigFile != null) tagger = new NETagger(featureConfigFile); else tagger = new NETagger(); tagger.set_Number_Iterations(number_iter); tagger.set_Max_Ent(maxEnt); for (final String ppdSentence : ppdSentences) sentences.add(tagger.PPDtoUnits(ppdSentence)); tagger.train(sentences); tagger.writeModel(outFile.toString()); } }
JNETApplication { static void train(final File trainFile, final File outFile, final File featureConfigFile, final int number_iter, final boolean maxEnt) { final ArrayList<String> ppdSentences = Utils.readFile(trainFile); final ArrayList<Sentence> sentences = new ArrayList<Sentence>(); NETagger tagger; if (featureConfigFile != null) tagger = new NETagger(featureConfigFile); else tagger = new NETagger(); tagger.set_Number_Iterations(number_iter); tagger.set_Max_Ent(maxEnt); for (final String ppdSentence : ppdSentences) sentences.add(tagger.PPDtoUnits(ppdSentence)); tagger.train(sentences); tagger.writeModel(outFile.toString()); }  }
JNETApplication { static void train(final File trainFile, final File outFile, final File featureConfigFile, final int number_iter, final boolean maxEnt) { final ArrayList<String> ppdSentences = Utils.readFile(trainFile); final ArrayList<Sentence> sentences = new ArrayList<Sentence>(); NETagger tagger; if (featureConfigFile != null) tagger = new NETagger(featureConfigFile); else tagger = new NETagger(); tagger.set_Number_Iterations(number_iter); tagger.set_Max_Ent(maxEnt); for (final String ppdSentence : ppdSentences) sentences.add(tagger.PPDtoUnits(ppdSentence)); tagger.train(sentences); tagger.writeModel(outFile.toString()); }  static void main(final String[] args); static void evalXVal(final List<String> ppdData,
			final File tagsFile, final int n, final File predictionOutFile,
			final File performanceOutFile, final File featureConfigFile,
			final int number_iter, final boolean maxEnt); static double getStandardDeviation(final double[] values,
			final double avg); static double getAverage(final double[] values); static void printFeatureConfig(final File modelFile); static void printOutputAlphabet(final File modelFile); }
JNETApplication { static void train(final File trainFile, final File outFile, final File featureConfigFile, final int number_iter, final boolean maxEnt) { final ArrayList<String> ppdSentences = Utils.readFile(trainFile); final ArrayList<Sentence> sentences = new ArrayList<Sentence>(); NETagger tagger; if (featureConfigFile != null) tagger = new NETagger(featureConfigFile); else tagger = new NETagger(); tagger.set_Number_Iterations(number_iter); tagger.set_Max_Ent(maxEnt); for (final String ppdSentence : ppdSentences) sentences.add(tagger.PPDtoUnits(ppdSentence)); tagger.train(sentences); tagger.writeModel(outFile.toString()); }  static void main(final String[] args); static void evalXVal(final List<String> ppdData,
			final File tagsFile, final int n, final File predictionOutFile,
			final File performanceOutFile, final File featureConfigFile,
			final int number_iter, final boolean maxEnt); static double getStandardDeviation(final double[] values,
			final double avg); static double getAverage(final double[] values); static void printFeatureConfig(final File modelFile); static void printOutputAlphabet(final File modelFile);  }