diff options
author | Colin Cherry <colin.a.cherry@gmail.com> | 2012-06-15 01:08:16 +0400 |
---|---|---|
committer | Colin Cherry <colin.a.cherry@gmail.com> | 2012-06-15 01:08:16 +0400 |
commit | 07a5c67ebce0649cbfa2149b25a2d3042c612654 (patch) | |
tree | 28208a3b9902f037992f3df759d88ca972d72908 /misc | |
parent | 5932800489f47eca66fa50a1f43d6f2e42c19d67 (diff) | |
parent | a8a5f896dbdfffddf0468ba7a28a06b29dbba3a7 (diff) |
Merge branch 'master' into miramerge
Conflicts:
Jamroot
misc/queryPhraseTable.cpp
scripts/training/train-model.perl
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); |