mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-08-16 23:10:31 +03:00
beautify
This commit is contained in:
parent
20e3827ed2
commit
692d4c3f32
@ -48,8 +48,8 @@ Bitmap::Bitmap(size_t size, const std::vector<bool>& initializer)
|
|||||||
//! Create Bitmap of length size and initialise.
|
//! Create Bitmap of length size and initialise.
|
||||||
Bitmap::Bitmap(size_t size)
|
Bitmap::Bitmap(size_t size)
|
||||||
:m_bitmap(size, false)
|
:m_bitmap(size, false)
|
||||||
,m_firstGap(0)
|
,m_firstGap(0)
|
||||||
,m_numWordsCovered(0)
|
,m_numWordsCovered(0)
|
||||||
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -63,11 +63,11 @@ Bitmap::Bitmap(const Bitmap ©)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Bitmap::Bitmap(const Bitmap ©, const Range &range)
|
Bitmap::Bitmap(const Bitmap ©, const Range &range)
|
||||||
:m_bitmap(copy.m_bitmap)
|
:m_bitmap(copy.m_bitmap)
|
||||||
,m_firstGap(copy.m_firstGap)
|
,m_firstGap(copy.m_firstGap)
|
||||||
,m_numWordsCovered(copy.m_numWordsCovered)
|
,m_numWordsCovered(copy.m_numWordsCovered)
|
||||||
{
|
{
|
||||||
SetValueNonOverlap(range);
|
SetValueNonOverlap(range);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for unordered_set in stack
|
// for unordered_set in stack
|
||||||
|
@ -83,15 +83,15 @@ private:
|
|||||||
//! set value between 2 positions, inclusive
|
//! set value between 2 positions, inclusive
|
||||||
void
|
void
|
||||||
SetValueNonOverlap(Range const& range) {
|
SetValueNonOverlap(Range const& range) {
|
||||||
size_t startPos = range.GetStartPos();
|
size_t startPos = range.GetStartPos();
|
||||||
size_t endPos = range.GetEndPos();
|
size_t endPos = range.GetEndPos();
|
||||||
|
|
||||||
for(size_t pos = startPos ; pos <= endPos ; pos++) {
|
for(size_t pos = startPos ; pos <= endPos ; pos++) {
|
||||||
m_bitmap[pos] = true;
|
m_bitmap[pos] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_numWordsCovered += range.GetNumWordsCovered();
|
m_numWordsCovered += range.GetNumWordsCovered();
|
||||||
UpdateFirstGap(startPos, endPos, true);
|
UpdateFirstGap(startPos, endPos, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -148,17 +148,15 @@ public:
|
|||||||
void SetValue( size_t pos, bool value ) {
|
void SetValue( size_t pos, bool value ) {
|
||||||
bool origValue = m_bitmap[pos];
|
bool origValue = m_bitmap[pos];
|
||||||
if (origValue == value) {
|
if (origValue == value) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
} else {
|
||||||
else {
|
m_bitmap[pos] = value;
|
||||||
m_bitmap[pos] = value;
|
UpdateFirstGap(pos, pos, value);
|
||||||
UpdateFirstGap(pos, pos, value);
|
if (value) {
|
||||||
if (value) {
|
++m_numWordsCovered;
|
||||||
++m_numWordsCovered;
|
} else {
|
||||||
}
|
--m_numWordsCovered;
|
||||||
else {
|
}
|
||||||
--m_numWordsCovered;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +428,7 @@ inline float CalcTranslationScore(const std::vector<float> &probVector,
|
|||||||
out << *this; \
|
out << *this; \
|
||||||
return out.str(); \
|
return out.str(); \
|
||||||
} \
|
} \
|
||||||
|
|
||||||
//! delete and remove every element of a collection object such as set, list etc
|
//! delete and remove every element of a collection object such as set, list etc
|
||||||
template<class COLL>
|
template<class COLL>
|
||||||
void RemoveAllInColl(COLL &coll)
|
void RemoveAllInColl(COLL &coll)
|
||||||
|
Loading…
Reference in New Issue
Block a user