diff options
author | Phil Williams <philip.williams@mac.com> | 2014-11-04 16:13:56 +0300 |
---|---|---|
committer | Phil Williams <philip.williams@mac.com> | 2014-11-04 16:13:56 +0300 |
commit | 5240c430cec0f78b4f14abd8b86da3764fea842c (patch) | |
tree | 3f37b70417a920a25c425ad025348b6115204122 /moses/AlignmentInfo.cpp | |
parent | e0b3105fc055982b8d38783d7d016535ff861718 (diff) |
Merge s2t branch
This adds a new string-to-tree decoder, which can be enabled with the -s2t
option. It's intended to be faster and simpler than the generic chart
decoder, and is designed to support lattice input (still WIP). For a en-de
system trained on WMT14 data, it's approximately 40% faster in practice.
For background information, see the decoding section of the EMNLP tutorial
on syntax-based MT:
http://www.emnlp2014.org/tutorials/5_notes.pdf
Some features are not implemented yet, including support for internal tree
structure and soft source-syntactic constraints.
Diffstat (limited to 'moses/AlignmentInfo.cpp')
-rw-r--r-- | moses/AlignmentInfo.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/moses/AlignmentInfo.cpp b/moses/AlignmentInfo.cpp index ddb8adb47..b059a9ffd 100644 --- a/moses/AlignmentInfo.cpp +++ b/moses/AlignmentInfo.cpp @@ -29,7 +29,7 @@ namespace Moses AlignmentInfo::AlignmentInfo(const std::set<std::pair<size_t,size_t> > &pairs) : m_collection(pairs) { - BuildNonTermIndexMap(); + BuildNonTermIndexMaps(); } AlignmentInfo::AlignmentInfo(const std::vector<unsigned char> &aln) @@ -37,10 +37,10 @@ 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(); + BuildNonTermIndexMaps(); } -void AlignmentInfo::BuildNonTermIndexMap() +void AlignmentInfo::BuildNonTermIndexMaps() { if (m_collection.empty()) { return; @@ -53,14 +53,17 @@ void AlignmentInfo::BuildNonTermIndexMap() } } m_nonTermIndexMap.resize(maxIndex+1, NOT_FOUND); + m_nonTermIndexMap2.resize(maxIndex+1, NOT_FOUND); size_t i = 0; for (p = begin(); p != end(); ++p) { if (m_nonTermIndexMap[p->second] != NOT_FOUND) { // 1-to-many. Definitely a set of terminals. Don't bother storing 1-to-1 index map m_nonTermIndexMap.clear(); + m_nonTermIndexMap2.clear(); return; } m_nonTermIndexMap[p->second] = i++; + m_nonTermIndexMap2[p->second] = p->first; } } |