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:
authorHieu Hoang <hieuhoang@gmail.com>2012-11-10 21:09:07 +0400
committerHieu Hoang <hieuhoang@gmail.com>2012-11-10 21:09:07 +0400
commit27a6cf2ebc2ac8b60890f3f06f2a2973ca466375 (patch)
tree71296eb01dff7210de59d883bdaac830fa2ee38a
parentbaf210f077058e54323771108eb88b7d6c852c25 (diff)
fuzzy match bug. Still not bug-free
-rw-r--r--scripts/fuzzy-match/create_xml.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/scripts/fuzzy-match/create_xml.cpp b/scripts/fuzzy-match/create_xml.cpp
index e189bb58c..48d957f2d 100644
--- a/scripts/fuzzy-match/create_xml.cpp
+++ b/scripts/fuzzy-match/create_xml.cpp
@@ -34,6 +34,7 @@ int main(int argc, char **argv)
string *input = NULL;
int count;
+ int lineCount = 1;
string inLine;
int step = 0;
@@ -91,6 +92,8 @@ int main(int argc, char **argv)
step = 0;
break;
}
+
+ ++lineCount;
}
delete input;
@@ -272,7 +275,7 @@ CreateXMLRetValues createXML(const string &source, const string &input, const st
int rule_pos_t = 0;
map<int, int> ruleAlignT;
- for (size_t t = -1 ; t < targetBitmap.size(); t++ ) {
+ for (size_t t = 0 ; t < targetBitmap.size(); t++ ) {
if (t >= 0 && targetBitmap[t]) {
ret.ruleT += targetsToks[t] + " ";
ruleAlignT[t] = rule_pos_t++;
@@ -288,18 +291,21 @@ CreateXMLRetValues createXML(const string &source, const string &input, const st
}
}
- ret.ruleAlignment;
+ ret.ruleAlignment = "";
for (map<int, int>::const_iterator iter = ruleAlignT.begin(); iter != ruleAlignT.end(); ++iter) {
int s = iter->first;
- const std::map<int, int> &targets = alignments.m_alignS2T[s];
-
- std::map<int, int>::const_iterator iter;
- for (iter = targets.begin(); iter != targets.end(); ++iter) {
- int t =iter->first;
- if (ruleAlignT.find(s) == ruleAlignT.end())
- continue;
- ret.ruleAlignment += ruleAlignS[s] + "-" + SPrint(ruleAlignT[t]) + " ";
+
+ if (s < alignments.m_alignS2T.size()) {
+ const std::map<int, int> &targets = alignments.m_alignS2T[s];
+
+ std::map<int, int>::const_iterator iter;
+ for (iter = targets.begin(); iter != targets.end(); ++iter) {
+ int t =iter->first;
+ if (ruleAlignT.find(s) == ruleAlignT.end())
+ continue;
+ ret.ruleAlignment += SPrint(ruleAlignS[s]) + "-" + SPrint(ruleAlignT[t]) + " ";
+ }
}
}