hiq 0.2.2 → 0.3.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1796d2469d18b061387e2eaf777827913a4fd856e5b16a1111c9b43b7f059801
4
- data.tar.gz: 398d2dd88d26300acd27e8ed3c60501c7ca2cd7a146bb4b9e472551f35447ca1
3
+ metadata.gz: 25d399de67e77164e2645efbf10822f7ceeacf6b8c86e9687749a9c8cccc90ec
4
+ data.tar.gz: 23c2f9ea16ed1f31ba092ccf691cf98798927909c7aed4ee25fdeef467ef65ea
5
5
  SHA512:
6
- metadata.gz: 60fb47db7e6d8643e12c3ec7ae218cfedfec1a6bba2c5209ef8eded433f28c7896be84cca2fa69dcbca3e6aa0e1f8e0ffe0dbe1cf9b6e6e9e75716eccc4612c6
7
- data.tar.gz: 4da0e7a06d9544103bb0013d737ffe95eadc522ba77f780fbbffd60acafe6c6545d50ae40bb150b29424cf008cac1a3b2899cd8d5485e856c806ea1abc387544
6
+ metadata.gz: 2fcb16e12377d9b911c8a6cb9dcabd9991258f5762e8beecddd157dcb22316edbd5450906e699c895a20eb996df705a4a5b72eadf6185cb6ac7972bc557cf38f
7
+ data.tar.gz: 22051760a5030c0545ce3f8ee67dea69cc499ee5e5584650a13e09cf82c8c2b0f579660c2fc84ed7004b483ae02087e7a656962aeccc26a06180012c40f72ce3
@@ -1,31 +1,114 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # rubocop:disable Metrics/MethodLength
4
+ # rubocop:disable Metrics/ClassLength
5
+
3
6
  module Hiq
4
7
  # Provided of filler for lines of haiku
5
8
  class FillerLibrary
6
9
  def self.interpolated_fillers
7
10
  {
8
- 5 => {
9
- 1 => 'the X',
10
- 2 => 'ghastly X',
11
- 3 => 'shadow of X',
12
- 4 => 'X of my joy fade'
13
- },
14
- 7 => {
15
- 1 => 'a X',
16
- 2 => 'the pale X',
17
- 3 => 'X in silence',
18
- 4 => 'X ends the autumn',
19
- 5 => 'A spark of X above',
20
- 6 => 'the sad facade of X torn'
21
- }
11
+ 1 => ['the X', 'a X', 'X house!'],
12
+ 2 => ['ghastly X', 'the pale X', 'fog X mince', 'No X jay', 'X the bottle', 'younger X', 'X bark tight',
13
+ 'with a X winds'],
14
+ 3 => ['shadow of X', 'X in silence', 'the subway X', 'In the pink X', 'behind an X', 'it bus X moon',
15
+ 'X the pages'],
16
+ 4 => ['X of my joy fade', 'X ends the autumn', 'letter to the X', 'X in the window', 'the lines of X',
17
+ 'the X scattered', 'flat fine go X call', 'from the childhood X'],
18
+ 5 => ['A spark of X above', 'Slayer wind the way X'],
19
+ 6 => ['the sad facade of X torn', 'afternoon from I wall X', 'X trees flutter over back ']
22
20
  }
23
21
  end
24
22
 
25
23
  def self.fillers
