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
path: root/moses/FF
diff options
context:
space:
mode:
authorHieu Hoang <hieuhoang@gmail.com>2015-10-16 15:53:33 +0300
committerHieu Hoang <hieuhoang@gmail.com>2015-10-16 15:53:33 +0300
commit786258cb288e0711a2614bfd36d5ec83353ab5c2 (patch)
treefd7d35c8d21552c9c56ea0b5de98495ab734d5ba /moses/FF
parentb9dcb55be22f9a5d229b817827d0ee02c82d311e (diff)
beautify
Diffstat (limited to 'moses/FF')
-rw-r--r--moses/FF/BleuScoreFeature.cpp8
-rw-r--r--moses/FF/ConstrainedDecoding.cpp4
-rw-r--r--moses/FF/ControlRecombination.cpp19
-rw-r--r--moses/FF/CoveredReferenceFeature.cpp2
-rw-r--r--moses/FF/DistortionScoreProducer.cpp10
-rw-r--r--moses/FF/FFState.h10
-rw-r--r--moses/FF/InternalTree.h5
-rw-r--r--moses/FF/LexicalReordering/LexicalReorderingState.cpp25
-rw-r--r--moses/FF/OSM-Feature/osmHyp.cpp8
-rw-r--r--moses/FF/PhraseBoundaryFeature.cpp3
-rw-r--r--moses/FF/PhraseOrientationFeature.cpp2
-rw-r--r--moses/FF/SkeletonStatefulFF.h5
-rw-r--r--moses/FF/TargetNgramFeature.cpp30
-rw-r--r--moses/FF/TargetNgramFeature.h54
14 files changed, 88 insertions, 97 deletions
diff --git a/moses/FF/BleuScoreFeature.cpp b/moses/FF/BleuScoreFeature.cpp
index d5e1a1f10..093af9ce0 100644
--- a/moses/FF/BleuScoreFeature.cpp
+++ b/moses/FF/BleuScoreFeature.cpp
@@ -52,7 +52,7 @@ int BleuScoreState::Compare(const FFState& o) const
size_t BleuScoreState::hash() const
{
if (StaticData::Instance().IsSyntax())
- return 0;
+ return 0;
size_t ret = hash_value(m_words);
return ret;
@@ -61,15 +61,15 @@ size_t BleuScoreState::hash() const
bool BleuScoreState::operator==(const FFState& o) const
{
if (&o == this)
- return true;
+ return true;
if (StaticData::Instance().IsSyntax())
- return true;
+ return true;
const BleuScoreState& other = static_cast<const BleuScoreState&>(o);
int c = m_words.Compare(other.m_words);
if (c == 0)
- return true;
+ return true;
return false;
}
diff --git a/moses/FF/ConstrainedDecoding.cpp b/moses/FF/ConstrainedDecoding.cpp
index 16605c8a7..cd60d93b3 100644
--- a/moses/FF/ConstrainedDecoding.cpp
+++ b/moses/FF/ConstrainedDecoding.cpp
@@ -31,8 +31,8 @@ int ConstrainedDecodingState::Compare(const FFState& other) const
size_t ConstrainedDecodingState::hash() const
{
- size_t ret = hash_value(m_outputPhrase);
- return ret;
+ size_t ret = hash_value(m_outputPhrase);
+ return ret;
}
bool ConstrainedDecodingState::operator==(const FFState& other) const
diff --git a/moses/FF/ControlRecombination.cpp b/moses/FF/ControlRecombination.cpp
index 774446c7b..3ed4df36b 100644
--- a/moses/FF/ControlRecombination.cpp
+++ b/moses/FF/ControlRecombination.cpp
@@ -52,11 +52,10 @@ size_t ControlRecombinationState::hash() const
{
size_t ret;
if (m_ff.GetType() == SameOutput) {
- ret = hash_value(m_outputPhrase);
- }
- else {
+ ret = hash_value(m_outputPhrase);
+ } else {
// compare hypo address. Won't be equal unless they're actually the same hypo
- ret = (size_t) m_hypo;
+ ret = (size_t) m_hypo;
}
return ret;
}
@@ -66,13 +65,13 @@ bool ControlRecombinationState::operator==(const FFState& other) const
const ControlRecombinationState &otherFF = static_cast<const ControlRecombinationState&>(other);
if (m_ff.GetType() == SameOutput) {
- int ret = m_outputPhrase.Compare(otherFF.m_outputPhrase);
- return ret == 0;
+ int ret = m_outputPhrase.Compare(otherFF.m_outputPhrase);
+ return ret == 0;
} else {
- // compare hypo address. Won't be equal unless they're actually the same hypo
- if (m_hypo == otherFF.m_hypo)
- return true;
- return (m_hypo == otherFF.m_hypo);
+ // compare hypo address. Won't be equal unless they're actually the same hypo
+ if (m_hypo == otherFF.m_hypo)
+ return true;
+ return (m_hypo == otherFF.m_hypo);
}
}
diff --git a/moses/FF/CoveredReferenceFeature.cpp b/moses/FF/CoveredReferenceFeature.cpp
index 3ad93c2f0..7f2d2017a 100644
--- a/moses/FF/CoveredReferenceFeature.cpp
+++ b/moses/FF/CoveredReferenceFeature.cpp
@@ -44,7 +44,7 @@ int CoveredReferenceState::Compare(const FFState& other) const
size_t CoveredReferenceState::hash() const
{
- UTIL_THROW2("TODO:Haven't figure this out yet");
+ UTIL_THROW2("TODO:Haven't figure this out yet");
}
bool CoveredReferenceState::operator==(const FFState& other) const
diff --git a/moses/FF/DistortionScoreProducer.cpp b/moses/FF/DistortionScoreProducer.cpp
index be0684fc6..9b696e9ce 100644
--- a/moses/FF/DistortionScoreProducer.cpp
+++ b/moses/FF/DistortionScoreProducer.cpp
@@ -21,15 +21,13 @@ struct DistortionState_traditional : public FFState {
return 0;
}
- size_t hash() const
- {
- return range.GetEndPos();
+ size_t hash() const {
+ return range.GetEndPos();
}
- virtual bool operator==(const FFState& other) const
- {
+ virtual bool operator==(const FFState& other) const {
const DistortionState_traditional& o =
static_cast<const DistortionState_traditional&>(other);
- return range.GetEndPos() == o.range.GetEndPos();
+ return range.GetEndPos() == o.range.GetEndPos();
}
};
diff --git a/moses/FF/FFState.h b/moses/FF/FFState.h
index 1b20cf68e..271dce377 100644
--- a/moses/FF/FFState.h
+++ b/moses/FF/FFState.h
@@ -16,9 +16,8 @@ public:
virtual size_t hash() const = 0;
virtual bool operator==(const FFState& other) const = 0;
- virtual bool operator!=(const FFState& other) const
- {
- return !(*this == other);
+ virtual bool operator!=(const FFState& other) const {
+ return !(*this == other);
}
};
@@ -31,11 +30,10 @@ public:
}
virtual size_t hash() const {
- return 0;
+ return 0;
}
- virtual bool operator==(const FFState& other) const
- {
+ virtual bool operator==(const FFState& other) const {
return true;
}
diff --git a/moses/FF/InternalTree.h b/moses/FF/InternalTree.h
index cab6951b2..1dc7973f5 100644
--- a/moses/FF/InternalTree.h
+++ b/moses/FF/InternalTree.h
@@ -146,10 +146,9 @@ public:
}
virtual size_t hash() const {
- return 0;
+ return 0;
}
- virtual bool operator==(const FFState& other) const
- {
+ virtual bool operator==(const FFState& other) const {
return true;
}
diff --git a/moses/FF/LexicalReordering/LexicalReorderingState.cpp b/moses/FF/LexicalReordering/LexicalReorderingState.cpp
index c6285063d..60d7a670c 100644
--- a/moses/FF/LexicalReordering/LexicalReorderingState.cpp
+++ b/moses/FF/LexicalReordering/LexicalReorderingState.cpp
@@ -346,15 +346,14 @@ bool PhraseBasedReorderingState::operator==(const FFState& o) const
const PhraseBasedReorderingState &other = static_cast<const PhraseBasedReorderingState&>(o);
if (m_prevRange == other.m_prevRange) {
- if (m_direction == LRModel::Forward) {
- int compareScore = ComparePrevScores(other.m_prevOption);
- return compareScore == 0;
- } else {
- return true;
- }
- }
- else {
- return false;
+ if (m_direction == LRModel::Forward) {
+ int compareScore = ComparePrevScores(other.m_prevOption);
+ return compareScore == 0;
+ } else {
+ return true;
+ }
+ } else {
+ return false;
}
}
@@ -383,7 +382,7 @@ int
BidirectionalReorderingState::
Compare(FFState const& o) const
{
- /*
+ /*
if (&o == this) return 0;
BidirectionalReorderingState const &other
@@ -456,7 +455,7 @@ size_t HReorderingBackwardState::hash() const
bool HReorderingBackwardState::operator==(const FFState& o) const
{
const HReorderingBackwardState& other
- = static_cast<const HReorderingBackwardState&>(o);
+ = static_cast<const HReorderingBackwardState&>(o);
bool ret = m_reoStack == other.m_reoStack;
return ret;
}
@@ -527,8 +526,8 @@ bool HReorderingForwardState::operator==(const FFState& o) const
= static_cast<HReorderingForwardState const&>(o);
int compareScores = ((m_prevRange == other.m_prevRange)
- ? ComparePrevScores(other.m_prevOption)
- : (m_prevRange < other.m_prevRange) ? -1 : 1);
+ ? ComparePrevScores(other.m_prevOption)
+ : (m_prevRange < other.m_prevRange) ? -1 : 1);
return compareScores == 0;
}
diff --git a/moses/FF/OSM-Feature/osmHyp.cpp b/moses/FF/OSM-Feature/osmHyp.cpp
index e8913bafb..c012fdf4c 100644
--- a/moses/FF/OSM-Feature/osmHyp.cpp
+++ b/moses/FF/OSM-Feature/osmHyp.cpp
@@ -54,13 +54,13 @@ bool osmState::operator==(const FFState& otherBase) const
{
const osmState &other = static_cast<const osmState&>(otherBase);
if (j != other.j)
- return false;
+ return false;
if (E != other.E)
- return false;
+ return false;
if (gap != other.gap)
- return false;
+ return false;
if (lmState.length != other.lmState.length)
- return false;
+ return false;
return true;
}
diff --git a/moses/FF/PhraseBoundaryFeature.cpp b/moses/FF/PhraseBoundaryFeature.cpp
index 67cc93605..893db9a90 100644
--- a/moses/FF/PhraseBoundaryFeature.cpp
+++ b/moses/FF/PhraseBoundaryFeature.cpp
@@ -17,7 +17,8 @@ int PhraseBoundaryState::Compare(const FFState& other) const
return Word::Compare(*m_sourceWord,*(rhs.m_sourceWord));
}
-size_t PhraseBoundaryState::hash() const {
+size_t PhraseBoundaryState::hash() const
+{
size_t ret = hash_value(*m_targetWord);
boost::hash_combine(ret, hash_value(*m_sourceWord));
diff --git a/moses/FF/PhraseOrientationFeature.cpp b/moses/FF/PhraseOrientationFeature.cpp
index f189dc2d2..f20663459 100644
--- a/moses/FF/PhraseOrientationFeature.cpp
+++ b/moses/FF/PhraseOrientationFeature.cpp
@@ -23,7 +23,7 @@ namespace Moses
{
size_t PhraseOrientationFeatureState::hash() const
{
- UTIL_THROW2("TODO:Haven't figure this out yet");
+ UTIL_THROW2("TODO:Haven't figure this out yet");
}
bool PhraseOrientationFeatureState::operator==(const FFState& other) const
diff --git a/moses/FF/SkeletonStatefulFF.h b/moses/FF/SkeletonStatefulFF.h
index d51172b32..c9b297ecf 100644
--- a/moses/FF/SkeletonStatefulFF.h
+++ b/moses/FF/SkeletonStatefulFF.h
@@ -18,10 +18,9 @@ public:
int Compare(const FFState& other) const;
virtual size_t hash() const {
- return (size_t) m_targetLen;
+ return (size_t) m_targetLen;
}
- virtual bool operator==(const FFState& o) const
- {
+ virtual bool operator==(const FFState& o) const {
const SkeletonState& other = static_cast<const SkeletonState&>(o);
return m_targetLen == other.m_targetLen;
}
diff --git a/moses/FF/TargetNgramFeature.cpp b/moses/FF/TargetNgramFeature.cpp
index 744c6604a..13994e49d 100644
--- a/moses/FF/TargetNgramFeature.cpp
+++ b/moses/FF/TargetNgramFeature.cpp
@@ -48,23 +48,23 @@ bool TargetNgramState::operator==(const FFState& other) const
const TargetNgramState& rhs = dynamic_cast<const TargetNgramState&>(other);
int result;
if (m_words.size() == rhs.m_words.size()) {
- for (size_t i = 0; i < m_words.size(); ++i) {
- result = Word::Compare(m_words[i],rhs.m_words[i]);
- if (result != 0) return false;
- }
- return true;
+ for (size_t i = 0; i < m_words.size(); ++i) {
+ result = Word::Compare(m_words[i],rhs.m_words[i]);
+ if (result != 0) return false;
+ }
+ return true;
} else if (m_words.size() < rhs.m_words.size()) {
- for (size_t i = 0; i < m_words.size(); ++i) {
- result = Word::Compare(m_words[i],rhs.m_words[i]);
- if (result != 0) return false;
- }
- return true;
+ for (size_t i = 0; i < m_words.size(); ++i) {
+ result = Word::Compare(m_words[i],rhs.m_words[i]);
+ if (result != 0) return false;
+ }
+ return true;
} else {
- for (size_t i = 0; i < rhs.m_words.size(); ++i) {
- result = Word::Compare(m_words[i],rhs.m_words[i]);
- if (result != 0) return false;
- }
- return true;
+ for (size_t i = 0; i < rhs.m_words.size(); ++i) {
+ result = Word::Compare(m_words[i],rhs.m_words[i]);
+ if (result != 0) return false;
+ }
+ return true;
}
}
diff --git a/moses/FF/TargetNgramFeature.h b/moses/FF/TargetNgramFeature.h
index dd6c9a45f..1d31c4b30 100644
--- a/moses/FF/TargetNgramFeature.h
+++ b/moses/FF/TargetNgramFeature.h
@@ -177,8 +177,7 @@ public:
return 0;
}
- size_t hash() const
- {
+ size_t hash() const {
// not sure if this is correct
size_t ret;
@@ -186,35 +185,34 @@ public:
boost::hash_combine(ret, m_endPos);
boost::hash_combine(ret, m_inputSize);
- // prefix
- if (m_startPos > 0) { // not for "<s> ..."
- boost::hash_combine(ret, hash_value(GetPrefix()));
- }
+ // prefix
+ if (m_startPos > 0) { // not for "<s> ..."
+ boost::hash_combine(ret, hash_value(GetPrefix()));
+ }
- if (m_endPos < m_inputSize - 1) { // not for "... </s>"
- boost::hash_combine(ret, hash_value(GetSuffix()));
- }
+ if (m_endPos < m_inputSize - 1) { // not for "... </s>"
+ boost::hash_combine(ret, hash_value(GetSuffix()));
+ }
- return ret;
+ return ret;
}
- virtual bool operator==(const FFState& o) const
- {
- const TargetNgramChartState &other =
- static_cast<const TargetNgramChartState &>( o );
-
- // prefix
- if (m_startPos > 0) { // not for "<s> ..."
- int ret = GetPrefix().Compare(other.GetPrefix());
- if (ret != 0)
- return false;
- }
-
- if (m_endPos < m_inputSize - 1) { // not for "... </s>"
- int ret = GetSuffix().Compare(other.GetSuffix());
- if (ret != 0)
- return false;
- }
- return true;
+ virtual bool operator==(const FFState& o) const {
+ const TargetNgramChartState &other =
+ static_cast<const TargetNgramChartState &>( o );
+
+ // prefix
+ if (m_startPos > 0) { // not for "<s> ..."
+ int ret = GetPrefix().Compare(other.GetPrefix());
+ if (ret != 0)
+ return false;
+ }
+
+ if (m_endPos < m_inputSize - 1) { // not for "... </s>"
+ int ret = GetSuffix().Compare(other.GetSuffix());
+ if (ret != 0)
+ return false;
+ }
+ return true;
}
};