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
path: root/mert
diff options
context:
space:
mode:
authorphikoehn <pkoehn@inf.ed.ac.uk>2013-05-17 11:37:29 +0400
committerphikoehn <pkoehn@inf.ed.ac.uk>2013-05-17 11:37:29 +0400
commit4cdffc8a891a3004a0102aa77ae26ceb91a1e881 (patch)
tree815350e8007c863a098d04689bd35177cc61569b /mert
parent13991fc88fc6184139db46aa306789d855ef54cd (diff)
fixes for sparse feature handling
Diffstat (limited to 'mert')
-rw-r--r--mert/Data.cpp2
-rw-r--r--mert/FeatureDataIterator.cpp2
-rw-r--r--mert/FeatureStats.cpp4
3 files changed, 4 insertions, 4 deletions
diff --git a/mert/Data.cpp b/mert/Data.cpp
index 3f91c1376..1efa080a2 100644
--- a/mert/Data.cpp
+++ b/mert/Data.cpp
@@ -212,7 +212,7 @@ void Data::InitFeatureMap(const string& str) {
while (!buf.empty()) {
getNextPound(buf, substr);
- // string ending with ":" are skipped, because they are the names of the features
+ // string ending with "=" are skipped, because they are the names of the features
if (!EndsWith(substr, "=")) {
stringstream ss;
ss << tmp_name << "_" << tmp_index << " ";
diff --git a/mert/FeatureDataIterator.cpp b/mert/FeatureDataIterator.cpp
index a22112bb4..471da07ee 100644
--- a/mert/FeatureDataIterator.cpp
+++ b/mert/FeatureDataIterator.cpp
@@ -89,7 +89,7 @@ void FeatureDataIterator::readNext() {
StringPiece line = m_in->ReadLine();
m_next.push_back(FeatureDataItem());
for (TokenIter<AnyCharacter, true> token(line, AnyCharacter(" \t")); token; ++token) {
- TokenIter<AnyCharacterLast,false> value(*token,AnyCharacterLast(":"));
+ TokenIter<AnyCharacterLast,false> value(*token,AnyCharacterLast("="));
if (!value) throw FileFormatException(m_in->FileName(), line.as_string());
StringPiece first = *value;
++value;
diff --git a/mert/FeatureStats.cpp b/mert/FeatureStats.cpp
index 22f62e234..242d3fbd0 100644
--- a/mert/FeatureStats.cpp
+++ b/mert/FeatureStats.cpp
@@ -220,12 +220,12 @@ void FeatureStats::set(string &theString, const SparseVector& sparseWeights )
while (!theString.empty()) {
getNextPound(theString, substring);
// regular feature
- if (substring.find(":") == string::npos) {
+ if (substring.find("=") == string::npos) {
add(ConvertStringToFeatureStatsType(substring));
}
// sparse feature
else {
- size_t separator = substring.find_last_of(":");
+ size_t separator = substring.find_last_of("=");
addSparse(substring.substr(0,separator), atof(substring.substr(separator+1).c_str()) );
}
}