momblish 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c823c9e7c66d1e512049506406bea140fadd6bf0047b56dbced7bcda90ddcc63
4
- data.tar.gz: b8be4162f693a4c5a6d82b134cd16bb9ae19f3326a628338f280632e0f3f2a5f
3
+ metadata.gz: 21aaf54ca59e3123f8d7d97c35000e0812f83f756dbfac00680ce510b60b40cf
4
+ data.tar.gz: bac58ba6463ea7e01e95272a4dbad690f700c4f2cdc999fedb6690718f86400a
5
5
  SHA512:
6
- metadata.gz: 12e8fd02096d2d4cb46f880cd26f65726a8a32ceb3e4ffc1ddd4be86e785b465fa2503c75df03448c824ac1fc756192fa828e0db1c7ee9f88bb278d15c6d1e37
7
- data.tar.gz: 51ab00551d6bc9981090d1cda07028dc1ef00c7708c6e86597f91db39f35af938226546a02fd857fa073919588fb74826dca5c5f554d439bf9f2aaf3f00497dc
6
+ metadata.gz: f5f4d1e947599bc2551652c72729e6049b2dd400f383fb96e79455aac6b68df02ee92f5b3c6e06ed388dfd45a066582566b4d9552a73e4241b5bcd3def5c6a97
7
+ data.tar.gz: '079060fb89d044c504c78bebbe8863c401597f12aa70b8471cc1ab6a309df161def1fa5c151d46e0e9514de1bd25530accf7849c8e09570036f8dc1ae0deae85'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- momblish (0.1.0)
4
+ momblish (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,3 +1,3 @@
1
1
  class Momblish
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/momblish.rb CHANGED
@@ -59,7 +59,7 @@ class Momblish
59
59
  def word(length = nil)
60
60
  length ||= rand(4..12)
61
61
 
62
- word = @corpus.weighted_bigrams.keys.sample
62
+ word = @corpus.weighted_bigrams.weighted_sample
63
63
 
64
64
  (length - 2).times do
65
65
  last_bigram = word[-2..-1]
@@ -74,17 +74,13 @@ class Momblish
74
74
  word.downcase
75
75
  end
76
76
 
77
- def sentence(count = nil, word_length = nil)
78
- raise ArgumentError, 'You must provide a block or a count' if count.nil? && !block_given?
77
+ def sentence(count = nil, word_length: nil)
78
+ return enum_for(:sentence, count, word_length: word_length) unless block_given?
79
79
 
80
- if block_given?
81
- if count.nil?
82
- loop { yield word(word_length) }
83
- else
84
- count.times { yield word(word_length) }
85
- end
80
+ if count.nil?
81
+ loop { yield word(word_length) }
86
82
  else
87
- Array.new(count) { word(word_length) }
83
+ count.times { yield word(word_length) }
88
84
  end
89
85
  end
90
86
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: momblish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stephen Prater
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-12-15 00:00:00.000000000 Z
11
+ date: 2023-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -83,7 +83,6 @@ files:
83
83
  - bin/setup
84
84
  - lib/corpuses/simple.txt
85
85
  - lib/corpuses/spanish.txt
86
- - lib/freq.txt
87
86
  - lib/momblish.rb
88
87
  - lib/momblish/corpus.rb
89
88
  - lib/momblish/corpus_analyzer.rb
data/lib/freq.txt DELETED
File without changes