delete ChartTranslationOptionCollection. Roll everything into manager

This commit is contained in:
Hieu Hoang 2012-09-25 17:08:38 +01:00
parent e8b4a92134
commit bd90816716
8 changed files with 142 additions and 273 deletions

View File

@ -73,8 +73,6 @@
1EC7375C14B977AB00238410 /* ChartRuleLookupManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC735E914B977AA00238410 /* ChartRuleLookupManager.h */; };
1EC7376114B977AB00238410 /* ChartTranslationOption.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC735EE14B977AA00238410 /* ChartTranslationOption.cpp */; };
1EC7376214B977AB00238410 /* ChartTranslationOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC735EF14B977AA00238410 /* ChartTranslationOption.h */; };
1EC7376314B977AB00238410 /* ChartTranslationOptionCollection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC735F014B977AA00238410 /* ChartTranslationOptionCollection.cpp */; };
1EC7376414B977AB00238410 /* ChartTranslationOptionCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC735F114B977AA00238410 /* ChartTranslationOptionCollection.h */; };
1EC7376514B977AB00238410 /* ChartTranslationOptionList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC735F214B977AA00238410 /* ChartTranslationOptionList.cpp */; };
1EC7376614B977AB00238410 /* ChartTranslationOptionList.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EC735F314B977AA00238410 /* ChartTranslationOptionList.h */; };
1EC7376714B977AB00238410 /* ChartTrellisDetour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1EC735F414B977AA00238410 /* ChartTrellisDetour.cpp */; };
@ -405,8 +403,6 @@
1EC735E914B977AA00238410 /* ChartRuleLookupManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartRuleLookupManager.h; path = ../../moses/src/ChartRuleLookupManager.h; sourceTree = "<group>"; };
1EC735EE14B977AA00238410 /* ChartTranslationOption.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOption.cpp; path = ../../moses/src/ChartTranslationOption.cpp; sourceTree = "<group>"; };
1EC735EF14B977AA00238410 /* ChartTranslationOption.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOption.h; path = ../../moses/src/ChartTranslationOption.h; sourceTree = "<group>"; };
1EC735F014B977AA00238410 /* ChartTranslationOptionCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOptionCollection.cpp; path = ../../moses/src/ChartTranslationOptionCollection.cpp; sourceTree = "<group>"; };
1EC735F114B977AA00238410 /* ChartTranslationOptionCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOptionCollection.h; path = ../../moses/src/ChartTranslationOptionCollection.h; sourceTree = "<group>"; };
1EC735F214B977AA00238410 /* ChartTranslationOptionList.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTranslationOptionList.cpp; path = ../../moses/src/ChartTranslationOptionList.cpp; sourceTree = "<group>"; };
1EC735F314B977AA00238410 /* ChartTranslationOptionList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ChartTranslationOptionList.h; path = ../../moses/src/ChartTranslationOptionList.h; sourceTree = "<group>"; };
1EC735F414B977AA00238410 /* ChartTrellisDetour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ChartTrellisDetour.cpp; path = ../../moses/src/ChartTrellisDetour.cpp; sourceTree = "<group>"; };
@ -727,8 +723,6 @@
1EC735E914B977AA00238410 /* ChartRuleLookupManager.h */,
1EC735EE14B977AA00238410 /* ChartTranslationOption.cpp */,
1EC735EF14B977AA00238410 /* ChartTranslationOption.h */,
1EC735F014B977AA00238410 /* ChartTranslationOptionCollection.cpp */,
1EC735F114B977AA00238410 /* ChartTranslationOptionCollection.h */,
1EC735F214B977AA00238410 /* ChartTranslationOptionList.cpp */,
1EC735F314B977AA00238410 /* ChartTranslationOptionList.h */,
1EC735F414B977AA00238410 /* ChartTrellisDetour.cpp */,
@ -1125,7 +1119,6 @@
1EC7375A14B977AB00238410 /* ChartManager.h in Headers */,
1EC7375C14B977AB00238410 /* ChartRuleLookupManager.h in Headers */,
1EC7376214B977AB00238410 /* ChartTranslationOption.h in Headers */,
1EC7376414B977AB00238410 /* ChartTranslationOptionCollection.h in Headers */,
1EC7376614B977AB00238410 /* ChartTranslationOptionList.h in Headers */,
1EC7376814B977AB00238410 /* ChartTrellisDetour.h in Headers */,
1EC7376A14B977AB00238410 /* ChartTrellisDetourQueue.h in Headers */,
@ -1361,7 +1354,6 @@
1EC7375714B977AB00238410 /* ChartHypothesisCollection.cpp in Sources */,
1EC7375914B977AB00238410 /* ChartManager.cpp in Sources */,
1EC7376114B977AB00238410 /* ChartTranslationOption.cpp in Sources */,
1EC7376314B977AB00238410 /* ChartTranslationOptionCollection.cpp in Sources */,
1EC7376514B977AB00238410 /* ChartTranslationOptionList.cpp in Sources */,
1EC7376714B977AB00238410 /* ChartTrellisDetour.cpp in Sources */,
1EC7376914B977AB00238410 /* ChartTrellisDetourQueue.cpp in Sources */,

