InstanceListCreator { public static void main(String[] args) throws IOException { String inputDataFileName = args[0]; String outputDataFileName = args[1]; InstanceListCreator instanceListCreator = new InstanceListCreator(); InstanceList instanceList = instanceListCreator.createInstanceList(new File(inputDataFileName)); instanceList.save(new File(outputDataFileName)); }  static void main(String[] args); InstanceList createInstanceList(File dataFile);  }
@Test public void testMain() throws IOException { InstanceListCreator instanceListCreator = new InstanceListCreator(); InstanceList instanceList = instanceListCreator.createInstanceList(new File( "src/test/resources/data/mallet/instance-list-creator.txt")); assertEquals(100, instanceList.size()); Alphabet dataAlphabet = instanceList.getDataAlphabet(); int index = dataAlphabet.lookupIndex("SpannedText_In", false); assertNotSame(-1, index); Instance instance = instanceList.get(0); assertEquals("IN", instance.getTarget().toString()); assertTrue(instance.getData() instanceof FeatureVector); assertEquals(1.0, ((FeatureVector) instance.getData()).value("SpannedText_In"), 0.001); assertEquals(2.0, ((FeatureVector) instance.getData()).value("LowerCase_SpannedText_in"), 0.001); assertEquals( 0.12345, ((FeatureVector) instance.getData()).value("CapitalType_SpannedText_INITIAL_UPPERCASE"), 0.001); assertEquals( 10000.0, ((FeatureVector) instance.getData()).value("NGram_Left_0_2_2_SpannedText_In"), 0.001); assertEquals( 12345.6789, ((FeatureVector) instance.getData()).value("NGram_Right_0_2_2_SpannedText_In"), 0.001); assertEquals(1.0, ((FeatureVector) instance.getData()).value("TypePath_Stem_in"), 0.001); instance = instanceList.get(1); assertEquals("DT", instance.getTarget().toString()); assertEquals(1.0, ((FeatureVector) instance.getData()).value("SpannedText_an"), 0.001); instance = instanceList.get(98); assertEquals("NN", instance.getTarget().toString()); assertEquals(32.0, ((FeatureVector) instance.getData()).value("SpannedText_growth"), 0.001); assertEquals( 33.0, ((FeatureVector) instance.getData()).value("LowerCase_SpannedText_growth"), 0.001); instance = instanceList.get(99); assertEquals("IN", instance.getTarget().toString()); assertEquals(42.0, ((FeatureVector) instance.getData()).value("SpannedText_for"), 0.001); assertEquals( 43.0, ((FeatureVector) instance.getData()).value("LowerCase_SpannedText_for"), 0.001); Alphabet targetAlphabet = instanceList.getTargetAlphabet(); index = targetAlphabet.lookupIndex("IN", false); assertNotSame(-1, index); index = targetAlphabet.lookupIndex("spaghetti", false); assertEquals(-1, index); }