Add explicit to the Search constructor; fix the comments.

This commit is contained in:
Tetsuo Kiso 2013-04-30 16:20:08 +09:00
parent 4650e30380
commit b107340800
3 changed files with 15 additions and 17 deletions

View File

@ -1,4 +1,3 @@
#include "Manager.h"
#include "SearchCubePruning.h"
#include "SearchNormal.h"
@ -8,7 +7,6 @@
namespace Moses
{
Search *Search::CreateSearch(Manager& manager, const InputType &source,
SearchAlgorithm searchAlgorithm, const TranslationOptionCollection &transOptColl)
{
@ -26,9 +24,6 @@ Search *Search::CreateSearch(Manager& manager, const InputType &source,
abort();
return NULL;
}
}
}

View File

@ -3,7 +3,6 @@
#include <vector>
#include "TypeDef.h"
#include "Phrase.h"
namespace Moses
{
@ -13,31 +12,34 @@ class Hypothesis;
class InputType;
class TranslationOptionCollection;
class Manager;
class Phrase;
/** Abstract class used in the phrase-based decoder.
* Cube pruning and normal searches are the classes that inherits from this class
/** Base search class used in the phrase-based decoder.
*
* Actual search class that implement the cube pruning algorithm (SearchCubePruning)
* or standard beam search (SearchNormal) should inherits from this class, and
* override pure virtual functions.
*/
class Search
{
public:
virtual const std::vector < HypothesisStack* >& GetHypothesisStacks() const = 0;
virtual const std::vector<HypothesisStack*>& GetHypothesisStacks() const = 0;
virtual const Hypothesis *GetBestHypothesis() const = 0;
virtual void ProcessSentence() = 0;
Search(Manager& manager) : m_manager(manager) {}
virtual ~Search()
{}
// Factory
//! Decode the sentence according to the specified search algorithm.
virtual void ProcessSentence() = 0;
explicit Search(Manager& manager) : m_manager(manager) {}
virtual ~Search() {}
// Factory method
static Search *CreateSearch(Manager& manager, const InputType &source, SearchAlgorithm searchAlgorithm,
const TranslationOptionCollection &transOptColl);
protected:
const Phrase *m_constraint;
Manager& m_manager;
};
}
#endif

View File

@ -1,6 +1,7 @@
#include "Manager.h"
#include "Timer.h"
#include "SearchNormal.h"
#include "Phrase.h"
using namespace std;