View File

@ -21,7 +21,6 @@
#include <algorithm>
#include "ChartCell.h"
#include "ChartTranslationOptionCollection.h"
#include "ChartCellCollection.h"
#include "RuleCubeQueue.h"
#include "RuleCube.h"

View File

@ -30,6 +30,7 @@
#include "StaticData.h"
#include "DecodeStep.h"
#include "TreeInput.h"
#include "DummyScoreProducers.h"
using namespace std;
using namespace Moses;
@ -45,10 +46,12 @@ extern bool g_debug;
ChartManager::ChartManager(InputType const& source, const TranslationSystem* system)
:m_source(source)
,m_hypoStackColl(source, *this)
,m_transOptColl(source, system, m_hypoStackColl, m_ruleLookupManagers)
,m_system(system)
,m_start(clock())
,m_hypothesisId(0)
,m_translationOptionList(StaticData::Instance().GetRuleLimit())
,m_decodeGraphList(system->GetDecodeGraphs())
{
m_system->InitializeBeforeSentenceProcessing(source);
const std::vector<PhraseDictionaryFeature*> &dictionaries = m_system->GetPhraseDictionaries();
@ -68,6 +71,9 @@ ChartManager::~ChartManager()
RemoveAllInColl(m_ruleLookupManagers);
RemoveAllInColl(m_unksrcs);
RemoveAllInColl(m_cacheTargetPhraseCollection);
clock_t end = clock();
float et = (end - m_start);
et /= (float)CLOCKS_PER_SEC;
@ -95,14 +101,13 @@ void ChartManager::ProcessSentence()
WordsRange range(startPos, endPos);
// create trans opt
m_transOptColl.CreateTranslationOptionsForRange(range);
CreateTranslationOptionsForRange(range);
// decode
ChartCell &cell = m_hypoStackColl.Get(range);
cell.ProcessSentence(m_transOptColl.GetTranslationOptionList()
,m_hypoStackColl);
m_transOptColl.Clear();
cell.ProcessSentence(m_translationOptionList, m_hypoStackColl);
m_translationOptionList.Clear();
cell.PruneToSize();
cell.CleanupArcList();
cell.SortHypotheses();
@ -342,4 +347,127 @@ void ChartManager::CreateDeviantPaths(
}
}
void ChartManager::CreateTranslationOptionsForRange(const WordsRange &wordsRange)
{
assert(m_decodeGraphList.size() == m_ruleLookupManagers.size());
m_translationOptionList.Clear();
std::vector <DecodeGraph*>::const_iterator iterDecodeGraph;
std::vector <ChartRuleLookupManager*>::const_iterator iterRuleLookupManagers = m_ruleLookupManagers.begin();
for (iterDecodeGraph = m_decodeGraphList.begin(); iterDecodeGraph != m_decodeGraphList.end(); ++iterDecodeGraph, ++iterRuleLookupManagers) {
const DecodeGraph &decodeGraph = **iterDecodeGraph;
assert(decodeGraph.GetSize() == 1);
ChartRuleLookupManager &ruleLookupManager = **iterRuleLookupManagers;
size_t maxSpan = decodeGraph.GetMaxChartSpan();
if (maxSpan == 0 || wordsRange.GetNumWordsCovered() <= maxSpan) {
ruleLookupManager.GetChartRuleCollection(wordsRange, m_translationOptionList);
}
}
if (wordsRange.GetNumWordsCovered() == 1 && wordsRange.GetStartPos() != 0 && wordsRange.GetStartPos() != m_source.GetSize()-1) {
bool alwaysCreateDirectTranslationOption = StaticData::Instance().IsAlwaysCreateDirectTranslationOption();
if (m_translationOptionList.GetSize() == 0 || alwaysCreateDirectTranslationOption) {
// create unknown words for 1 word coverage where we don't have any trans options
const Word &sourceWord = m_source.GetWord(wordsRange.GetStartPos());
ProcessOneUnknownWord(sourceWord, wordsRange);
}
}
m_translationOptionList.ApplyThreshold();
}
//! special handling of ONE unknown words.
void ChartManager::ProcessOneUnknownWord(const Word &sourceWord, const WordsRange &range)
{
// unknown word, add as trans opt
const StaticData &staticData = StaticData::Instance();
const UnknownWordPenaltyProducer *unknownWordPenaltyProducer = m_system->GetUnknownWordPenaltyProducer();
vector<float> wordPenaltyScore(1, -0.434294482); // TODO what is this number?
const ChartCell &chartCell = m_hypoStackColl.Get(range);
const ChartCellLabel &sourceWordLabel = chartCell.GetSourceWordLabel();
size_t isDigit = 0;
if (staticData.GetDropUnknown()) {
const Factor *f = sourceWord[0]; // TODO hack. shouldn't know which factor is surface
const string &s = f->GetString();
isDigit = s.find_first_of("0123456789");
if (isDigit == string::npos)
isDigit = 0;
else
isDigit = 1;
// modify the starting bitmap
}
Phrase* m_unksrc = new Phrase(1);
m_unksrc->AddWord() = sourceWord;
m_unksrcs.push_back(m_unksrc);
//TranslationOption *transOpt;
if (! staticData.GetDropUnknown() || isDigit) {
// loop
const UnknownLHSList &lhsList = staticData.GetUnknownLHS();
UnknownLHSList::const_iterator iterLHS;
for (iterLHS = lhsList.begin(); iterLHS != lhsList.end(); ++iterLHS) {
const string &targetLHSStr = iterLHS->first;
float prob = iterLHS->second;
// lhs
//const Word &sourceLHS = staticData.GetInputDefaultNonTerminal();
Word targetLHS(true);
targetLHS.CreateFromString(Output, staticData.GetOutputFactorOrder(), targetLHSStr, true);
CHECK(targetLHS.GetFactor(0) != NULL);
// add to dictionary
TargetPhrase *targetPhrase = new TargetPhrase(Output);
TargetPhraseCollection *tpc = new TargetPhraseCollection;
tpc->Add(targetPhrase);
m_cacheTargetPhraseCollection.push_back(tpc);
Word &targetWord = targetPhrase->AddWord();
targetWord.CreateUnknownWord(sourceWord);
// scores
vector<float> unknownScore(1, FloorScore(TransformScore(prob)));
//targetPhrase->SetScore();
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
targetPhrase->SetScore(m_system->GetWordPenaltyProducer(), wordPenaltyScore);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetTargetLHS(targetLHS);
// chart rule
m_translationOptionList.Add(*tpc, m_emptyStackVec, range);
} // for (iterLHS
} else {
// drop source word. create blank trans opt
vector<float> unknownScore(1, FloorScore(-numeric_limits<float>::infinity()));
TargetPhrase *targetPhrase = new TargetPhrase(Output);
TargetPhraseCollection *tpc = new TargetPhraseCollection;
tpc->Add(targetPhrase);
// loop
const UnknownLHSList &lhsList = staticData.GetUnknownLHS();
UnknownLHSList::const_iterator iterLHS;
for (iterLHS = lhsList.begin(); iterLHS != lhsList.end(); ++iterLHS) {
const string &targetLHSStr = iterLHS->first;
//float prob = iterLHS->second;
Word targetLHS(true);
targetLHS.CreateFromString(Output, staticData.GetOutputFactorOrder(), targetLHSStr, true);
CHECK(targetLHS.GetFactor(0) != NULL);
m_cacheTargetPhraseCollection.push_back(tpc);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
targetPhrase->SetTargetLHS(targetLHS);
// chart rule
m_translationOptionList.Add(*tpc, m_emptyStackVec, range);
}
}
}
} // namespace Moses

