int _tmain(int argc, _TCHAR* argv[]) { //int i; //printf("argc: %d\n", argc); //for(i = 0; i < argc; i++) // printf("arg %d: %S\n", i, argv[i]); if(argc != 4) usage(); printf("reading %S to buffer...", argv[1]); deffile = loadFileToBuf(argv[1], &deflen); if((deffile != NULL)&&(deflen != 0)) { printf("read 0x%x bytes OK\n", deflen); printf("reading %S to buffer...", argv[2]); listfile = loadFileToBuf(argv[2], &listlen); if((listfile != NULL)&&(listlen != 0)) { printf("read 0x%x bytes OK\n", listlen); processFiles(argv[3]); } } if(deffile) free(deffile); if(listfile) free(listfile); printf("\n\n"); return 0; }
int main(int argc, char* argv[]) { if (argc == 1) { processFiles(""); } else if (argc == 2) { processFiles(argv[1]); } else { printf("Usage: LGEOTables [LGEO Path]\n"); return 1; } return 0; }
void processHist(std::vector<std::string> event_timing_vec, int max_size) { std::cerr << event_timing_vec.size() << std::endl; //If all the vectors are full (6 entries) if(event_timing_vec.size()==max_size) { for(int i=0;i<max_size;i++) { std::cerr << event_timing_vec[i] << std::endl; processFiles(event_timing_vec[i]); } } };
int main(int argc, char* argv[]) { std::cerr << "Consolidate v2.0 written by Philipp Koehn" << std::endl << "consolidating direct and indirect rule tables" << std::endl; if (argc < 4) { std::cerr << "syntax: consolidate phrase-table.direct phrase-table.indirect phrase-table.consolidated [--Hierarchical] [--OnlyDirect] [--PhraseCount] [--GoodTuring counts-of-counts-file] [--KneserNey counts-of-counts-file] [--LowCountFeature] [--SourceLabels source-labels-file] [--PartsOfSpeech parts-of-speech-file] [--MinScore id:threshold[,id:threshold]*]" << std::endl; exit(1); } const std::string fileNameDirect = argv[1]; const std::string fileNameIndirect = argv[2]; const std::string fileNameConsolidated = argv[3]; std::string fileNameCountOfCounts; std::string fileNameSourceLabelSet; std::string fileNamePartsOfSpeechVocabulary; for(int i=4; i<argc; i++) { if (strcmp(argv[i],"--Hierarchical") == 0) { hierarchicalFlag = true; std::cerr << "processing hierarchical rules" << std::endl; } else if (strcmp(argv[i],"--OnlyDirect") == 0) { onlyDirectFlag = true; std::cerr << "only including direct translation scores p(e|f)" << std::endl; } else if (strcmp(argv[i],"--PhraseCount") == 0) { phraseCountFlag = true; std::cerr << "including the phrase count feature" << std::endl; } else if (strcmp(argv[i],"--GoodTuring") == 0) { goodTuringFlag = true; UTIL_THROW_IF2(i+1==argc, "specify count of count files for Good Turing discounting!"); fileNameCountOfCounts = argv[++i]; std::cerr << "adjusting phrase translation probabilities with Good Turing discounting" << std::endl; } else if (strcmp(argv[i],"--KneserNey") == 0) { kneserNeyFlag = true; UTIL_THROW_IF2(i+1==argc, "specify count of count files for Kneser Ney discounting!"); fileNameCountOfCounts = argv[++i]; std::cerr << "adjusting phrase translation probabilities with Kneser Ney discounting" << std::endl; } else if (strcmp(argv[i],"--LowCountFeature") == 0) { lowCountFlag = true; std::cerr << "including the low count feature" << std::endl; } else if (strcmp(argv[i],"--CountBinFeature") == 0 || strcmp(argv[i],"--SparseCountBinFeature") == 0) { if (strcmp(argv[i],"--SparseCountBinFeature") == 0) sparseCountBinFeatureFlag = true; std::cerr << "include "<< (sparseCountBinFeatureFlag ? "sparse " : "") << "count bin feature:"; int prev = 0; while(i+1<argc && argv[i+1][0]>='0' && argv[i+1][0]<='9') { int binCount = Moses::Scan<int>(argv[++i]); countBin.push_back( binCount ); if (prev+1 == binCount) { std::cerr << " " << binCount; } else { std::cerr << " " << (prev+1) << "-" << binCount; } prev = binCount; } std::cerr << " " << (prev+1) << "+" << std::endl; } else if (strcmp(argv[i],"--LogProb") == 0) { logProbFlag = true; std::cerr << "using log-probabilities" << std::endl; } else if (strcmp(argv[i],"--Counts") == 0) { countsProperty = true; std::cerr << "output counts as a property" << std::endl;; } else if (strcmp(argv[i],"--SourceLabels") == 0) { sourceLabelsFlag = true; UTIL_THROW_IF2(i+1==argc, "specify source label set file!"); fileNameSourceLabelSet = argv[++i]; std::cerr << "processing source labels property" << std::endl; } else if (strcmp(argv[i],"--PartsOfSpeech") == 0) { partsOfSpeechFlag = true; UTIL_THROW_IF2(i+1==argc, "specify parts-of-speech file!"); fileNamePartsOfSpeechVocabulary = argv[++i]; std::cerr << "processing parts-of-speech property" << std::endl; } else if (strcmp(argv[i],"--MinScore") == 0) { std::string setting = argv[++i]; bool done = false; while (!done) { std::string single_setting; size_t pos; if ((pos = setting.find(",")) != std::string::npos) { single_setting = setting.substr(0, pos); setting.erase(0, pos + 1); } else { single_setting = setting; done = true; } pos = single_setting.find(":"); UTIL_THROW_IF2(pos == std::string::npos, "faulty MinScore setting '" << single_setting << "' in '" << argv[i] << "'"); unsigned int field = Moses::Scan<unsigned int>( single_setting.substr(0,pos) ); float threshold = Moses::Scan<float>( single_setting.substr(pos+1) ); if (field == 0) { minScore0 = threshold; std::cerr << "setting minScore0 to " << threshold << std::endl; } else if (field == 2) { minScore2 = threshold; std::cerr << "setting minScore2 to " << threshold << std::endl; } else { UTIL_THROW2("MinScore currently only supported for indirect (0) and direct (2) phrase translation probabilities"); } } } else { UTIL_THROW2("unknown option " << argv[i]); } } processFiles( fileNameDirect, fileNameIndirect, fileNameConsolidated, fileNameCountOfCounts, fileNameSourceLabelSet, fileNamePartsOfSpeechVocabulary ); }