summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b2fc6c4)
raw | patch | inline | side by side (parent: b2fc6c4)
author | LvHang <hanglv@nwpu-aslp.org> | |
Sun, 16 Jul 2017 19:20:10 +0000 (15:20 -0400) | ||
committer | Daniel Povey <dpovey@gmail.com> | |
Sun, 16 Jul 2017 19:20:10 +0000 (15:20 -0400) |
src/lm/arpa-file-parser.cc | patch | blob | history |
index d3307a477c0a927c9a9317870ba8a930295033be..6984a5c1b253d1cc9962a1e8c0fa796e2564d70e 100644 (file)
// Processes "\data\" section.
bool keyword_found = false;
while (++line_number_, getline(is, current_line_) && !is.eof()) {
- if (current_line_.empty()) continue;
+ if (current_line_.find_first_not_of(" \t\n\r") == std::string::npos) {
+ continue;
+ }
TrimTrailingWhitespace(¤t_line_);
int32 ngram_count = 0;
while (++line_number_, getline(is, current_line_) && !is.eof()) {
- if (current_line_.empty()) continue;
+ if (current_line_.find_first_not_of(" \n\t\r") == std::string::npos) {
+ continue;
+ }
if (current_line_[0] == '\\') {
TrimTrailingWhitespace(¤t_line_);
std::ostringstream next_keyword;