mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-12-27 22:14:57 +03:00
consolidate: write key-value field to rule table
This commit is contained in:
parent
a6d172e0f1
commit
ab863d1f16
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user