random-words 1.0.11 → 1.0.12
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/.rubocop.yml +316 -1
- data/.rubocop_todo.yml +0 -313
- data/CHANGELOG.md +20 -0
- data/bin/randw +31 -185
- data/lib/random-words/generator.rb +35 -5
- data/lib/random-words/html2markdown.rb +80 -20
- data/lib/random-words/{lorem-markdown.rb → lorem-html.rb} +47 -10
- data/lib/random-words/terminal.rb +183 -0
- data/lib/random-words/version.rb +1 -1
- data/lib/random-words/words/corporate/clauses.txt +100 -100
- data/lib/random-words.rb +2 -1
- metadata +4 -3
@@ -0,0 +1,183 @@
|
|
1
|
+
module RandomWords
|
2
|
+
# Terminal methods for testing
|
3
|
+
class Terminal
|
4
|
+
def initialize(source = :english)
|
5
|
+
# Create an instance of the generator
|
6
|
+
@sentence_generator = RandomWords::Generator.new(source)
|
7
|
+
@sentence_generator.use_extended_punctuation = true
|
8
|
+
@colors = {
|
9
|
+
text: :yellow,
|
10
|
+
counter: :boldcyan,
|
11
|
+
marker: :boldgreen,
|
12
|
+
bracket: :cyan,
|
13
|
+
language: :boldmagenta
|
14
|
+
}
|
15
|
+
@sources = @sentence_generator.sources.keys.map(&:to_s)
|
16
|
+
end
|
17
|
+
|
18
|
+
def colors
|
19
|
+
{
|
20
|
+
black: 30,
|
21
|
+
red: 31,
|
22
|
+
green: 32,
|
23
|
+
yellow: 33,
|
24
|
+
blue: 34,
|
25
|
+
magenta: 35,
|
26
|
+
cyan: 36,
|
27
|
+
white: 37,
|
28
|
+
boldblack: '1;30',
|
29
|
+
boldred: '1;31',
|
30
|
+
boldgreen: '1;32',
|
31
|
+
boldyellow: '1;33',
|
32
|
+
boldblue: '1;34',
|
33
|
+
boldmagenta: '1;35',
|
34
|
+
boldcyan: '1;36',
|
35
|
+
boldwhite: '1;37',
|
36
|
+
reset: 0
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
def colorize_text(text, color)
|
41
|
+
return text unless $stdout.isatty
|
42
|
+
|
43
|
+
return text unless colors.key?(color)
|
44
|
+
|
45
|
+
color_code = colors[color]
|
46
|
+
|
47
|
+
"\e[#{color_code}m#{text}\e[0m"
|
48
|
+
end
|
49
|
+
|
50
|
+
def header_1(text)
|
51
|
+
puts colorize_text("\n\n#{text}", :boldgreen)
|
52
|
+
puts colorize_text('=' * text.length, :boldgreen)
|
53
|
+
puts "\n"
|
54
|
+
end
|
55
|
+
|
56
|
+
def header_2(text)
|
57
|
+
puts colorize_text("\n\n#{text}", :boldyellow)
|
58
|
+
puts colorize_text('-' * text.length, :boldyellow)
|
59
|
+
puts "\n"
|
60
|
+
end
|
61
|
+
|
62
|
+
def paragraphs(length, count = 3)
|
63
|
+
@sentence_generator.sentence_length = length
|
64
|
+
@sentence_generator.paragraph_length = count
|
65
|
+
@sentence_generator.source = @sources.sample
|
66
|
+
|
67
|
+
header_2("Random Paragraph (#{@sentence_generator.paragraph_length} #{@sentence_generator.sentence_length} sentences)")
|
68
|
+
graf = @sentence_generator.paragraph
|
69
|
+
puts text(graf)
|
70
|
+
puts counter("#{graf.split(/ /).count} words, #{graf.length} characters")
|
71
|
+
end
|
72
|
+
|
73
|
+
def sentence(length)
|
74
|
+
header_2("Random #{length} sentence")
|
75
|
+
@sentence_generator.sentence_length = length
|
76
|
+
s = @sentence_generator.sentence
|
77
|
+
puts text(s)
|
78
|
+
puts counter("#{s.split(/ /).count} words, #{s.length} characters")
|
79
|
+
end
|
80
|
+
|
81
|
+
# Generate and print random combined sentences
|
82
|
+
def combined_sentences(length = nil)
|
83
|
+
number_of_sentences = length || 2
|
84
|
+
|
85
|
+
header_1('Random Combined Sentences:')
|
86
|
+
@sources.count.times do |i|
|
87
|
+
@sentence_generator.source = @sources[i - 1]
|
88
|
+
@sentence_generator.sentence_length = :medium
|
89
|
+
@sentence_generator.paragraph_length = number_of_sentences
|
90
|
+
@sentence_generator.sentences(number_of_sentences)
|
91
|
+
s = @sentence_generator.sentence
|
92
|
+
puts "#{marker} #{text(s)}"
|
93
|
+
puts counter("#{s.split(/ /).count} words, #{s.length} characters")
|
94
|
+
puts colorize_text(' ' * 2, :boldwhite)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def random_sentences
|
99
|
+
header_1('Random Sentences')
|
100
|
+
@sentence_generator.lengths.keys.each_with_index do |length, index|
|
101
|
+
@sentence_generator.source = @sources[index]
|
102
|
+
sentence(length)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
def random_paragraphs
|
107
|
+
header_1('Random Paragraphs')
|
108
|
+
@sentence_generator.lengths.keys.each_with_index do |length, index|
|
109
|
+
@sentence_generator.source = @sources[index]
|
110
|
+
paragraphs(length, 3)
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Generate and print specified number of words
|
115
|
+
def random_words
|
116
|
+
number_of_words = []
|
117
|
+
@sources.count.times do |i|
|
118
|
+
number_of_words << (((i * i) * 5) + 10)
|
119
|
+
end
|
120
|
+
|
121
|
+
header_1("#{number_of_words} Random Words")
|
122
|
+
@sources.each_with_index do |source, index|
|
123
|
+
header_2("#{number_of_words[index]} Random Words")
|
124
|
+
@sentence_generator.source = source
|
125
|
+
s = @sentence_generator.words(number_of_words[index])
|
126
|
+
puts "#{marker} #{text(s)} "
|
127
|
+
puts counter("#{s.split(/ /).count} words, #{s.length} characters")
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
# Generate and print specified number of characters
|
132
|
+
def random_characters
|
133
|
+
header_1('Random Characters (exact length)')
|
134
|
+
[20, 50, 120, 200, 500].each_with_index do |i, index|
|
135
|
+
@sentence_generator.source = @sources[index]
|
136
|
+
chars = @sentence_generator.characters(i, whole_words: true)
|
137
|
+
puts "#{marker} #{colorize_text("#{i}:", :boldwhite)} #{text(chars)} #{counter(chars.length)}"
|
138
|
+
end
|
139
|
+
|
140
|
+
# Generate and print specified number of characters
|
141
|
+
max_characters = [15, 25, 53, 110, 600]
|
142
|
+
min_characters = [10, 20, 50, 100, 500]
|
143
|
+
|
144
|
+
header_1('Random Characters (length range)')
|
145
|
+
max_characters.count.times do |i|
|
146
|
+
@sentence_generator.source = @sources[i]
|
147
|
+
chars = @sentence_generator.characters(min_characters[i], max_characters[i], whole_words: true)
|
148
|
+
range = "#{marker} #{colorize_text("[#{min_characters[i]}-#{max_characters[i]}]: ", :boldwhite)}"
|
149
|
+
puts "#{range}#{text(chars)} #{counter(chars.length)}"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
def marker
|
154
|
+
colorize_text('•', @colors[:marker])
|
155
|
+
end
|
156
|
+
|
157
|
+
def text(text)
|
158
|
+
colorize_text(text, @colors[:text])
|
159
|
+
end
|
160
|
+
|
161
|
+
def language
|
162
|
+
"#{colorize_text('(',
|
163
|
+
@colors[:bracket])}#{colorize_text("#{@sentence_generator.source}",
|
164
|
+
@colors[:language])}#{colorize_text(')',
|
165
|
+
@colors[:bracket])}"
|
166
|
+
end
|
167
|
+
|
168
|
+
def counter(length)
|
169
|
+
"#{colorize_text('[',
|
170
|
+
@colors[:bracket])}#{colorize_text("#{length}",
|
171
|
+
@colors[:counter])}#{colorize_text(']',
|
172
|
+
@colors[:bracket])} #{language}"
|
173
|
+
end
|
174
|
+
|
175
|
+
def print_test
|
176
|
+
combined_sentences(3)
|
177
|
+
random_sentences
|
178
|
+
random_paragraphs
|
179
|
+
random_words
|
180
|
+
random_characters
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
data/lib/random-words/version.rb
CHANGED
@@ -1,101 +1,101 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
2
|
+
accentuates employee empowerment.
|
3
|
+
advocates for diversity and inclusion.
|
4
|
+
affirms our adaptive strategies.
|
5
|
+
affirms our innovative spirit.
|
6
|
+
aligns our efforts with stakeholder goals.
|
7
|
+
allows for strategic pivots.
|
8
|
+
bolsters our strategic initiatives.
|
9
|
+
champions innovation and creativity.
|
10
|
+
connects strategy with execution.
|
11
|
+
contributes to client satisfaction.
|
12
|
+
cultivates innovation across teams.
|
13
|
+
demonstrates our strategic vision.
|
14
|
+
demonstrates the importance of trust.
|
15
|
+
drives customer satisfaction.
|
16
|
+
drives high-impact initiatives.
|
17
|
+
drives sustainable growth.
|
18
|
+
drives transformational change.
|
19
|
+
embodies our commitment to transparency.
|
20
|
+
embodies our growth mindset.
|
21
|
+
embodies our values and mission.
|
22
|
+
emphasizes performance-driven outcomes.
|
23
|
+
emphasizes shared values.
|
24
|
+
emphasizes the value of innovation.
|
25
|
+
empowers our workforce.
|
26
|
+
encourages continuous improvement.
|
27
|
+
encourages exceptional performance.
|
28
|
+
enhances brand loyalty.
|
29
|
+
enhances collaborative efforts.
|
30
|
+
enhances customer experiences.
|
31
|
+
enhances operational agility.
|
32
|
+
enhances stakeholder engagement.
|
33
|
+
exemplifies cross-functional collaboration.
|
34
|
+
exemplifies customer-centricity.
|
35
|
+
exemplifies innovative thinking.
|
36
|
+
exemplifies our strategic intent.
|
37
|
+
exemplifies value creation.
|
38
|
+
fosters a culture of accountability.
|
39
|
+
fosters a strong brand equity.
|
40
|
+
fosters strategic partnerships.
|
41
|
+
furthers our mission for excellence.
|
42
|
+
governs our strategic framework.
|
43
|
+
guarantees exceptional results.
|
44
|
+
highlights efficiency and effectiveness.
|
45
|
+
highlights our commitment to growth.
|
46
|
+
highlights our core competencies.
|
47
|
+
highlights our proactive engagement.
|
48
|
+
highlights our unique selling proposition.
|
49
|
+
highlights the importance of agility.
|
50
|
+
illustrates client-centric solutions.
|
51
|
+
illustrates our dynamic approach.
|
52
|
+
illustrates proactive risk management.
|
53
|
+
illustrates the importance of alignment.
|
54
|
+
illustrates the power of collaboration.
|
55
|
+
informs our business strategies.
|
56
|
+
leads to measurable outcomes.
|
57
|
+
nurtures a growth environment.
|
58
|
+
promotes agile practices.
|
59
|
+
reflects collaboration across teams.
|
60
|
+
reflects continuous value delivery.
|
61
|
+
reflects excellence in service delivery.
|
62
|
+
reflects operational excellence.
|
63
|
+
reflects our commitment to excellence.
|
64
|
+
reflects our forward-looking mindset.
|
65
|
+
reflects our results-oriented culture.
|
66
|
+
reinforces our competitive positioning.
|
67
|
+
reinforces our established reputation.
|
68
|
+
reinforces our market positioning.
|
69
|
+
reinforces our value proposition.
|
70
|
+
represents a commitment to sustainability.
|
71
|
+
represents a cornerstone of our strategy.
|
72
|
+
represents a step towards empowerment.
|
73
|
+
resonates with stakeholder expectations.
|
74
|
+
shapes our brand identity.
|
75
|
+
showcases organizational resilience.
|
76
|
+
showcases our commitment to sustainability.
|
77
|
+
showcases our customer engagement efforts.
|
78
|
+
showcases our leadership capabilities.
|
79
|
+
showcases our unique capabilities.
|
80
|
+
showcases strategic foresight.
|
81
|
+
showcases talent development initiatives.
|
82
|
+
signals a commitment to quality.
|
83
|
+
signals forward-thinking leadership.
|
84
|
+
signifies awareness of industry trends.
|
85
|
+
signifies our commitment to innovation.
|
86
|
+
signifies thought leadership.
|
87
|
+
speaks to our adaptive culture.
|
88
|
+
speaks to our dedication to success.
|
89
|
+
steers strategic development.
|
90
|
+
strengthens our market position.
|
91
|
+
supports data-driven decisions.
|
92
|
+
supports operational efficiency.
|
93
|
+
supports scalable solutions.
|
94
|
+
underlines our competitive advantage.
|
95
|
+
underlines our focus on results.
|
96
|
+
underscores our commitment to diversity.
|
97
|
+
underscores our mission-driven approach.
|
98
|
+
underscores the need for flexibility.
|
99
|
+
validates our innovation portfolio.
|
100
|
+
built on data integrity.
|
101
|
+
indicative of market adaptability.
|
data/lib/random-words.rb
CHANGED
@@ -14,8 +14,9 @@ require_relative 'random-words/source'
|
|
14
14
|
require_relative 'random-words/config'
|
15
15
|
require_relative 'random-words/generator'
|
16
16
|
require_relative 'random-words/number-to-word'
|
17
|
-
require_relative 'random-words/lorem-
|
17
|
+
require_relative 'random-words/lorem-html'
|
18
18
|
require_relative 'random-words/html2markdown'
|
19
|
+
require_relative 'random-words/terminal'
|
19
20
|
|
20
21
|
# Main module for RandomWords
|
21
22
|
module RandomWords
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: random-words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-25 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: nokogiri
|
@@ -49,12 +49,13 @@ files:
|
|
49
49
|
- lib/random-words/generator.rb
|
50
50
|
- lib/random-words/hash.rb
|
51
51
|
- lib/random-words/html2markdown.rb
|
52
|
-
- lib/random-words/lorem-
|
52
|
+
- lib/random-words/lorem-html.rb
|
53
53
|
- lib/random-words/number-to-word.rb
|
54
54
|
- lib/random-words/numeric.rb
|
55
55
|
- lib/random-words/source.rb
|
56
56
|
- lib/random-words/string.rb
|
57
57
|
- lib/random-words/table-cleanup.rb
|
58
|
+
- lib/random-words/terminal.rb
|
58
59
|
- lib/random-words/version.rb
|
59
60
|
- lib/random-words/words/1984/adjectives.txt
|
60
61
|
- lib/random-words/words/1984/adverbs.txt
|