// $Id$ #ifndef moses_ConfusionNet_h #define moses_ConfusionNet_h #include #include #include "Word.h" #include "InputType.h" namespace Moses { class FactorCollection; class TranslationOptionCollection; class Sentence; /** An input to the decoder where each position can be 1 of a number of words, * each with an associated probability. Compared with a sentence, where each position is a word */ class ConfusionNet : public InputType { public: typedef std::vector > > Column; protected: std::vector data; bool ReadFormat0(std::istream&,const std::vector& factorOrder); bool ReadFormat1(std::istream&,const std::vector& factorOrder); void String2Word(const std::string& s,Word& w,const std::vector& factorOrder); public: ConfusionNet(); virtual ~ConfusionNet(); ConfusionNet(Sentence const& s); InputTypeEnum GetType() const { return ConfusionNetworkInput; } const Column& GetColumn(size_t i) const { CHECK(i& factorOrder,int format=0); virtual void Print(std::ostream&) const; int Read(std::istream& in,const std::vector& factorOrder); Phrase GetSubString(const WordsRange&) const; //TODO not defined std::string GetStringRep(const std::vector factorsToPrint) const; //TODO not defined const Word& GetWord(size_t pos) const; TranslationOptionCollection* CreateTranslationOptionCollection() const; const NonTerminalSet &GetLabelSet(size_t /*startPos*/, size_t /*endPos*/) const { CHECK(false); return *(new NonTerminalSet()); } }; std::ostream& operator<<(std::ostream& out,const ConfusionNet& cn); } #endif