FeatureUtils { public static FeatureVector[] readFeatureVectors(String targetFeaturesData) throws IOException { BufferedReader br = new BufferedReader(new StringReader(targetFeaturesData)); FeatureDefinition def = new FeatureDefinition(br, false); String line; while ((line = br.readLine()) != null) { if (line.trim().equals("")) break; } List<FeatureVector> fvs = new ArrayList<FeatureVector>(); while ((line = br.readLine()) != null) { if (line.trim().equals("")) break; FeatureVector fv = def.toFeatureVector(0, line); fvs.add(fv); } return (FeatureVector[]) fvs.toArray(new FeatureVector[fvs.size()]); }  static FeatureDefinition readFeatureDefinition(String targetFeaturesData); static FeatureDefinition readFeatureDefinition(InputStream featureStream); static FeatureVector[] readFeatureVectors(String targetFeaturesData);  }
@Test public void testReadFeatureVectors() throws IOException { FeatureDefinition def = FeatureUtils.readFeatureDefinition(targetfeatures); FeatureVector[] featureVectors = FeatureUtils.readFeatureVectors(targetfeatures); assertNotNull(featureVectors); assertEquals(9, featureVectors.length); assertEquals("h", def.getFeatureValueAsString("phone", featureVectors[0])); }