markov_words 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/markov_words/version.rb +1 -1
- data/lib/markov_words/words.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37eb273f25ad18c46a9c3a66c6467222af81817c
|
4
|
+
data.tar.gz: 8ad07cb6d169686909c60d3f492e0bdedd2b4a23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c04a14d059551ecff738aee90e93c60f0ec9750922e9c076392cc09f013ec9e7231dcb7b42811a3ba00181638b82e21b3ab758d892d0d3e8dd288602378d408
|
7
|
+
data.tar.gz: 394f7499450531865e92164708c95ef4d0b6c39ecb8f2e7bb680830f428714669f6b2d86977c40f0422fe51ee7ff5edc04f8b7b87f754d88387673d39f700af7
|
data/Gemfile.lock
CHANGED
data/lib/markov_words/version.rb
CHANGED
data/lib/markov_words/words.rb
CHANGED
@@ -190,7 +190,7 @@ module MarkovWords
|
|
190
190
|
# In the example hash above, "a" would have a 33% chance of being chosen,
|
191
191
|
# while "b" would have a 66% chance (1/2 ratio).
|
192
192
|
def pick_random_char(counts_hash)
|
193
|
-
|
193
|
+
return nil if counts_hash.nil?
|
194
194
|
total = counts_hash.values.sum
|
195
195
|
pick_num = SecureRandom.rand(total)
|
196
196
|
counter = 0
|
@@ -201,7 +201,7 @@ module MarkovWords
|
|
201
201
|
end
|
202
202
|
|
203
203
|
def line_ending?(word)
|
204
|
-
|
204
|
+
/[\r\n]/.match? word
|
205
205
|
end
|
206
206
|
|
207
207
|
def set_grams
|