diff --git a/contrib/other-builds/OnDiskPt/OnDiskPt.project b/contrib/other-builds/OnDiskPt/OnDiskPt.project index 06f80d233..3a89ec832 100644 --- a/contrib/other-builds/OnDiskPt/OnDiskPt.project +++ b/contrib/other-builds/OnDiskPt/OnDiskPt.project @@ -1,5 +1,22 @@ + + + + + + + + @@ -27,6 +44,8 @@ + + @@ -40,9 +59,9 @@ - - - + + + @@ -72,7 +91,7 @@ - + @@ -110,7 +129,7 @@ - + @@ -118,6 +137,4 @@ - - diff --git a/contrib/other-builds/extract-mixed-syntax/extract-mixed-syntax.project b/contrib/other-builds/extract-mixed-syntax/extract-mixed-syntax.project index 83c652f8c..87d76689a 100644 --- a/contrib/other-builds/extract-mixed-syntax/extract-mixed-syntax.project +++ b/contrib/other-builds/extract-mixed-syntax/extract-mixed-syntax.project @@ -1,5 +1,22 @@ + + + + + + + + @@ -43,6 +60,10 @@ + + + + @@ -56,13 +77,14 @@ - - - + + + - - + + + @@ -94,7 +116,7 @@ - + @@ -133,7 +155,7 @@ - + @@ -141,8 +163,4 @@ - - - - diff --git a/contrib/other-builds/extract/extract.project b/contrib/other-builds/extract/extract.project index ac74607f2..d86e89035 100644 --- a/contrib/other-builds/extract/extract.project +++ b/contrib/other-builds/extract/extract.project @@ -1,5 +1,22 @@ + + + + + + + + @@ -13,6 +30,8 @@ + + @@ -26,11 +45,11 @@ - - + + - + @@ -60,7 +79,7 @@ - + @@ -99,7 +118,7 @@ - + @@ -107,6 +126,4 @@ - - diff --git a/contrib/other-builds/lm/lm.project b/contrib/other-builds/lm/lm.project index a184fe3d1..c30ebe533 100644 --- a/contrib/other-builds/lm/lm.project +++ b/contrib/other-builds/lm/lm.project @@ -1,5 +1,22 @@ + + + + + + + + @@ -27,6 +44,8 @@ + + @@ -40,9 +59,9 @@ - - - + + + @@ -72,7 +91,7 @@ - + @@ -110,7 +129,7 @@ - + @@ -118,6 +137,4 @@ - - diff --git a/contrib/other-builds/moses-cmd/moses-cmd.project b/contrib/other-builds/moses-cmd/moses-cmd.project index 44a0d621f..5303ba7c7 100644 --- a/contrib/other-builds/moses-cmd/moses-cmd.project +++ b/contrib/other-builds/moses-cmd/moses-cmd.project @@ -26,6 +26,13 @@ + + + + + + + @@ -39,20 +46,20 @@ - - - + + + - - - - - - + + + + + + @@ -143,11 +150,4 @@ - - - - - - - diff --git a/contrib/other-builds/pruneGeneration/pruneGeneration.project b/contrib/other-builds/pruneGeneration/pruneGeneration.project index 7060d55ea..39109197a 100644 --- a/contrib/other-builds/pruneGeneration/pruneGeneration.project +++ b/contrib/other-builds/pruneGeneration/pruneGeneration.project @@ -2,6 +2,10 @@ + + + + @@ -15,6 +19,7 @@ + @@ -90,8 +95,4 @@ - - - - diff --git a/contrib/other-builds/score/score.project b/contrib/other-builds/score/score.project index c88df0e78..08e0b9414 100644 --- a/contrib/other-builds/score/score.project +++ b/contrib/other-builds/score/score.project @@ -19,6 +19,10 @@ + + + + @@ -32,17 +36,17 @@ - - - + + + - - - - - - + + + + + + @@ -86,7 +90,7 @@ - + @@ -125,7 +129,7 @@ - + @@ -133,8 +137,4 @@ - - - - diff --git a/contrib/other-builds/search/search.project b/contrib/other-builds/search/search.project index d96252a89..8be29fd1d 100644 --- a/contrib/other-builds/search/search.project +++ b/contrib/other-builds/search/search.project @@ -10,6 +10,8 @@ + + @@ -23,9 +25,9 @@ - - - + + + @@ -55,7 +57,7 @@ - + @@ -93,7 +95,7 @@ - + @@ -101,6 +103,4 @@ - - diff --git a/contrib/other-builds/util/util.project b/contrib/other-builds/util/util.project index 1006ddb52..4bb27306e 100644 --- a/contrib/other-builds/util/util.project +++ b/contrib/other-builds/util/util.project @@ -62,6 +62,8 @@ + + @@ -75,8 +77,8 @@ - - + + @@ -105,7 +107,7 @@ - + @@ -143,7 +145,7 @@ - + @@ -151,6 +153,4 @@ - - diff --git a/misc/pruneGeneration.cpp b/misc/pruneGeneration.cpp index 8207e287f..98b21530c 100644 --- a/misc/pruneGeneration.cpp +++ b/misc/pruneGeneration.cpp @@ -1,10 +1,10 @@ #include #include -#include #include #include #include #include "pruneGeneration.h" +#include "moses/InputFileStream.h" using namespace std; @@ -13,16 +13,23 @@ int main(int argc, char **argv) cerr << "Starting" << endl; int limit = atoi(argv[1]); + Process(limit, cin, cout); + + cerr << "Finished" << endl; +} + +void Process(int limit, istream &inStrme, ostream &outStrme) +{ vector records; string prevInWord; string line; - while (getline(cin, line)) { + while (getline(inStrme, line)) { vector toks; Tokenize(toks, line); assert(toks.size() == 4); if (prevInWord != toks[0]) { - Output(limit, records); + Output(outStrme, records, limit); records.clear(); } @@ -34,13 +41,12 @@ int main(int argc, char **argv) } // last - Output(limit, records); + Output(outStrme, records, limit); records.clear(); - cerr << "Finished" << endl; } -void Output(int limit, vector &records) +void Output(ostream &outStrme, vector &records, int limit) { std::sort(records.rbegin(), records.rend()); diff --git a/misc/pruneGeneration.h b/misc/pruneGeneration.h index dae5958f8..b22d09869 100644 --- a/misc/pruneGeneration.h +++ b/misc/pruneGeneration.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include class Rec { @@ -20,7 +21,8 @@ public: //////////////////////////////////////////////////////////// -void Output(int limit, std::vector &records); +void Process(int limit, std::istream &inStrme, std::ostream &outStrme); +void Output(std::ostream &outStrme, std::vector &records, int limit); //////////////////////////////////////////////////////////// inline void Tokenize(std::vector &output