summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-10-20 03:04:14 +0000
committerredpony <redpony@ec762483-ff6d-05da-a07a-a48fb63a330f>2010-10-20 03:04:14 +0000
commit0a4cfe35aa687428d5e9f001a2d9e9c16904f52a (patch)
tree4ae8b7ce7c95a53f5f6ef329c35477331faa6493 /utils
parent4417ddc9f73fb2222194ba5058cdcc35cf724328 (diff)
forgot what this is
git-svn-id: https://ws10smt.googlecode.com/svn/trunk@683 ec762483-ff6d-05da-a07a-a48fb63a330f
Diffstat (limited to 'utils')
-rw-r--r--utils/weights.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/utils/weights.cc b/utils/weights.cc
index 53089f89..b994a2fe 100644
--- a/utils/weights.cc
+++ b/utils/weights.cc
@@ -15,9 +15,9 @@ void Weights::InitFromFile(const std::string& filename, vector<string>* feature_
assert(in);
int weight_count = 0;
bool fl = false;
+ string buf;
+ double val = 0;
while (in) {
- double val = 0;
- string buf;
getline(in, buf);
if (buf.size() == 0) continue;
if (buf[0] == '#') continue;
@@ -27,12 +27,12 @@ void Weights::InitFromFile(const std::string& filename, vector<string>* feature_
while(start < buf.size() && buf[start] == ' ') ++start;
int end = 0;
while(end < buf.size() && buf[end] != ' ') ++end;
- int fid = FD::Convert(buf.substr(start, end - start));
+ const int fid = FD::Convert(buf.substr(start, end - start));
while(end < buf.size() && buf[end] == ' ') ++end;
val = strtod(&buf.c_str()[end], NULL);
if (isnan(val)) {
cerr << FD::Convert(fid) << " has weight NaN!\n";
- abort();
+ abort();
}
if (wv_.size() <= fid)
wv_.resize(fid + 1);