markov_words 0.2.1 → 0.2.2
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/README.md +1 -0
- data/lib/markov_words/version.rb +1 -1
- data/lib/markov_words/words.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8178f4afd270e5707e65d66b6643e8b768be1026
|
4
|
+
data.tar.gz: 6bbe0d6c68c4a1f40719f204e0221cdf6723c358
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3990ff760c7be9efa3953ca04b44173e4ba06329826e480c86a60b74d22b1664171696eac7ed58c85bedb2a9e7132059478d940b102af5befbfb1dab053eb98d
|
7
|
+
data.tar.gz: bcd4abb7a85dbd5e4337f86c731c2dbf7549cb02dd5ce9c55183bce6000b95fab230ad6f73ba2fc2ed47be2f7bb5d6294fa898f79e702b04b250907127ba2607
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# MarkovWords
|
2
|
+
[](https://badge.fury.io/rb/markov_words)
|
2
3
|
|
3
4
|
At [EXPLO](https://www.explo.org), we often have a need for specific vocabulary-generators. For example, we might want to make a [password generator](http://lab.explo.org/password), or a Harry Potter house-generator, or some such thing.
|
4
5
|
|
data/lib/markov_words/version.rb
CHANGED
data/lib/markov_words/words.rb
CHANGED
@@ -189,7 +189,8 @@ module MarkovWords
|
|
189
189
|
# element from the values hash, accurate to the distribution of counts.
|
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
|
-
def pick_random_char(counts_hash
|
192
|
+
def pick_random_char(counts_hash)
|
193
|
+
counts_hash ||= {}
|
193
194
|
total = counts_hash.values.sum
|
194
195
|
pick_num = SecureRandom.rand(total)
|
195
196
|
counter = 0
|
@@ -200,7 +201,7 @@ module MarkovWords
|
|
200
201
|
end
|
201
202
|
|
202
203
|
def line_ending?(word)
|
203
|
-
word.
|
204
|
+
word.match(/[\r \n]/)
|
204
205
|
end
|
205
206
|
|
206
207
|
def set_grams
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: markov_words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donald Merand
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|