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:
authorUlrich Germann <ugermann@inf.ed.ac.uk>2014-10-07 21:08:31 +0400
committerUlrich Germann <ugermann@inf.ed.ac.uk>2014-10-07 21:08:31 +0400
commit576931b088fa71f14ed7316ff6db165e1ea3c9ea (patch)
tree1749946dad88be13c33b4adf7f7afde70f5ab4b1 /moses/AlignmentInfo.cpp
parent26666986f33985b13e205ae9bac115385ce0b407 (diff)
Mmsapt now adds word alignment info to target phrases.
Diffstat (limited to 'moses/AlignmentInfo.cpp')
-rw-r--r--moses/AlignmentInfo.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/moses/AlignmentInfo.cpp b/moses/AlignmentInfo.cpp
index ed317a764..ddb8adb47 100644
--- a/moses/AlignmentInfo.cpp
+++ b/moses/AlignmentInfo.cpp
@@ -25,12 +25,21 @@
namespace Moses
{
+
AlignmentInfo::AlignmentInfo(const std::set<std::pair<size_t,size_t> > &pairs)
: m_collection(pairs)
{
BuildNonTermIndexMap();
}
+AlignmentInfo::AlignmentInfo(const std::vector<unsigned char> &aln)
+{
+ assert(aln.size()%2==0);
+ for (size_t i = 0; i < aln.size(); i+= 2)
+ m_collection.insert(std::make_pair(size_t(aln[i]),size_t(aln[i+1])));
+ BuildNonTermIndexMap();
+}
+
void AlignmentInfo::BuildNonTermIndexMap()
{
if (m_collection.empty()) {