Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-19 20:11:33 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-19 20:11:33 +0300
commit4e691e496903dab2d04cadd3488a77118cc230bd (patch)
tree0572c67b8ceefa736077f844276a742e96d3ddc1 /moses/HypothesisStackCubePruning.cpp
parent411d0ae0032af1672311b79289d4aeabb68b6dcb (diff)
reuse bitmap key for BitmapContainer
Diffstat (limited to 'moses/HypothesisStackCubePruning.cpp')
-rw-r--r--moses/HypothesisStackCubePruning.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/moses/HypothesisStackCubePruning.cpp b/moses/HypothesisStackCubePruning.cpp
index f83c0d234..caec856a7 100644
--- a/moses/HypothesisStackCubePruning.cpp
+++ b/moses/HypothesisStackCubePruning.cpp
@@ -48,6 +48,7 @@ void HypothesisStackCubePruning::RemoveAll()
// delete all bitmap accessors;
_BMType::iterator iter;
for (iter = m_bitmapAccessor.begin(); iter != m_bitmapAccessor.end(); ++iter) {
+ delete iter->first;
delete iter->second;
}
}
@@ -149,7 +150,8 @@ void HypothesisStackCubePruning::AddInitial(Hypothesis *hypo)
"Should have added hypothesis " << *hypo);
const WordsBitmap &bitmap = hypo->GetWordsBitmap();
- m_bitmapAccessor[bitmap] = new BitmapContainer(bitmap, *this, m_deterministic);
+ const WordsBitmap *newBM = new WordsBitmap(bitmap);
+ m_bitmapAccessor[newBM] = new BitmapContainer(*newBM, *this, m_deterministic);
}
void HypothesisStackCubePruning::PruneToSize(size_t newSize)
@@ -255,12 +257,13 @@ void HypothesisStackCubePruning::SetBitmapAccessor(const WordsBitmap &newBitmap
, const SquareMatrix &futureScore
, const TranslationOptionList &transOptList)
{
- _BMType::iterator bcExists = m_bitmapAccessor.find(newBitmap);
+ _BMType::iterator bcExists = m_bitmapAccessor.find(&newBitmap);
BitmapContainer *bmContainer;
if (bcExists == m_bitmapAccessor.end()) {
- bmContainer = new BitmapContainer(newBitmap, stack, m_deterministic);
- m_bitmapAccessor[newBitmap] = bmContainer;
+ WordsBitmap *newBM = new WordsBitmap(newBitmap);
+ bmContainer = new BitmapContainer(*newBM, stack, m_deterministic);
+ m_bitmapAccessor[newBM] = bmContainer;
} else {
bmContainer = bcExists->second;
}
@@ -297,7 +300,7 @@ HypothesisStackCubePruning::AddHypothesesToBitmapContainers()
for (iter = m_hypos.begin() ; iter != m_hypos.end() ; ++iter) {
Hypothesis *h = *iter;
const WordsBitmap &bitmap = h->GetWordsBitmap();
- BitmapContainer *container = m_bitmapAccessor[bitmap];
+ BitmapContainer *container = m_bitmapAccessor[&bitmap];
container->AddHypothesis(h);
}
}