26
24
  {
27
- 5 => ['empty riverside', 'tears flow in the rain', 'cheerful summer\'s charm'].shuffle,
28
- 7 => ['the vain wind of summer blows', 'gentle breeze upon a mountain', 'a frog jumps into a well'].shuffle
25
+ 5 => [
26
+ 'empty riverside',
27
+ 'tears flow in the rain',
28
+ 'cheerful summer\'s charm',
29
+ 'A fallen leaves',
30
+ "New Year's 1ever",
31
+ 'of a dog hanged',
32
+ 'on the pavement',
33
+ "Valentine's Day",
34
+ 'a shadow boating',
35
+ 'airily balloons -',
36
+ 'cup on tea music',
37
+ 'evening coolness',
38
+ 'finally ad bass -',
39
+ 'override my amps',
40
+ 'A head lit shelter',
41
+ 'a bark flower pot',
42
+ 'and there escapes',
43
+ 'fan into too fast',
44
+ 'in the holy sense',
45
+ 'inside the sunset',
46
+ 'listening to down',
47
+ 'on a bird fingers',
48
+ 'the bag of autumn',
49
+ 'the bay of a dart',
50
+ 'the colored world',
51
+ 'after the pumpkin:',
52
+ 'at the sudden hair',
53
+ 'autumn leaf flames',
54
+ 'comes to an end...',
55
+ 'for the sun alone',
56
+ 'in the young weirs',
57
+ 'on a garbage truck',
58
+ 'snow fall of roses',
59
+ 'the saddled slower',
60
+ 'a wash before sheep',
61
+ 'affords hot the air',
62
+ 'in the Honkers mine',
63
+ 'in the fall flowing',
64
+ 'milk in the morning',
65
+ 'someone older bloom',
66
+ 'the ash leaves splay',
67
+ 'the lift of a moor,',
68
+ 'the same quiet rains',
69
+ '- A hole in the rise',
70
+ 'October wind through',
71
+ 'headlights, whiter-et',
72
+ 'i- two gold her hair',
73
+ 'just up kin oil beard',
74
+ 'passing my neighbor',
75
+ 'pierce drippy second',
76
+ 'shells in the mirror',
77
+ 'the sound of a trash',
78
+ 'the wild powder sack',
79
+ 'the mister rams trap',
80
+ 'from the first baleen',
81
+ 'my mind like a candle',
82
+ 'snow, leaves two pies',
83
+ 'the scent of red hair',
84
+ 'a flank of calm mosque',
85
+ 'a fan a across',
86
+ "sin's that dawn light tide"
87
+ ],
88
+ 7 => [
89
+ 'the vain wind of summer blows',
90
+ 'gentle breeze upon a mountain',
91
+ 'a frog jumps into a well',
92
+ 'around my of finally',
93
+ 'roses in the forecast',
94
+ 'follow just overflowed',
95
+ 'of a traveling machine',
96
+ 'of allowed in the blade',
97
+ 'under a clamping lilac -',
98
+ 'on the Pony.. and snuffer',
99
+ 'the blinded on a red road',
100
+ 'the scent of lemon petals',
101
+ 'the islands in the grab use',
102
+ 'the noise of a carrier bag',
103
+ 'young women clean morning -',
104
+ 'an expecting moon His breaks',
105
+ 'the boyfriend of my pocket -',
106
+ 'Spring warding stray or a glass',
107
+ 'and two pour face all the dock',
108
+ 'i wish i X on buy band train',
109
+ 'in the fresh of old plane candle',
110
+ "we're down the school of her hands"
111
+ ]
29
112
  }
30
113
  end
31
114
 
@@ -36,12 +119,14 @@ module Hiq
36
119
  @cfillers = FillerLibrary.fillers
37
120
  end
38
121
 
39
- def get_const_filler(syllable_length)
40
- cfillers[syllable_length].shift
122
+ def get_const_filler(filler_length)
123
+ cfillers[filler_length].delete(cfillers[filler_length].sample)
41
124
  end
42
125
 
43
- def get_interpolated_filler(syllable_length, gap_size)
44
- ifillers[syllable_length][gap_size]
126
+ def get_interpolated_filler(filler_length)
127
+ ifillers[filler_length].delete(ifillers[filler_length].sample)
45
128
  end
46
129
  end
47
130
  end
131
+ # rubocop:enable Metrics/MethodLength
132
+ # rubocop:enable Metrics/ClassLength
@@ -29,10 +29,14 @@ module Hiq
29
29
  target_syllable_length - line.map { |word| syllables(word) }.sum
30
30
  end
31
31
 
32
+ def vowelless_input?
33
+ syllable_gap_size == target_syllable_length
34
+ end
35
+
32
36
  def filled_line
33
- return [library.get_const_filler(target_syllable_length)] if line.empty?
37
+ return [library.get_const_filler(target_syllable_length)] if line.empty? || vowelless_input?
34
38
 
35
- [library.get_interpolated_filler(target_syllable_length, syllable_gap_size).gsub('X', line.first)]
39
+ [library.get_interpolated_filler(syllable_gap_size).gsub('X', line.first)]
36
40
  end
37
41
  end
38
42
  end
data/lib/hiq/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Hiq
4
- VERSION = '0.2.2'
4
+ VERSION = '0.3.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Taras
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-22 00:00:00.000000000 Z
11
+ date: 2022-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug