diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-12 23:56:18 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-12 23:56:18 +0400 |
commit | 5e3ef23cef6101d2c098eb3445f562e8f595655b (patch) | |
tree | b8c332b6fa82bae84ea4910967a10ba1b08a7107 /moses/WordLattice.h | |
parent | 8c785cff2b1be3cccd76ea9026f71b649762dfc3 (diff) |
move moses/src/* to moses/
Diffstat (limited to 'moses/WordLattice.h')
-rw-r--r-- | moses/WordLattice.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/moses/WordLattice.h b/moses/WordLattice.h new file mode 100644 index 000000000..3fb3beba8 --- /dev/null +++ b/moses/WordLattice.h @@ -0,0 +1,52 @@ +#ifndef moses_WordLattice_h +#define moses_WordLattice_h + +#include <vector> +#include "ConfusionNet.h" +#include "PCNTools.h" + +namespace Moses +{ + +/** An input to the decoder that represent a word lattice. + * @todo why is this inherited from confusion net? + */ +class WordLattice: public ConfusionNet +{ +private: + std::vector<std::vector<size_t> > next_nodes; + std::vector<std::vector<int> > distances; + +public: + WordLattice(); + size_t GetColumnIncrement(size_t ic, size_t j) const; + void Print(std::ostream&) const; + /** Get shortest path between two nodes + */ + virtual int ComputeDistortionDistance(const WordsRange& prev, const WordsRange& current) const; + // is it possible to get from the edge of the previous word range to the current word range + virtual bool CanIGetFromAToB(size_t start, size_t end) const; + + /** Given a lattice represented using the PCN::CN data type (topologically sorted agency list + * representation), initialize the WordLattice object + */ + int InitializeFromPCNDataType(const PCN::CN& cn, const std::vector<FactorType>& factorOrder, const std::string& debug_line = ""); + /** Read from PLF format (1 lattice per line) + */ + int Read(std::istream& in,const std::vector<FactorType>& factorOrder); + + /** Convert internal representation into an edge matrix + * @note edges[1][2] means there is an edge from 1 to 2 + */ + void GetAsEdgeMatrix(std::vector<std::vector<bool> >& edges) const; + + const NonTerminalSet &GetLabelSet(size_t /*startPos*/, size_t /*endPos*/) const { + CHECK(false); + return *(new NonTerminalSet()); + } + +}; + +} + +#endif |