add datastructure to store range of each symbol in source phrase

This commit is contained in:
Hieu Hoang 2016-04-19 23:45:17 +04:00
parent 43220ea994
commit b0084adbe4
3 changed files with 20 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -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;
}
*/
}
}