compare translation option dimension using pointers to translation option, rather than comparing the phrase. Comparinf the phrase is incorrect - need to compare LHS and possibly alignments too. Unnecessary

This commit is contained in:
Hieu Hoang 2013-12-13 17:23:39 +00:00
parent 3bd5583976
commit ff3c8c195a
3 changed files with 15 additions and 6 deletions

View File

@ -57,8 +57,13 @@ class RuleCubeItemHasher
public:
size_t operator()(const RuleCubeItem *p) const {
size_t seed = 0;
boost::hash_combine(seed, p->GetHypothesisDimensions());
boost::hash_combine(seed, p->GetTranslationDimension().GetTranslationOption().get());
const std::vector<HypothesisDimension> &hypoDim = p->GetHypothesisDimensions();
const ChartTranslationOption *transOpt = p->GetTranslationDimension().GetTranslationOption().get();
boost::hash_combine(seed, hypoDim);
boost::hash_combine(seed, transOpt);
std::cerr << seed << " ";
return seed;
}
};
@ -69,8 +74,9 @@ class RuleCubeItemEqualityPred
{
public:
bool operator()(const RuleCubeItem *p, const RuleCubeItem *q) const {
return p->GetHypothesisDimensions() == q->GetHypothesisDimensions() &&
p->GetTranslationDimension() == q->GetTranslationDimension();
bool ret = p->GetHypothesisDimensions() == q->GetHypothesisDimensions() &&
p->GetTranslationDimension() == q->GetTranslationDimension();
return ret;
}
};

View File

@ -58,11 +58,11 @@ public:
}
bool operator<(const TranslationDimension &compare) const {
return GetTranslationOption()->GetPhrase() < compare.GetTranslationOption()->GetPhrase();
return GetTranslationOption().get() < compare.GetTranslationOption().get();
}
bool operator==(const TranslationDimension &compare) const {
return GetTranslationOption()->GetPhrase() == compare.GetTranslationOption()->GetPhrase();
return GetTranslationOption().get() == compare.GetTranslationOption().get();
}
private:

View File

@ -140,6 +140,9 @@ public:
void Merge(const TargetPhrase &copy, const std::vector<FactorType>& factorVec);
bool operator< (const TargetPhrase &compare) const; // NOT IMPLEMENTED
bool operator== (const TargetPhrase &compare) const; // NOT IMPLEMENTED
TO_STRING();
};