diff options
author | Phil Williams <philip.williams@mac.com> | 2015-02-12 16:03:26 +0300 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2015-02-12 16:03:26 +0300 |
commit | 33df7fd2b4d41f7c80164c91d768a88dbc040cc3 (patch) | |
tree | 5d5e9e9ceaf2f983a14ba536b6abeec587897948 /moses | |
parent | e1d60211a4b14a3f7eb090aaa70e0293ecec2437 (diff) |
Rename StaticData::IsChart() to IsSyntax() and add new SearchAlgorithm values
Diffstat (limited to 'moses')
-rw-r--r-- | moses/ConfusionNet.cpp | 2 | ||||
-rw-r--r-- | moses/FF/BleuScoreFeature.cpp | 2 | ||||
-rw-r--r-- | moses/Sentence.cpp | 6 | ||||
-rw-r--r-- | moses/StaticData.cpp | 6 | ||||
-rw-r--r-- | moses/StaticData.h | 9 | ||||
-rw-r--r-- | moses/TranslationTask.cpp | 2 | ||||
-rw-r--r-- | moses/TypeDef.h | 3 |
7 files changed, 19 insertions, 11 deletions
diff --git a/moses/ConfusionNet.cpp b/moses/ConfusionNet.cpp index ce0d5e1c0..f6d7b4168 100644 --- a/moses/ConfusionNet.cpp +++ b/moses/ConfusionNet.cpp @@ -67,7 +67,7 @@ ConfusionNet() stats.createOne(); const StaticData& staticData = StaticData::Instance(); - if (staticData.IsChart()) { + if (staticData.IsSyntax()) { m_defaultLabelSet.insert(StaticData::Instance().GetInputDefaultNonTerminal()); } UTIL_THROW_IF2(&InputFeature::Instance() == NULL, "Input feature must be specified"); diff --git a/moses/FF/BleuScoreFeature.cpp b/moses/FF/BleuScoreFeature.cpp index 5be3b0b6b..24887c373 100644 --- a/moses/FF/BleuScoreFeature.cpp +++ b/moses/FF/BleuScoreFeature.cpp @@ -27,7 +27,7 @@ int BleuScoreState::Compare(const FFState& o) const if (&o == this) return 0; - if (StaticData::Instance().IsChart()) + if (StaticData::Instance().IsSyntax()) return 0; const BleuScoreState& other = dynamic_cast<const BleuScoreState&>(o); diff --git a/moses/Sentence.cpp b/moses/Sentence.cpp index 58d650aa3..a937f21e3 100644 --- a/moses/Sentence.cpp +++ b/moses/Sentence.cpp @@ -43,7 +43,7 @@ Sentence::Sentence() , InputType() { const StaticData& staticData = StaticData::Instance(); - if (staticData.IsChart()) { + if (staticData.IsSyntax()) { m_defaultLabelSet.insert(StaticData::Instance().GetInputDefaultNonTerminal()); } } @@ -168,7 +168,7 @@ int Sentence::Read(std::istream& in,const std::vector<FactorType>& factorOrder) if (staticData.GetXmlInputType() != XmlPassThrough) { int offset = 0; - if (staticData.IsChart()) { + if (staticData.IsSyntax()) { offset = 1; } @@ -188,7 +188,7 @@ int Sentence::Read(std::istream& in,const std::vector<FactorType>& factorOrder) // placeholders ProcessPlaceholders(placeholders); - if (staticData.IsChart()) { + if (staticData.IsSyntax()) { InitStartEndWord(); } diff --git a/moses/StaticData.cpp b/moses/StaticData.cpp index 94d5381f5..ec04f3142 100644 --- a/moses/StaticData.cpp +++ b/moses/StaticData.cpp @@ -112,7 +112,7 @@ bool StaticData::LoadData(Parameter *parameter) // to cube or not to cube m_parameter->SetParameter(m_searchAlgorithm, "search-algorithm", Normal); - if (IsChart()) + if (IsSyntax()) LoadChartDecodingParameters(); // input type has to be specified BEFORE loading the phrase tables! @@ -698,7 +698,7 @@ void StaticData::LoadDecodeGraphsOld(const vector<string> &mappingVector, const UTIL_THROW_IF2(decodeStep == NULL, "Null decode step"); if (m_decodeGraphs.size() < decodeGraphInd + 1) { DecodeGraph *decodeGraph; - if (IsChart()) { + if (IsSyntax()) { size_t maxChartSpan = (decodeGraphInd < maxChartSpans.size()) ? maxChartSpans[decodeGraphInd] : DEFAULT_MAX_CHART_SPAN; VERBOSE(1,"max-chart-span: " << maxChartSpans[decodeGraphInd] << endl); decodeGraph = new DecodeGraph(m_decodeGraphs.size(), maxChartSpan); @@ -765,7 +765,7 @@ void StaticData::LoadDecodeGraphsNew(const std::vector<std::string> &mappingVect UTIL_THROW_IF2(decodeStep == NULL, "Null decode step"); if (m_decodeGraphs.size() < decodeGraphInd + 1) { DecodeGraph *decodeGraph; - if (IsChart()) { + if (IsSyntax()) { size_t maxChartSpan = (decodeGraphInd < maxChartSpans.size()) ? maxChartSpans[decodeGraphInd] : DEFAULT_MAX_CHART_SPAN; VERBOSE(1,"max-chart-span: " << maxChartSpans[decodeGraphInd] << endl); decodeGraph = new DecodeGraph(m_decodeGraphs.size(), maxChartSpan); diff --git a/moses/StaticData.h b/moses/StaticData.h index 193f79aad..d9a96aaa3 100644 --- a/moses/StaticData.h +++ b/moses/StaticData.h @@ -436,8 +436,13 @@ public: SearchAlgorithm GetSearchAlgorithm() const { return m_searchAlgorithm; } - bool IsChart() const { - return m_searchAlgorithm == CYKPlus || m_searchAlgorithm == ChartIncremental; + bool IsSyntax() const { + return m_searchAlgorithm == CYKPlus || + m_searchAlgorithm == ChartIncremental || + m_searchAlgorithm == SyntaxS2T || + m_searchAlgorithm == SyntaxT2S || + m_searchAlgorithm == SyntaxT2S_SCFG || + m_searchAlgorithm == SyntaxF2S; } const ScoreComponentCollection& GetAllWeights() const { diff --git a/moses/TranslationTask.cpp b/moses/TranslationTask.cpp index 7c629db7f..eff0588b6 100644 --- a/moses/TranslationTask.cpp +++ b/moses/TranslationTask.cpp @@ -61,7 +61,7 @@ void TranslationTask::Run() // which manager BaseManager *manager; - if (!staticData.IsChart()) { + if (!staticData.IsSyntax()) { // phrase-based manager = new Manager(*m_source); } else if (staticData.GetSearchAlgorithm() == SyntaxF2S || diff --git a/moses/TypeDef.h b/moses/TypeDef.h index a56b3fbac..a619639bc 100644 --- a/moses/TypeDef.h +++ b/moses/TypeDef.h @@ -140,6 +140,9 @@ enum DictionaryFind { ,All = 1 }; +// Note: StaticData uses SearchAlgorithm to determine whether the translation +// model is phrase-based or syntax-based. If you add a syntax-based search +// algorithm here then you should also update StaticData::IsSyntax(). enum SearchAlgorithm { Normal = 0 ,CubePruning = 1 |