|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
#include <vector> |
|
|
|
|
|
#include "ChartRuleLookupManagerCYKPlus.h" |
|
|
#include "CompletedRuleCollection.h" |
|
|
#include "moses/NonTerminal.h" |
|
|
#include "moses/TranslationModel/PhraseDictionaryMemory.h" |
|
|
#include "moses/TranslationModel/PhraseDictionaryNodeMemory.h" |
|
|
#include "moses/StackVec.h" |
|
|
|
|
|
namespace Moses |
|
|
{ |
|
|
|
|
|
class ChartParserCallback; |
|
|
class Range; |
|
|
|
|
|
|
|
|
class ChartRuleLookupManagerMemory : public ChartRuleLookupManagerCYKPlus |
|
|
{ |
|
|
public: |
|
|
typedef std::vector<ChartCellCache> CompressedColumn; |
|
|
typedef std::vector<CompressedColumn> CompressedMatrix; |
|
|
|
|
|
|
|
|
ChartRuleLookupManagerMemory(const ChartParser &parser, |
|
|
const ChartCellCollectionBase &cellColl, |
|
|
const PhraseDictionaryMemory &ruleTable); |
|
|
|
|
|
~ChartRuleLookupManagerMemory() {}; |
|
|
|
|
|
virtual void GetChartRuleCollection( |
|
|
const InputPath &inputPath, |
|
|
size_t lastPos, |
|
|
ChartParserCallback &outColl); |
|
|
|
|
|
private: |
|
|
|
|
|
void GetTerminalExtension( |
|
|
const PhraseDictionaryNodeMemory *node, |
|
|
size_t pos); |
|
|
|
|
|
void GetNonTerminalExtension( |
|
|
const PhraseDictionaryNodeMemory *node, |
|
|
size_t startPos); |
|
|
|
|
|
void AddAndExtend( |
|
|
const PhraseDictionaryNodeMemory *node, |
|
|
size_t endPos); |
|
|
|
|
|
void UpdateCompressedMatrix(size_t startPos, |
|
|
size_t endPos, |
|
|
size_t lastPos); |
|
|
|
|
|
const PhraseDictionaryMemory &m_ruleTable; |
|
|
|
|
|
|
|
|
bool m_isSoftMatching; |
|
|
const std::vector<std::vector<Word> >& m_softMatchingMap; |
|
|
|
|
|
|
|
|
std::vector<CompletedRuleCollection> m_completedRules; |
|
|
|
|
|
size_t m_lastPos; |
|
|
size_t m_unaryPos; |
|
|
|
|
|
StackVec m_stackVec; |
|
|
std::vector<float> m_stackScores; |
|
|
std::vector<const Word*> m_sourceWords; |
|
|
ChartParserCallback* m_outColl; |
|
|
|
|
|
std::vector<CompressedMatrix> m_compressedMatrixVec; |
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
|