View File

@ -23,13 +23,13 @@
#include <vector>
#include "ChartCell.h"
#include "ChartTranslationOptionCollection.h"
#include "ChartCellCollection.h"
#include "InputType.h"
#include "WordsRange.h"
#include "SentenceStats.h"
#include "TranslationSystem.h"
#include "ChartRuleLookupManager.h"
#include "ChartTranslationOptionList.h"
#include <boost/shared_ptr.hpp>
@ -53,16 +53,23 @@ private:
static void CreateDeviantPaths(boost::shared_ptr<const ChartTrellisPath>,
const ChartTrellisNode &,
ChartTrellisDetourQueue &);
void CreateTranslationOptionsForRange(const WordsRange &wordsRange);
void ProcessOneUnknownWord(const Word &sourceWord, const WordsRange &range);
InputType const& m_source; /**< source sentence to be translated */
ChartCellCollection m_hypoStackColl;
ChartTranslationOptionCollection m_transOptColl; /**< pre-computed list of translation options for the phrases in this sentence */
std::auto_ptr<SentenceStats> m_sentenceStats;
const TranslationSystem* m_system;
clock_t m_start; /**< starting time, used for logging */
std::vector<ChartRuleLookupManager*> m_ruleLookupManagers;
unsigned m_hypothesisId; /* For handing out hypothesis ids to ChartHypothesis */
ChartTranslationOptionList m_translationOptionList; /**< pre-computed list of translation options for the phrases in this sentence */
std::vector<Phrase*> m_unksrcs;
std::list<TargetPhraseCollection*> m_cacheTargetPhraseCollection;
std::vector <DecodeGraph*> m_decodeGraphList;
StackVec m_emptyStackVec;
public:
ChartManager(InputType const& source, const TranslationSystem* system);
~ChartManager();

