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:
authorAles Tamchyna <tamchyna@ufal.mff.cuni.cz>2015-01-08 16:53:46 +0300
committerAles Tamchyna <tamchyna@ufal.mff.cuni.cz>2015-01-08 16:53:46 +0300
commit104d43b23f400b44029918a136182af044017e6c (patch)
tree22001c00b77d023907c1a3e0de12b37a8821f13b /moses/AlignmentInfo.cpp
parente53812b98c61d867146db1c7749babdd96a3fd1e (diff)
towards training
Diffstat (limited to 'moses/AlignmentInfo.cpp')
-rw-r--r--moses/AlignmentInfo.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/moses/AlignmentInfo.cpp b/moses/AlignmentInfo.cpp
index b059a9ffd..97efc25eb 100644
--- a/moses/AlignmentInfo.cpp
+++ b/moses/AlignmentInfo.cpp
@@ -21,6 +21,7 @@
#include "AlignmentInfo.h"
#include "TypeDef.h"
#include "StaticData.h"
+#include "Util.h"
#include "util/exception.hh"
namespace Moses
@@ -40,6 +41,17 @@ AlignmentInfo::AlignmentInfo(const std::vector<unsigned char> &aln)
BuildNonTermIndexMaps();
}
+AlignmentInfo::AlignmentInfo(const std::string &str)
+{
+ std::vector<std::string> points = Tokenize(str, " ");
+ std::vector<std::string>::const_iterator iter;
+ for (iter = points.begin(); iter != points.end(); iter++) {
+ std::vector<size_t> point = Tokenize<size_t>(*iter, "-");
+ UTIL_THROW_IF2(point.size() != 2, "Bad format of word alignment point: " << *iter);
+ Add(point[0], point[1]);
+ }
+}
+
void AlignmentInfo::BuildNonTermIndexMaps()
{
if (m_collection.empty()) {