From aeee9782b8331c93e4665663e9e759188197074e Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Aug 2016 14:06:12 -0400 Subject: Marked rawr::randomSentence const --- kgramstats.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kgramstats.cpp') diff --git a/kgramstats.cpp b/kgramstats.cpp index cb63db6..f171be9 100644 --- a/kgramstats.cpp +++ b/kgramstats.cpp @@ -553,7 +553,7 @@ void rawr::setMinCorpora(int _arg) } // runs in O(n log t) time where n is the input number of sentences and t is the number of tokens in the input corpus -std::string rawr::randomSentence(int maxL) +std::string rawr::randomSentence(int maxL) const { if (!_compiled) { @@ -597,10 +597,10 @@ std::string rawr::randomSentence(int maxL) cur = kgram(1, wildcardQuery); } - auto& distribution = _stats[cur]; + auto& distribution = _stats.at(cur); int max = distribution.rbegin()->first; int r = rand() % max; - token_data& next = distribution.upper_bound(r)->second; + const token_data& next = distribution.upper_bound(r)->second; std::string nextToken = next.tok.w.forms.next(); // Apply user-specified transforms -- cgit 1.4.1