diff options
author | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-07-04 14:49:07 +0400 |
---|---|---|
committer | Eva Hasler <ehasler@saxnot.inf.ed.ac.uk> | 2012-07-04 14:49:07 +0400 |
commit | 027a20730e1c0a8c6130a73601d96933006a7cd3 (patch) | |
tree | b5922eb731eed24c62616aabaf1237989c7f096b /misc | |
parent | fd19d33aec73be30142390e617bdd8a1ad0018e3 (diff) | |
parent | 07a5c67ebce0649cbfa2149b25a2d3042c612654 (diff) |
merge Jamfiles
Diffstat (limited to 'misc')
-rw-r--r-- | misc/queryPhraseTable.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/misc/queryPhraseTable.cpp b/misc/queryPhraseTable.cpp index 109c7e69e..02e1c29a1 100644 --- a/misc/queryPhraseTable.cpp +++ b/misc/queryPhraseTable.cpp @@ -18,6 +18,7 @@ int main(int argc, char **argv) int nscores = 5; std::string ttable = ""; bool useAlignments = false; + bool reportCounts = false; for(int i = 1; i < argc; i++) { if(!strcmp(argv[i], "-n")) { @@ -28,8 +29,11 @@ int main(int argc, char **argv) if(i + 1 == argc) usage(); ttable = argv[++i]; - } else if(!strcmp(argv[i], "-a")) + } else if(!strcmp(argv[i], "-a")) { useAlignments = true; + } else if (!strcmp(argv[i], "-c")) { + reportCounts = true; + } else usage(); } @@ -54,22 +58,26 @@ int main(int argc, char **argv) else ptree.GetTargetCandidates(srcphrase, tgtcands); - for(uint i = 0; i < tgtcands.size(); i++) { - std::cout << line << " |||"; - for(uint j = 0; j < tgtcands[i].tokens.size(); j++) - std::cout << ' ' << *tgtcands[i].tokens[j]; - std::cout << " |||"; - - if(useAlignments) { - std::cout << " " << wordAlignment[i] << " |||"; + if (reportCounts) { + std::cout << line << " " << tgtcands.size() << "\n"; + } else { + for(uint i = 0; i < tgtcands.size(); i++) { + std::cout << line << " |||"; + for(uint j = 0; j < tgtcands[i].tokens.size(); j++) + std::cout << ' ' << *tgtcands[i].tokens[j]; + std::cout << " |||"; + + if(useAlignments) { + std::cout << " " << wordAlignment[i] << " |||"; + } + + for(uint j = 0; j < tgtcands[i].scores.size(); j++) + std::cout << ' ' << tgtcands[i].scores[j]; + std::cout << '\n'; } - - for(uint j = 0; j < tgtcands[i].scores.size(); j++) - std::cout << ' ' << tgtcands[i].scores[j]; std::cout << '\n'; } - std::cout << '\n'; std::cout.flush(); } } @@ -78,6 +86,7 @@ void usage() { std::cerr << "Usage: queryPhraseTable [-n <nscores>] [-a] -t <ttable>\n" "-n <nscores> number of scores in phrase table (default: 5)\n" + "-c only report counts of entries\n" "-a binary phrase table contains alignments\n" "-t <ttable> phrase table\n"; exit(1); |