*/
private InstanceSet readInstanceSet(String pos) throws IOException {
InstanceSet instset = new InstanceSet();
LabelAlphabet labelAlphabet = factory.buildLabelAlphabet(pos);
BufferedReader in = new BufferedReader(new InputStreamReader(
new FileInputStream(fp), charset));
String line = null;
while ((line = in.readLine()) != null) {
line = line.trim();
if (line.matches("^$"))
continue;
if (line.startsWith(pos + " ")) {
List<String> tokens = Arrays.asList(line.split("\\s+"));
int[] data = new int[tokens.size() - 2];
for (int i = 0; i < data.length; i++) {
data[i] = Integer.parseInt(tokens.get(i + 2));
}
Instance inst = new Instance(data);
inst.setTarget(labelAlphabet.lookupIndex(tokens.get(1)));
instset.add(inst);
}
}
in.close();
labelAlphabet.setStopIncrement(true);
instset.setAlphabetFactory(factory);
return instset;
}