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:
authorMatthias Huck <huck@i6.informatik.rwth-aachen.de>2015-03-11 01:02:21 +0300
committerMatthias Huck <huck@i6.informatik.rwth-aachen.de>2015-03-11 01:02:21 +0300
commit534a894c0bc583039f98cfe0186e4bf830f03afb (patch)
tree95899ffd1ec614a2b2d3381755a7ece8421f31fa /phrase-extract
parent01bed83cf9e5418a9b242a3feeb12a9b2d2b02e2 (diff)
glue rules with stripped BitPar labels
Diffstat (limited to 'phrase-extract')
-rw-r--r--phrase-extract/extract-ghkm/ExtractGHKM.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/phrase-extract/extract-ghkm/ExtractGHKM.cpp b/phrase-extract/extract-ghkm/ExtractGHKM.cpp
index 1394707a7..a9a0bffc2 100644
--- a/phrase-extract/extract-ghkm/ExtractGHKM.cpp
+++ b/phrase-extract/extract-ghkm/ExtractGHKM.cpp
@@ -931,11 +931,18 @@ void ExtractGHKM::StripBitParLabels(
}
for (std::map<std::string,int>::const_iterator it=topLabelSet.begin();
it!=topLabelSet.end(); ++it) {
- std::map<std::string, int>::iterator found=outTopLabelSet.find(it->first);
+ size_t pos = it->first.find('-');
+ std::string stripped;
+ if (pos == std::string::npos) {
+ stripped = it->first;
+ } else {
+ stripped = it->first.substr(0,pos);
+ }
+ std::map<std::string, int>::iterator found=outTopLabelSet.find(stripped);
if (found != outTopLabelSet.end()) {
found->second += it->second;
} else {
- outTopLabelSet.insert(std::pair<std::string,int>(it->first,it->second));
+ outTopLabelSet.insert(std::pair<std::string,int>(stripped,it->second));
}
}
}