From 033d696ceb6f674252ee31c98db396ba4d10481f Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Wed, 17 Feb 2016 16:01:38 -0500 Subject: Attemped to fix line-endings for Windows --- ebooks.cpp | 5 +++++ gen.cpp | 5 +++++ kgramstats.cpp | 10 ++++++++++ 3 files changed, 20 insertions(+) diff --git a/ebooks.cpp b/ebooks.cpp index fdbeeab..18a0a79 100644 --- a/ebooks.cpp +++ b/ebooks.cpp @@ -23,6 +23,11 @@ int main(int argc, char** args) std::string line; while (getline(infile, line)) { + if (line.back() == '\r') + { + line.pop_back(); + } + corpus += line + "\n "; } diff --git a/gen.cpp b/gen.cpp index 26edd21..a963740 100644 --- a/gen.cpp +++ b/gen.cpp @@ -37,6 +37,11 @@ int main(int argc, char** args) std::string line; while (getline(infile, line)) { + if (line.back() == '\r') + { + line.pop_back(); + } + corpus += line + "\n "; } diff --git a/kgramstats.cpp b/kgramstats.cpp index f3fbcb2..3c5a4ee 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp @@ -80,6 +80,11 @@ kgramstats::kgramstats(std::string corpus, int maxK) { std::string rawmojis; getline(emoji_file, rawmojis); + if (rawmojis.back() == '\r') + { + rawmojis.pop_back(); + } + emojis.add(rawmojis); } @@ -594,6 +599,11 @@ std::string kgramstats::randomSentence(int n) { std::string l; getline(namefile, l); + if (l.back() == '\r') + { + l.pop_back(); + } + fv_names.push_back(l); } -- cgit 1.4.1