This commit is contained in:
Hieu Hoang 2013-10-03 11:33:48 +01:00
parent 52215fdf79
commit 6759af3821
9 changed files with 40 additions and 36 deletions

View File

@ -146,7 +146,7 @@ ChartParser::ChartParser(InputType const &source, ChartCellCollectionBase &cells
const PhraseDictionary *dict = *p;
PhraseDictionary *nonConstDict = const_cast<PhraseDictionary*>(dict);
ChartRuleLookupManager *lookupMgr = nonConstDict->CreateRuleLookupManager(*this, cells);
ChartRuleLookupManager *lookupMgr = nonConstDict->CreateRuleLookupManager(*this, cells);
m_ruleLookupManagers.push_back(lookupMgr);
}

View File

@ -72,11 +72,13 @@ public:
}
//! distance to next node in input lattice. For sentences and confusion networks, this should be 1 (default)
size_t GetNextNode() const
{ return m_nextNode; }
size_t GetNextNode() const {
return m_nextNode;
}
void SetNextNode(size_t nextNode)
{ m_nextNode = nextNode; }
void SetNextNode(size_t nextNode) {
m_nextNode = nextNode;
}
void SetTargetPhrases(const PhraseDictionary &phraseDictionary
, const TargetPhraseCollection *targetPhrases

View File

@ -1073,7 +1073,7 @@ void StaticData::CheckLEGACYPT()
for (size_t i = 0; i < m_phraseDictionary.size(); ++i) {
const PhraseDictionary *phraseDictionary = m_phraseDictionary[i];
if (dynamic_cast<const PhraseDictionaryTreeAdaptor*>(phraseDictionary) != NULL) {
m_useLegacyPT = true;
m_useLegacyPT = true;
return;
}
}

View File

@ -749,8 +749,9 @@ public:
** eventually, we'll stop support the binary phrase-table and delete this legacy code
**/
void CheckLEGACYPT();
bool GetUseLegacyPT() const
{ return m_useLegacyPT; }
bool GetUseLegacyPT() const {
return m_useLegacyPT;
}
};

View File

@ -43,7 +43,7 @@ ChartRuleLookupManagerSkeleton::ChartRuleLookupManagerSkeleton(
: ChartRuleLookupManager(parser, cellColl)
, m_skeletonPT(skeletonPt)
{
cerr << "starting ChartRuleLookupManagerSkeleton" << endl;
cerr << "starting ChartRuleLookupManagerSkeleton" << endl;
}
ChartRuleLookupManagerSkeleton::~ChartRuleLookupManagerSkeleton()
@ -61,10 +61,10 @@ void ChartRuleLookupManagerSkeleton::GetChartRuleCollection(
m_tpColl.push_back(tpColl);
if (range.GetNumWordsCovered() == 1) {
const ChartCellLabel &sourceWordLabel = GetSourceAt(range.GetStartPos());
const Word &sourceWord = sourceWordLabel.GetLabel();
TargetPhrase *tp = CreateTargetPhrase(sourceWord);
tpColl->Add(tp);
const ChartCellLabel &sourceWordLabel = GetSourceAt(range.GetStartPos());
const Word &sourceWord = sourceWordLabel.GetLabel();
TargetPhrase *tp = CreateTargetPhrase(sourceWord);
tpColl->Add(tp);
}
outColl.Add(*tpColl, m_stackVec, range);

View File

@ -27,7 +27,7 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
const WordLattice *lattice = dynamic_cast<const WordLattice*>(&input);
if (lattice) {
cerr << *lattice << endl;
cerr << *lattice << endl;
}
size_t size = input.GetSize();
@ -58,7 +58,7 @@ TranslationOptionCollectionConfusionNet::TranslationOptionCollectionConfusionNet
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
if (nextNodes) {
size_t nextNode = nextNodes->at(i);
size_t nextNode = nextNodes->at(i);
path->SetNextNode(nextNode);
}

View File

@ -27,7 +27,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
const WordLattice *lattice = dynamic_cast<const WordLattice*>(&input);
if (lattice) {
cerr << *lattice << endl;
cerr << *lattice << endl;
}
size_t size = input.GetSize();
@ -58,7 +58,7 @@ TranslationOptionCollectionLattice::TranslationOptionCollectionLattice(
InputPath *path = new InputPath(subphrase, labels, range, NULL, inputScore);
if (nextNodes) {
size_t nextNode = nextNodes->at(i);
size_t nextNode = nextNodes->at(i);
path->SetNextNode(nextNode);
}

View File

@ -218,26 +218,26 @@ WordLattice::CreateTranslationOptionCollection() const
std::ostream& operator<<(std::ostream &out, const WordLattice &obj)
{
out << "next_nodes=";
for (size_t i = 0; i < obj.next_nodes.size(); ++i) {
out << i << ":";
out << "next_nodes=";
for (size_t i = 0; i < obj.next_nodes.size(); ++i) {
out << i << ":";
const std::vector<size_t> &inner = obj.next_nodes[i];
for (size_t j = 0; j < inner.size(); ++j) {
out << inner[j] << " ";
}
}
const std::vector<size_t> &inner = obj.next_nodes[i];
for (size_t j = 0; j < inner.size(); ++j) {
out << inner[j] << " ";
}
}
out << "distances=";
for (size_t i = 0; i < obj.distances.size(); ++i) {
out << i << ":";
out << "distances=";
for (size_t i = 0; i < obj.distances.size(); ++i) {
out << i << ":";
const std::vector<int> &inner = obj.distances[i];
for (size_t j = 0; j < inner.size(); ++j) {
out << inner[j] << " ";
}
}
return out;
const std::vector<int> &inner = obj.distances[i];
for (size_t j = 0; j < inner.size(); ++j) {
out << inner[j] << " ";
}
}
return out;
}
} // namespace

View File

@ -42,8 +42,9 @@ public:
*/
void GetAsEdgeMatrix(std::vector<std::vector<bool> >& edges) const;
const std::vector<size_t> &GetNextNodes(size_t pos) const
{ return next_nodes[pos]; }
const std::vector<size_t> &GetNextNodes(size_t pos) const {
return next_nodes[pos];
}
TranslationOptionCollection *CreateTranslationOptionCollection() const;
};