diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-17 16:01:38 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-02-17 16:01:38 -0500 |
commit | 033d696ceb6f674252ee31c98db396ba4d10481f (patch) | |
tree | b91fd4bb3bb654f01faf62d053a73e60b07e5734 | |
parent | c8e834c362ea80a781fa870338182a4c81ad3d78 (diff) | |
download | rawr-ebooks-033d696ceb6f674252ee31c98db396ba4d10481f.tar.gz rawr-ebooks-033d696ceb6f674252ee31c98db396ba4d10481f.tar.bz2 rawr-ebooks-033d696ceb6f674252ee31c98db396ba4d10481f.zip |
Attemped to fix line-endings for Windows
-rw-r--r-- | ebooks.cpp | 5 | ||||
-rw-r--r-- | gen.cpp | 5 | ||||
-rw-r--r-- | kgramstats.cpp | 10 |
3 files changed, 20 insertions, 0 deletions
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) | |||
23 | std::string line; | 23 | std::string line; |
24 | while (getline(infile, line)) | 24 | while (getline(infile, line)) |
25 | { | 25 | { |
26 | if (line.back() == '\r') | ||
27 | { | ||
28 | line.pop_back(); | ||
29 | } | ||
30 | |||
26 | corpus += line + "\n "; | 31 | corpus += line + "\n "; |
27 | } | 32 | } |
28 | 33 | ||
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) | |||
37 | std::string line; | 37 | std::string line; |
38 | while (getline(infile, line)) | 38 | while (getline(infile, line)) |
39 | { | 39 | { |
40 | if (line.back() == '\r') | ||
41 | { | ||
42 | line.pop_back(); | ||
43 | } | ||
44 | |||
40 | corpus += line + "\n "; | 45 | corpus += line + "\n "; |
41 | } | 46 | } |
42 | 47 | ||
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) | |||
80 | { | 80 | { |
81 | std::string rawmojis; | 81 | std::string rawmojis; |
82 | getline(emoji_file, rawmojis); | 82 | getline(emoji_file, rawmojis); |
83 | if (rawmojis.back() == '\r') | ||
84 | { | ||
85 | rawmojis.pop_back(); | ||
86 | } | ||
87 | |||
83 | emojis.add(rawmojis); | 88 | emojis.add(rawmojis); |
84 | } | 89 | } |
85 | 90 | ||
@@ -594,6 +599,11 @@ std::string kgramstats::randomSentence(int n) | |||
594 | { | 599 | { |
595 | std::string l; | 600 | std::string l; |
596 | getline(namefile, l); | 601 | getline(namefile, l); |
602 | if (l.back() == '\r') | ||
603 | { | ||
604 | l.pop_back(); | ||
605 | } | ||
606 | |||
597 | fv_names.push_back(l); | 607 | fv_names.push_back(l); |
598 | } | 608 | } |
599 | 609 | ||