00001 #pragma once 00002 00003 #include <vector> 00004 00005 #include <boost/unordered_map.hpp> 00006 00007 #include "moses/Syntax/NonTerminalMap.h" 00008 #include "moses/Syntax/SVertexStack.h" 00009 #include "moses/Syntax/SymbolEqualityPred.h" 00010 #include "moses/Syntax/SymbolHasher.h" 00011 #include "moses/Word.h" 00012 00013 namespace Moses 00014 { 00015 namespace Syntax 00016 { 00017 namespace S2T 00018 { 00019 00020 class SChart 00021 { 00022 public: 00023 struct Cell { 00024 typedef boost::unordered_map<Word, SVertexStack, SymbolHasher, 00025 SymbolEqualityPred> TMap; 00026 typedef NonTerminalMap<SVertexStack> NMap; 00027 TMap terminalStacks; 00028 NMap nonTerminalStacks; 00029 }; 00030 00031 SChart(std::size_t width); 00032 00033 std::size_t GetWidth() const { 00034 return m_cells.size(); 00035 } 00036 00037 const Cell &GetCell(std::size_t start, std::size_t end) const { 00038 return m_cells[start][end]; 00039 } 00040 00041 Cell &GetCell(std::size_t start, std::size_t end) { 00042 return m_cells[start][end]; 00043 } 00044 00045 private: 00046 std::vector<std::vector<Cell> > m_cells; 00047 }; 00048 00049 } // S2T 00050 } // Syntax 00051 } // Moses