View File

@ -1,178 +0,0 @@
// vim:tabstop=2
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2010 Hieu Hoang
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
#include "util/check.hh"
#include "ChartTranslationOptionCollection.h"
#include "ChartCellCollection.h"
#include "InputType.h"
#include "StaticData.h"
#include "DecodeStep.h"
#include "DummyScoreProducers.h"
#include "Util.h"
using namespace std;
namespace Moses
{
ChartTranslationOptionCollection::ChartTranslationOptionCollection(InputType const& source
, const TranslationSystem* system
, const ChartCellCollection &hypoStackColl
, const std::vector<ChartRuleLookupManager*> &ruleLookupManagers)
:m_source(source)
,m_system(system)
,m_decodeGraphList(system->GetDecodeGraphs())
,m_hypoStackColl(hypoStackColl)
,m_ruleLookupManagers(ruleLookupManagers)
,m_translationOptionList(StaticData::Instance().GetRuleLimit())
{
}
ChartTranslationOptionCollection::~ChartTranslationOptionCollection()
{
RemoveAllInColl(m_unksrcs);
RemoveAllInColl(m_cacheTargetPhraseCollection);
}
void ChartTranslationOptionCollection::CreateTranslationOptionsForRange(
const WordsRange &wordsRange)
{
assert(m_decodeGraphList.size() == m_ruleLookupManagers.size());
m_translationOptionList.Clear();
std::vector <DecodeGraph*>::const_iterator iterDecodeGraph;
std::vector <ChartRuleLookupManager*>::const_iterator iterRuleLookupManagers = m_ruleLookupManagers.begin();
for (iterDecodeGraph = m_decodeGraphList.begin(); iterDecodeGraph != m_decodeGraphList.end(); ++iterDecodeGraph, ++iterRuleLookupManagers) {
const DecodeGraph &decodeGraph = **iterDecodeGraph;
assert(decodeGraph.GetSize() == 1);
ChartRuleLookupManager &ruleLookupManager = **iterRuleLookupManagers;
size_t maxSpan = decodeGraph.GetMaxChartSpan();
if (maxSpan == 0 || wordsRange.GetNumWordsCovered() <= maxSpan) {
ruleLookupManager.GetChartRuleCollection(wordsRange, m_translationOptionList);
}
}
if (wordsRange.GetNumWordsCovered() == 1 && wordsRange.GetStartPos() != 0 && wordsRange.GetStartPos() != m_source.GetSize()-1) {
bool alwaysCreateDirectTranslationOption = StaticData::Instance().IsAlwaysCreateDirectTranslationOption();
if (m_translationOptionList.GetSize() == 0 || alwaysCreateDirectTranslationOption) {
// create unknown words for 1 word coverage where we don't have any trans options
const Word &sourceWord = m_source.GetWord(wordsRange.GetStartPos());
ProcessOneUnknownWord(sourceWord, wordsRange);
}
}
m_translationOptionList.ApplyThreshold();
}
//! special handling of ONE unknown words.
void ChartTranslationOptionCollection::ProcessOneUnknownWord(const Word &sourceWord, const WordsRange &range)
{
// unknown word, add as trans opt
const StaticData &staticData = StaticData::Instance();
const UnknownWordPenaltyProducer *unknownWordPenaltyProducer = m_system->GetUnknownWordPenaltyProducer();
vector<float> wordPenaltyScore(1, -0.434294482); // TODO what is this number?
const ChartCell &chartCell = m_hypoStackColl.Get(range);
const ChartCellLabel &sourceWordLabel = chartCell.GetSourceWordLabel();
size_t isDigit = 0;
if (staticData.GetDropUnknown()) {
const Factor *f = sourceWord[0]; // TODO hack. shouldn't know which factor is surface
const string &s = f->GetString();
isDigit = s.find_first_of("0123456789");
if (isDigit == string::npos)
isDigit = 0;
else
isDigit = 1;
// modify the starting bitmap
}
Phrase* m_unksrc = new Phrase(1);
m_unksrc->AddWord() = sourceWord;
m_unksrcs.push_back(m_unksrc);
//TranslationOption *transOpt;
if (! staticData.GetDropUnknown() || isDigit) {
// loop
const UnknownLHSList &lhsList = staticData.GetUnknownLHS();
UnknownLHSList::const_iterator iterLHS;
for (iterLHS = lhsList.begin(); iterLHS != lhsList.end(); ++iterLHS) {
const string &targetLHSStr = iterLHS->first;
float prob = iterLHS->second;
// lhs
//const Word &sourceLHS = staticData.GetInputDefaultNonTerminal();
Word targetLHS(true);
targetLHS.CreateFromString(Output, staticData.GetOutputFactorOrder(), targetLHSStr, true);
CHECK(targetLHS.GetFactor(0) != NULL);
// add to dictionary
TargetPhrase *targetPhrase = new TargetPhrase(Output);
TargetPhraseCollection *tpc = new TargetPhraseCollection;
tpc->Add(targetPhrase);
m_cacheTargetPhraseCollection.push_back(tpc);
Word &targetWord = targetPhrase->AddWord();
targetWord.CreateUnknownWord(sourceWord);
// scores
vector<float> unknownScore(1, FloorScore(TransformScore(prob)));
//targetPhrase->SetScore();
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
targetPhrase->SetScore(m_system->GetWordPenaltyProducer(), wordPenaltyScore);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetTargetLHS(targetLHS);
// chart rule
m_translationOptionList.Add(*tpc, m_emptyStackVec, range);
} // for (iterLHS
} else {
// drop source word. create blank trans opt
vector<float> unknownScore(1, FloorScore(-numeric_limits<float>::infinity()));
TargetPhrase *targetPhrase = new TargetPhrase(Output);
TargetPhraseCollection *tpc = new TargetPhraseCollection;
tpc->Add(targetPhrase);
// loop
const UnknownLHSList &lhsList = staticData.GetUnknownLHS();
UnknownLHSList::const_iterator iterLHS;
for (iterLHS = lhsList.begin(); iterLHS != lhsList.end(); ++iterLHS) {
const string &targetLHSStr = iterLHS->first;
//float prob = iterLHS->second;
Word targetLHS(true);
targetLHS.CreateFromString(Output, staticData.GetOutputFactorOrder(), targetLHSStr, true);
CHECK(targetLHS.GetFactor(0) != NULL);
m_cacheTargetPhraseCollection.push_back(tpc);
targetPhrase->SetSourcePhrase(m_unksrc);
targetPhrase->SetScore(unknownWordPenaltyProducer, unknownScore);
targetPhrase->SetTargetLHS(targetLHS);
// chart rule
m_translationOptionList.Add(*tpc, m_emptyStackVec, range);
}
}
}
} // namespace

