private void processLine(SparseTextFileLine line) {
sb.setLength(0);
if (dumpAsSparse) {
sb.append("{");
for (int i = 0; i < line.numPairs; i++) {
FeatureValuePair pair = line.pairs[i];
if (sb.length() > 1) {
sb.append(",");
}
sb.append((pair.featureIndex - 1) + " " + pair.featureValue);
}
sb.append(", " + targetColIdx + " " + line.target);
sb.append("}\n");
} else {
int prevFeatureIdx = 0;
for (int i = 0; i < line.numPairs; i++) {
FeatureValuePair pair = line.pairs[i];
while (pair.featureIndex > prevFeatureIdx + 1) {
if (sb.length() > 0) {
sb.append(",");
}
sb.append("0");