File size: 677 Bytes
158b61b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "PChart.h"

#include "moses/FactorCollection.h"

namespace Moses
{
namespace Syntax
{
namespace S2T
{

PChart::PChart(std::size_t width, bool maintainCompressedChart)
{
  m_cells.resize(width);
  for (std::size_t i = 0; i < width; ++i) {
    m_cells[i].resize(width);
  }
  if (maintainCompressedChart) {
    m_compressedChart = new CompressedChart(width);
    for (CompressedChart::iterator p = m_compressedChart->begin();
         p != m_compressedChart->end(); ++p) {
      p->resize(FactorCollection::Instance().GetNumNonTerminals());
    }
  }
}

PChart::~PChart()
{
  delete m_compressedChart;
}

}  // namespace S2T
}  // namespace Syntax
}  // namespace Moses