View File

@ -1,77 +0,0 @@
// vim:tabstop=2
/***********************************************************************
Moses - factored phrase-based language decoder
Copyright (C) 2010 Hieu Hoang
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***********************************************************************/
#pragma once
#include <vector>
#include "InputType.h"
#include "DecodeGraph.h"
#include "ChartTranslationOptionList.h"
#include "ChartRuleLookupManager.h"
#include "StackVec.h"
namespace Moses
{
class DecodeGraph;
class Word;
class ChartTranslationOption;
class DottedRule;
class WordPenaltyProducer;
class ChartCellCollection;
/** list of list of ALL target phrases for a sentence. NOT translation option
* 1 of these is held by the chart manager
* @todo Why is the manager holding target phrases, and not the translation option, or it's collection?
* @todo Why isn't each TargetPhraseCollection held in separate chart cell?
*/
class ChartTranslationOptionCollection
{
protected:
const InputType &m_source;
const TranslationSystem* m_system;
std::vector <DecodeGraph*> m_decodeGraphList;
const ChartCellCollection &m_hypoStackColl;
const std::vector<ChartRuleLookupManager*> &m_ruleLookupManagers;
ChartTranslationOptionList m_translationOptionList;
std::vector<Phrase*> m_unksrcs;
std::list<TargetPhraseCollection*> m_cacheTargetPhraseCollection;
StackVec m_emptyStackVec;
//! special handling of ONE unknown words.
virtual void ProcessOneUnknownWord(const Word &, const WordsRange &);
public:
ChartTranslationOptionCollection(InputType const& source
, const TranslationSystem* system
, const ChartCellCollection &hypoStackColl
, const std::vector<ChartRuleLookupManager*> &ruleLookupManagers);
virtual ~ChartTranslationOptionCollection();
void CreateTranslationOptionsForRange(const WordsRange &);
const ChartTranslationOptionList &GetTranslationOptionList() const {
return m_translationOptionList;
}
void Clear() { m_translationOptionList.Clear(); }
};
}

View File

@ -22,7 +22,6 @@
#include "ChartCell.h"
#include "ChartCellCollection.h"
#include "ChartTranslationOption.h"
#include "ChartTranslationOptionCollection.h"
#include "RuleCube.h"
#include "RuleCubeQueue.h"
#include "StaticData.h"

View File

@ -20,7 +20,6 @@
#include "ChartCell.h"
#include "ChartCellCollection.h"
#include "ChartTranslationOption.h"
#include "ChartTranslationOptionCollection.h"
#include "RuleCubeItem.h"
#include "RuleCubeQueue.h"
#include "WordsRange.h"