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:
authorMichael Denkowski <mdenkows@amazon.com>2016-08-08 17:33:24 +0300
committerMichael Denkowski <mdenkows@amazon.com>2016-08-12 13:05:12 +0300
commitae1e51d81ad450f7ee497386eea16ebe3792f68b (patch)
treebaa538edd1b5b92bb7e08e3ece5a1face44483d5 /moses/TargetPhrase.cpp
parentd29916bbb3973b18acd80b1ef19841399f7247b0 (diff)
Support storing coordinates of target phrase
- Keep track of named spaces in StaticData - Adding coords to phrases implemented for Mmsapt
Diffstat (limited to 'moses/TargetPhrase.cpp')
-rw-r--r--moses/TargetPhrase.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/moses/TargetPhrase.cpp b/moses/TargetPhrase.cpp
index 89575c462..35a139917 100644
--- a/moses/TargetPhrase.cpp
+++ b/moses/TargetPhrase.cpp
@@ -333,6 +333,29 @@ SetExtraScores(FeatureFunction const* ff,
m_cached_scores[ff] = s;
}
+vector<vector<float> const*> const&
+TargetPhrase::
+GetCoordList(size_t const spaceID) const
+{
+ UTIL_THROW_IF2(!m_cached_coord,
+ "No coordinates known for target phrase");
+ CoordCache_t::const_iterator m = m_cached_coord->find(spaceID);
+ UTIL_THROW_IF2(m == m_cached_coord->end(),
+ "No coordinates known in given space for target phrase");
+ return m->second;
+}
+
+void
+TargetPhrase::
+PushCoord(size_t const spaceID,
+ vector<float> const* coord)
+{
+ if (!m_cached_coord) {
+ m_cached_coord.reset(new CoordCache_t);
+ }
+ vector<vector<float> const *>& coordList = (*m_cached_coord)[spaceID];
+ coordList.push_back(coord);
+}
void TargetPhrase::SetProperties(const StringPiece &str)
{