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>2016-03-23 16:57:25 +0300
committerHieu Hoang <hieuhoang@gmail.com>2016-03-23 16:57:25 +0300
commit105faa5673567f8ed4ffee5857b59715511a6a2d (patch)
tree5fb79cd551fd0e3583afa66bcb53199cb281abdc /moses/FF
parentba9a9b3ef9635ce70a20d7a6cadd6972c2417b91 (diff)
separate BidirectionalReorderingState into its own file
Diffstat (limited to 'moses/FF')
-rw-r--r--moses/FF/LexicalReordering/BidirectionalReorderingState.cpp38
-rw-r--r--moses/FF/LexicalReordering/BidirectionalReorderingState.h38
-rw-r--r--moses/FF/LexicalReordering/LexicalReorderingState.cpp33
-rw-r--r--moses/FF/LexicalReordering/LexicalReorderingState.h30
4 files changed, 77 insertions, 62 deletions
diff --git a/moses/FF/LexicalReordering/BidirectionalReorderingState.cpp b/moses/FF/LexicalReordering/BidirectionalReorderingState.cpp
new file mode 100644
index 000000000..22f550ba8
--- /dev/null
+++ b/moses/FF/LexicalReordering/BidirectionalReorderingState.cpp
@@ -0,0 +1,38 @@
+#include "BidirectionalReorderingState.h"
+
+namespace Moses
+{
+
+///////////////////////////
+//BidirectionalReorderingState
+
+size_t BidirectionalReorderingState::hash() const
+{
+ size_t ret = m_backward->hash();
+ boost::hash_combine(ret, m_forward->hash());
+ return ret;
+}
+
+bool BidirectionalReorderingState::operator==(const FFState& o) const
+{
+ if (&o == this) return 0;
+
+ BidirectionalReorderingState const &other
+ = static_cast<BidirectionalReorderingState const&>(o);
+
+ bool ret = (*m_backward == *other.m_backward) && (*m_forward == *other.m_forward);
+ return ret;
+}
+
+LRState*
+BidirectionalReorderingState::
+Expand(const TranslationOption& topt, const InputType& input,
+ ScoreComponentCollection* scores) const
+{
+ LRState *newbwd = m_backward->Expand(topt,input, scores);
+ LRState *newfwd = m_forward->Expand(topt, input, scores);
+ return new BidirectionalReorderingState(m_configuration, newbwd, newfwd, m_offset);
+}
+
+}
+
diff --git a/moses/FF/LexicalReordering/BidirectionalReorderingState.h b/moses/FF/LexicalReordering/BidirectionalReorderingState.h
new file mode 100644
index 000000000..7e1d52c5f
--- /dev/null
+++ b/moses/FF/LexicalReordering/BidirectionalReorderingState.h
@@ -0,0 +1,38 @@
+#pragma once
+#include "LexicalReorderingState.h"
+
+namespace Moses
+{
+
+class BidirectionalReorderingState
+ : public LRState
+{
+private:
+ const LRState *m_backward;
+ const LRState *m_forward;
+public:
+ BidirectionalReorderingState(const LRModel &config,
+ const LRState *bw,
+ const LRState *fw, size_t offset)
+ : LRState(config,
+ LRModel::Bidirectional,
+ offset)
+ , m_backward(bw)
+ , m_forward(fw)
+ { }
+
+ ~BidirectionalReorderingState() {
+ delete m_backward;
+ delete m_forward;
+ }
+
+ virtual size_t hash() const;
+ virtual bool operator==(const FFState& other) const;
+
+ LRState*
+ Expand(const TranslationOption& topt, const InputType& input,
+ ScoreComponentCollection* scores) const;
+};
+
+}
+
diff --git a/moses/FF/LexicalReordering/LexicalReorderingState.cpp b/moses/FF/LexicalReordering/LexicalReorderingState.cpp
index af793c5a2..aeb4a572e 100644
--- a/moses/FF/LexicalReordering/LexicalReorderingState.cpp
+++ b/moses/FF/LexicalReordering/LexicalReorderingState.cpp
@@ -14,6 +14,7 @@
#include "HReorderingForwardState.h"
#include "HReorderingBackwardState.h"
#include "PhraseBasedReorderingState.h"
+#include "BidirectionalReorderingState.h"
namespace Moses
{
@@ -293,37 +294,5 @@ ComparePrevScores(const TranslationOption *other) const
return 0;
}
-///////////////////////////
-//BidirectionalReorderingState
-
-size_t BidirectionalReorderingState::hash() const
-{
- size_t ret = m_backward->hash();
- boost::hash_combine(ret, m_forward->hash());
- return ret;
-}
-
-bool BidirectionalReorderingState::operator==(const FFState& o) const
-{
- if (&o == this) return 0;
-
- BidirectionalReorderingState const &other
- = static_cast<BidirectionalReorderingState const&>(o);
-
- bool ret = (*m_backward == *other.m_backward) && (*m_forward == *other.m_forward);
- return ret;
-}
-
-LRState*
-BidirectionalReorderingState::
-Expand(const TranslationOption& topt, const InputType& input,
- ScoreComponentCollection* scores) const
-{
- LRState *newbwd = m_backward->Expand(topt,input, scores);
- LRState *newfwd = m_forward->Expand(topt, input, scores);
- return new BidirectionalReorderingState(m_configuration, newbwd, newfwd, m_offset);
-}
-
-
}
diff --git a/moses/FF/LexicalReordering/LexicalReorderingState.h b/moses/FF/LexicalReordering/LexicalReorderingState.h
index 4214eeade..4a2ad2d7b 100644
--- a/moses/FF/LexicalReordering/LexicalReorderingState.h
+++ b/moses/FF/LexicalReordering/LexicalReorderingState.h
@@ -195,36 +195,6 @@ protected:
ComparePrevScores(const TranslationOption *other) const;
};
-//! @todo what is this?
-class BidirectionalReorderingState
- : public LRState
-{
-private:
- const LRState *m_backward;
- const LRState *m_forward;
-public:
- BidirectionalReorderingState(const LRModel &config,
- const LRState *bw,
- const LRState *fw, size_t offset)
- : LRState(config,
- LRModel::Bidirectional,
- offset)
- , m_backward(bw)
- , m_forward(fw)
- { }
-
- ~BidirectionalReorderingState() {
- delete m_backward;
- delete m_forward;
- }
-
- virtual size_t hash() const;
- virtual bool operator==(const FFState& other) const;
-
- LRState*
- Expand(const TranslationOption& topt, const InputType& input,
- ScoreComponentCollection* scores) const;
-};