consolidate: write key-value field to rule table

This commit is contained in:
Phil Williams 2013-09-20 09:42:13 +01:00
parent a6d172e0f1
commit ab863d1f16

View File

@ -313,33 +313,32 @@ void processFiles( char* fileNameDirect, char* fileNameIndirect, char* fileNameC
fileConsolidated << "||| " << countE << " " << countF << " " << countEF;
// count bin feature (as a sparse feature)
if (sparseCountBinFeatureFlag ||
directSparseScores.compare("") != 0 ||
indirectSparseScores.compare("") != 0) {
fileConsolidated << " |||";
if (directSparseScores.compare("") != 0)
fileConsolidated << " " << directSparseScores;
if (indirectSparseScores.compare("") != 0)
fileConsolidated << " " << indirectSparseScores;
if (sparseCountBinFeatureFlag) {
bool foundBin = false;
for(size_t i=0; i < countBin.size(); i++) {
if (!foundBin && countEF <= countBin[i]) {
fileConsolidated << " cb_";
if (i == 0 && countBin[i] > 1)
fileConsolidated << "1_";
else if (i > 0 && countBin[i-1]+1 < countBin[i])
fileConsolidated << (countBin[i-1]+1) << "_";
fileConsolidated << countBin[i] << " 1";
foundBin = true;
}
}
if (!foundBin) {
fileConsolidated << " cb_max 1";
fileConsolidated << " |||";
if (directSparseScores.compare("") != 0)
fileConsolidated << " " << directSparseScores;
if (indirectSparseScores.compare("") != 0)
fileConsolidated << " " << indirectSparseScores;
if (sparseCountBinFeatureFlag) {
bool foundBin = false;
for(size_t i=0; i < countBin.size(); i++) {
if (!foundBin && countEF <= countBin[i]) {
fileConsolidated << " cb_";
if (i == 0 && countBin[i] > 1)
fileConsolidated << "1_";
else if (i > 0 && countBin[i-1]+1 < countBin[i])
fileConsolidated << (countBin[i-1]+1) << "_";
fileConsolidated << countBin[i] << " 1";
foundBin = true;
}
}
if (!foundBin) {
fileConsolidated << " cb_max 1";
}
}
// arbitrary key-value pairs
fileConsolidated << " ||| " << itemDirect[5];
fileConsolidated << endl;
}
fileDirect.Close();