diff options
author | Michael Denkowski <mdenkows@amazon.com> | 2016-08-08 17:33:24 +0300 |
---|---|---|
committer | Michael Denkowski <mdenkows@amazon.com> | 2016-08-12 13:05:12 +0300 |
commit | ae1e51d81ad450f7ee497386eea16ebe3792f68b (patch) | |
tree | baa538edd1b5b92bb7e08e3ece5a1face44483d5 /moses/TargetPhrase.cpp | |
parent | d29916bbb3973b18acd80b1ef19841399f7247b0 (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.cpp | 23 |
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) { |