mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2025-01-06 19:49:41 +03:00
add datastructure to store range of each symbol in source phrase
This commit is contained in:
parent
43220ea994
commit
b0084adbe4
@ -39,7 +39,7 @@ std::ostream& operator<<(std::ostream &out, const InputPath &obj)
|
||||
|
||||
void InputPath::AddTargetPhrase(const PhraseTable &pt, const SCFG::TargetPhraseImpl *tp)
|
||||
{
|
||||
targetPhrases.AddTargetPhrase(*tp);
|
||||
//targetPhrases.AddTargetPhrase(*tp);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <boost/unordered_map.hpp>
|
||||
#include "../InputPathBase.h"
|
||||
#include "TargetPhrases.h"
|
||||
|
||||
@ -19,6 +20,19 @@ namespace SCFG
|
||||
class TargetPhrases;
|
||||
class TargetPhraseImpl;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//! The range covered by each symbol in the source
|
||||
//! Terminals will cover only 1 word, NT can cover multiple words
|
||||
class SymbolBind
|
||||
{
|
||||
public:
|
||||
typedef std::pair<Range, bool> Element;
|
||||
// range, isNT
|
||||
std::vector<Element> coll;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
class ActiveChartEntry
|
||||
{
|
||||
public:
|
||||
@ -38,7 +52,7 @@ class InputPath: public InputPathBase
|
||||
{
|
||||
friend std::ostream& operator<<(std::ostream &, const InputPath &);
|
||||
public:
|
||||
SCFG::TargetPhrases targetPhrases;
|
||||
boost::unordered_map<SymbolBind, SCFG::TargetPhrases> targetPhrases;
|
||||
|
||||
InputPath(MemPool &pool, const SubPhrase &subPhrase, const Range &range,
|
||||
size_t numPt, const InputPath *prefixPath);
|
||||
|
@ -92,10 +92,12 @@ void Manager::Lookup(size_t startPos, size_t size)
|
||||
pt.Lookup(GetPool(), system, m_stacks, path);
|
||||
}
|
||||
|
||||
/*
|
||||
size_t tpsNum = path.targetPhrases.GetSize();
|
||||
if (tpsNum) {
|
||||
cerr << tpsNum << " " << path << endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void Manager::Decode(size_t startPos, size_t size)
|
||||
@ -105,6 +107,7 @@ void Manager::Decode(size_t startPos, size_t size)
|
||||
|
||||
Recycler<HypothesisBase*> &hypoRecycler = GetHypoRecycle();
|
||||
|
||||
/*
|
||||
SCFG::TargetPhrases &tps = path.targetPhrases;
|
||||
|
||||
SCFG::TargetPhrases::const_iterator iter;
|
||||
@ -116,6 +119,7 @@ void Manager::Decode(size_t startPos, size_t size)
|
||||
StackAdd added = stack.Add(hypo, hypoRecycler, arcLists);
|
||||
cerr << "added=" << added.added << " " << (const Phrase&) tp << endl;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user