Skip to content

Commit

Permalink
ChartDecoding isn't the only syntax algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
kpu committed Jun 18, 2013
1 parent c70537d commit 1b87f29
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions mira/Decoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ vector< vector<const Word*> > MosesDecoder::getNBest(const std::string& source,
string filename)
{
StaticData &staticData = StaticData::InstanceNonConst();
bool chartDecoding = (staticData.GetSearchAlgorithm() == ChartDecoding);
bool chartDecoding = staticData.IsChart();
initialize(staticData, source, sentenceid, bleuObjectiveWeight, bleuScoreWeight, avgRefLength, chartDecoding);

// run the decoder
Expand Down Expand Up @@ -269,7 +269,7 @@ void MosesDecoder::outputNBestList(const std::string& source, size_t sentenceid,
bool distinctNbest, bool avgRefLength, string filename, ofstream& streamOut)
{
StaticData &staticData = StaticData::InstanceNonConst();
bool chartDecoding = (staticData.GetSearchAlgorithm() == ChartDecoding);
bool chartDecoding = staticData.IsChart();
initialize(staticData, source, sentenceid, bleuObjectiveWeight, bleuScoreWeight, avgRefLength, chartDecoding);

if (chartDecoding) {
Expand Down
5 changes: 2 additions & 3 deletions mira/Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,8 +416,7 @@ int main(int argc, char** argv)
decoder->setBleuParameters(disableBleuFeature, sentenceBleu, scaleByInputLength, scaleByAvgInputLength,
scaleByInverseLength, scaleByAvgInverseLength,
scaleByX, historySmoothing, bleu_smoothing_scheme, simpleHistoryBleu);
SearchAlgorithm searchAlgorithm = staticData.GetSearchAlgorithm();
bool chartDecoding = (searchAlgorithm == ChartDecoding);
bool chartDecoding = staticData.IsChart();

// Optionally shuffle the sentences
vector<size_t> order;
Expand Down Expand Up @@ -1800,7 +1799,7 @@ void decodeHopeOrFear(size_t rank, size_t size, size_t decode, string filename,
vector< vector<const Word*> > nbestOutput = decoder->getNBest(input, sid, n, factor, bleuWeight, dummyFeatureValues[0],
dummyBleuScores[0], dummyModelScores[0], n, realBleu, true, false, rank, 0, "");
cerr << endl;
decoder->cleanup(StaticData::Instance().GetSearchAlgorithm() == ChartDecoding);
decoder->cleanup(StaticData::Instance().IsChart());

for (size_t i = 0; i < nbestOutput.size(); ++i) {
vector<const Word*> output = nbestOutput[i];
Expand Down
5 changes: 1 addition & 4 deletions moses/FF/BleuScoreFeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ int BleuScoreState::Compare(const FFState& o) const
if (&o == this)
return 0;

const StaticData &staticData = StaticData::Instance();
SearchAlgorithm searchAlgorithm = staticData.GetSearchAlgorithm();
bool chartDecoding = (searchAlgorithm == ChartDecoding);
if (chartDecoding)
if (StaticData::Instance().IsChart())
return 0;

const BleuScoreState& other = dynamic_cast<const BleuScoreState&>(o);
Expand Down

0 comments on commit 1b87f29

Please sign in to comment.