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:
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));
}
}
}