diff options
author | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-16 20:44:29 +0400 |
---|---|---|
committer | Hieu Hoang <hieuhoang@gmail.com> | 2012-11-16 20:44:29 +0400 |
commit | 057793fc60e782271220493f05c65e43bdb68456 (patch) | |
tree | c19d5c6a70c7f90b6dd5acea8614aecc6d9da644 /moses/AlignmentInfo.cpp | |
parent | 7d74673fbe4ba125fa2c18e78b7a4614539fb4d8 (diff) |
output alignments into file down. Alignments for n-best todo
Diffstat (limited to 'moses/AlignmentInfo.cpp')
-rw-r--r-- | moses/AlignmentInfo.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/moses/AlignmentInfo.cpp b/moses/AlignmentInfo.cpp index 4dc0497e3..a75c5f58d 100644 --- a/moses/AlignmentInfo.cpp +++ b/moses/AlignmentInfo.cpp @@ -17,6 +17,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ***********************************************************************/ #include <algorithm> +#include <set> #include "util/check.hh" #include "AlignmentInfo.h" #include "TypeDef.h" @@ -92,7 +93,21 @@ std::vector< const std::pair<size_t,size_t>* > AlignmentInfo::GetSortedAlignment return ret; } - + +std::vector<size_t> AlignmentInfo::GetSourceIndex2PosMap() const +{ + std::set<size_t> sourcePoses; + + CollType::const_iterator iter; + for (iter = m_collection.begin(); iter != m_collection.end(); ++iter) { + size_t sourcePos = iter->first; + sourcePoses.insert(sourcePos); + } + + std::vector<size_t> ret(sourcePoses.begin(), sourcePoses.end()); + return ret; +} + std::ostream& operator<<(std::ostream &out, const AlignmentInfo &alignmentInfo) { AlignmentInfo::const_iterator iter; |