Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBarry Haddow <barry.haddow@gmail.com>2011-10-12 20:14:23 +0400
committerBarry Haddow <barry.haddow@gmail.com>2011-10-12 20:14:23 +0400
commitc83166087e4d7093c7be605f30f92e183d0845eb (patch)
tree22f927112078fc818a1d9f66a230d716e962506d /moses-chart-cmd
parentff15f28d9cda0c4c413fa6862f81eadbfe1ae900 (diff)
parent210f87bebddc2ca3a4cae66f365cd78126a3dff0 (diff)
Merge branch 'master' into miramerge
Conflicts: moses/src/LanguageModel.cpp moses/src/TargetPhrase.h moses/src/TrellisPath.h moses/src/Util.h scripts/training/train-model.perl
Diffstat (limited to 'moses-chart-cmd')
-rw-r--r--moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj10
-rw-r--r--moses-chart-cmd/src/IOWrapper.cpp18
-rw-r--r--moses-chart-cmd/src/Main.cpp22
3 files changed, 20 insertions, 30 deletions
diff --git a/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj b/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj
index 51136e248..dd1774647 100644
--- a/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj
+++ b/moses-chart-cmd/moses-chart-cmd.xcodeproj/project.pbxproj
@@ -302,7 +302,10 @@
_LARGE_FILES,
"_FILE_OFFSET_BITS=64",
);
- HEADER_SEARCH_PATHS = ../moses/src;
+ HEADER_SEARCH_PATHS = (
+ ../moses/src,
+ ../kenlm,
+ );
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
../irstlm/lib,
@@ -335,7 +338,10 @@
_LARGE_FILES,
"_FILE_OFFSET_BITS=64",
);
- HEADER_SEARCH_PATHS = ../moses/src;
+ HEADER_SEARCH_PATHS = (
+ ../moses/src,
+ ../kenlm,
+ );
INSTALL_PATH = /usr/local/bin;
LIBRARY_SEARCH_PATHS = (
../irstlm/lib,
diff --git a/moses-chart-cmd/src/IOWrapper.cpp b/moses-chart-cmd/src/IOWrapper.cpp
index ba6ce4f59..8999b106d 100644
--- a/moses-chart-cmd/src/IOWrapper.cpp
+++ b/moses-chart-cmd/src/IOWrapper.cpp
@@ -270,8 +270,7 @@ void IOWrapper::OutputBestHypo(const ChartHypothesis *hypo, long translationId,
VERBOSE(3,"0" << std::endl);
if (StaticData::Instance().GetOutputHypoScore()) {
- out << hypo->GetTotalScore() << " "
- << ChartHypothesis::GetHypoCount() << " ";
+ out << hypo->GetTotalScore() << " ";
}
if (!m_surpressSingleBestOutput) {
@@ -318,8 +317,7 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
// The output from -output-hypo-score is always written to std::cout.
if (StaticData::Instance().GetOutputHypoScore()) {
if (bestHypo != NULL) {
- out << bestHypo->GetTotalScore() << " "
- << ChartHypothesis::GetHypoCount() << " ";
+ out << bestHypo->GetTotalScore() << " ";
} else {
out << "0 ";
}
@@ -344,7 +342,7 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
// print the surface factor of the translation
out << translationId << " ||| ";
OutputSurface(out, outputPhrase, m_outputFactorOrder, false);
- out << " ||| ";
+ out << " |||";
// print the scores in a hardwired order
// before each model type, the corresponding command-line-like name must be emitted
@@ -354,10 +352,10 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
const LMList& lml = system->GetLanguageModels();
if (lml.size() > 0) {
if (labeledOutput)
- out << "lm: ";
+ out << "lm:";
LMList::const_iterator lmi = lml.begin();
for (; lmi != lml.end(); ++lmi) {
- out << path.GetScoreBreakdown().GetScoreForProducer(*lmi) << " ";
+ out << " " << path.GetScoreBreakdown().GetScoreForProducer(*lmi);
}
}
@@ -386,8 +384,8 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
// word penalty
if (labeledOutput)
- out << " w: ";
- out << path.GetScoreBreakdown().GetScoreForProducer(system->GetWordPenaltyProducer()) << " ";
+ out << " w:";
+ out << " " << path.GetScoreBreakdown().GetScoreForProducer(system->GetWordPenaltyProducer());
// generation
const vector<GenerationDictionary*>& gds = system->GetGenerationDictionaries();
@@ -411,7 +409,7 @@ void IOWrapper::OutputNBestList(const ChartTrellisPathList &nBestList, const Cha
// total
- out << "||| " << path.GetTotalScore();
+ out << " |||" << path.GetTotalScore();
/*
if (includeAlignment) {
diff --git a/moses-chart-cmd/src/Main.cpp b/moses-chart-cmd/src/Main.cpp
index 87174b438..b10cea070 100644
--- a/moses-chart-cmd/src/Main.cpp
+++ b/moses-chart-cmd/src/Main.cpp
@@ -221,24 +221,6 @@ int main(int argc, char* argv[])
return EXIT_FAILURE;
}
- // create threadpool, if necessary
- int threadcount = (parameter.GetParam("threads").size() > 0) ?
- Scan<size_t>(parameter.GetParam("threads")[0]) : 1;
-
-#ifdef WITH_THREADS
- if (threadcount < 1) {
- cerr << "Error: Need to specify a positive number of threads" << endl;
- exit(1);
- }
- ThreadPool pool(threadcount);
-#else
- if (threadcount > 1) {
- cerr << "Error: Thread count of " << threadcount
- << " but moses not built with thread support" << endl;
- exit(1);
- }
-#endif
-
const StaticData &staticData = StaticData::Instance();
if (!StaticData::LoadDataStatic(&parameter))
return EXIT_FAILURE;
@@ -264,6 +246,10 @@ int main(int argc, char* argv[])
if (ioWrapper == NULL)
return EXIT_FAILURE;
+#ifdef WITH_THREADS
+ ThreadPool pool(staticData.ThreadCount());
+#endif
+
// read each sentence & decode
InputType *source=0;
while(ReadInput(*ioWrapper,staticData.GetInputType(),source)) {