placeholder for chart decoding

This commit is contained in:
Hieu Hoang 2013-09-22 15:36:50 +02:00
parent 574d716f23
commit 00b21b4f53
4 changed files with 23 additions and 3 deletions

View File

@ -117,7 +117,7 @@ public:
// shorthand for "global data"
const StaticData &staticData = StaticData::Instance();
// input sentence
Sentence sentence();
Sentence sentence;
// execute the translation
// note: this executes the search, resulting in a search graph

View File

@ -68,6 +68,19 @@ std::set<size_t> AlignmentInfo::GetAlignmentsForSource(size_t sourcePos) const
return ret;
}
std::set<size_t> AlignmentInfo::GetAlignmentsForTarget(size_t targetPos) const
{
std::set<size_t> ret;
CollType::const_iterator iter;
for (iter = begin(); iter != end(); ++iter) {
const std::pair<size_t,size_t> &align = *iter;
if (iter->second == targetPos) {
ret.insert(iter->first);
}
}
return ret;
}
bool compare_target(const std::pair<size_t,size_t> *a, const std::pair<size_t,size_t> *b)
{

View File

@ -70,6 +70,7 @@ public:
}
std::set<size_t> GetAlignmentsForSource(size_t sourcePos) const;
std::set<size_t> GetAlignmentsForTarget(size_t targetPos) const;
size_t GetSize() const {
return m_collection.size();

View File

@ -16,6 +16,7 @@ protected:
const TargetPhrase &m_targetPhrase;
ScoreComponentCollection m_scoreBreakdown;
const InputPath *m_inputPath;
const std::vector<const Word*> *m_ruleSourceFromInputPath; // used by placeholders
public:
ChartTranslationOption(const TargetPhrase &targetPhrase);
@ -24,10 +25,15 @@ public:
return m_targetPhrase;
}
void SetInputPath(const InputPath *inputPath)
{ m_inputPath = inputPath; }
const InputPath *GetInputPath() const
{ return m_inputPath; }
void SetInputPath(const InputPath *inputPath)
{ m_inputPath = inputPath; }
const std::vector<const Word*> *GetSourceRuleFromInputPath() const
{ return m_ruleSourceFromInputPath; }
void SetSourceRuleFromInputPath(const std::vector<const Word*> *obj)
{ m_ruleSourceFromInputPath = obj; }
const ScoreComponentCollection &GetScores() const {
return m_scoreBreakdown;