mosesdecoder/moses/Incremental.h

65 lines
1.6 KiB
C
Raw Normal View History

#pragma once
#include "lm/word_index.hh"
#include "search/applied.hh"
#include "search/nbest.hh"
2012-11-12 23:56:18 +04:00
#include "moses/ChartCellCollection.h"
#include "moses/ChartParser.h"
#include <vector>
#include <string>
2013-05-29 21:16:15 +04:00
namespace Moses
{
class ScoreComponentCollection;
class InputType;
2013-05-27 18:54:50 +04:00
class LanguageModel;
2013-05-29 21:16:15 +04:00
namespace Incremental
{
2013-05-29 21:16:15 +04:00
class Manager
{
public:
Manager(const InputType &source);
2013-05-29 21:16:15 +04:00
~Manager();
2013-05-29 21:16:15 +04:00
template <class Model> void LMCallback(const Model &model, const std::vector<lm::WordIndex> &words);
2013-05-29 21:16:15 +04:00
const std::vector<search::Applied> &ProcessSentence();
2012-10-12 16:53:08 +04:00
2013-05-29 21:16:15 +04:00
// Call to get the same value as ProcessSentence returned.
const std::vector<search::Applied> &Completed() const {
return *completed_nbest_;
}
2013-05-29 21:16:15 +04:00
private:
template <class Model, class Best> search::History PopulateBest(const Model &model, const std::vector<lm::WordIndex> &words, Best &out);
2012-10-12 16:53:08 +04:00
2013-05-29 21:16:15 +04:00
const InputType &source_;
ChartCellCollectionBase cells_;
ChartParser parser_;
2013-05-29 21:16:15 +04:00
// Only one of single_best_ or n_best_ will be used, but it was easier to do this than a template.
search::SingleBest single_best_;
// ProcessSentence returns a reference to a vector. ProcessSentence
// doesn't have one, so this is populated and returned.
std::vector<search::Applied> backing_for_single_;
search::NBest n_best_;
const std::vector<search::Applied> *completed_nbest_;
};
// Just get the phrase.
void ToPhrase(const search::Applied final, Phrase &out);
2013-05-29 21:16:15 +04:00
// Get the phrase and the features.
2013-05-11 17:13:26 +04:00
void PhraseAndFeatures(const search::Applied final, Phrase &phrase, ScoreComponentCollection &features);
2013-05-27 18:54:50 +04:00
} // namespace Incremental
} // namespace Moses