mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-05 02:22:21 +03:00
templatize node
This commit is contained in:
parent
15a02676ed
commit
e076d0c3df
@ -18,7 +18,7 @@ class System;
|
||||
namespace PtMem
|
||||
{
|
||||
|
||||
template<class WORD>
|
||||
template<class WORD, class SP, class TP>
|
||||
class Node
|
||||
{
|
||||
public:
|
||||
@ -33,7 +33,7 @@ public:
|
||||
~Node()
|
||||
{}
|
||||
|
||||
void AddRule(Phrase<WORD> &source, TargetPhrase<Moses2::Word> *target)
|
||||
void AddRule(SP &source, TP *target)
|
||||
{
|
||||
AddRule(source, target, 0);
|
||||
}
|
||||
@ -105,7 +105,7 @@ protected:
|
||||
Phrase<WORD> *m_source;
|
||||
std::vector<TargetPhrase<WORD>*> *m_unsortedTPS;
|
||||
|
||||
Node &AddRule(Phrase<WORD> &source, TargetPhrase<WORD> *target, size_t pos)
|
||||
Node &AddRule(SP &source, TP *target, size_t pos)
|
||||
{
|
||||
if (pos == source.GetSize()) {
|
||||
if (m_unsortedTPS == NULL) {
|
||||
|
@ -116,11 +116,13 @@ void PhraseTableMemory::Load(System &system)
|
||||
m_rootPb.SortAndPrune(m_tableLimit, systemPool, system);
|
||||
cerr << "root=" << &m_rootPb << endl;
|
||||
|
||||
/*
|
||||
BOOST_FOREACH(const PtMem::Node<Word>::Children::value_type &valPair, m_rootPb.GetChildren()) {
|
||||
const Word &word = valPair.first;
|
||||
cerr << word << " ";
|
||||
}
|
||||
cerr << endl;
|
||||
*/
|
||||
}
|
||||
|
||||
TargetPhrases* PhraseTableMemory::Lookup(const Manager &mgr, MemPool &pool,
|
||||
|
@ -10,14 +10,18 @@
|
||||
#include "../../legacy/Util2.h"
|
||||
#include "../../SCFG/InputPath.h"
|
||||
#include "Node.h"
|
||||
#include "../../PhraseBased/PhraseImpl.h"
|
||||
#include "../../PhraseBased/TargetPhraseImpl.h"
|
||||
#include "../../SCFG/PhraseImpl.h"
|
||||
#include "../../SCFG/TargetPhraseImpl.h"
|
||||
|
||||
namespace Moses2
|
||||
{
|
||||
|
||||
class PhraseTableMemory: public PhraseTable
|
||||
{
|
||||
typedef PtMem::Node<Word> PBNODE;
|
||||
typedef PtMem::Node<SCFG::Word> SCFGNODE;
|
||||
typedef PtMem::Node<Word, PhraseImpl, TargetPhraseImpl> PBNODE;
|
||||
typedef PtMem::Node<SCFG::Word, SCFG::PhraseImpl, SCFG::TargetPhraseImpl> SCFGNODE;
|
||||
|
||||
//////////////////////////////////////
|
||||
class ActiveChartEntryMem : public SCFG::ActiveChartEntry
|
||||
|
Loading…
Reference in New Issue
Block a user