random-words 1.0.8 → 1.0.9

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: c87c310a16cb1a1afc9fbcc9603021da8c2cfcb27602fdfd03b1141b2f82e39e
4
- data.tar.gz: ef2773e2c2f1d834ef4f16655eebda7376417c82f6f11762df47c311d0b06750
3
+ metadata.gz: e5c9fbfa4e071e6bcb162ab51ba85a5fe00144539e6d7c0a5d66971d56127a22
4
+ data.tar.gz: 4ea7e54bdf36e6f94aa9b290ab97dc8c431b3129ab07646ad6c7c1c64599428a
5
5
  SHA512:
6
- metadata.gz: eb2bb1a14981fcfe5a2c2e278a781109ff60ca6fec79f19c48b2b102433169bc586f263159980f448d6ce9948cec73739c0e40d619c4453cbc664a2c993ec35a
7
- data.tar.gz: c1c28313e3bd6a63247db6b7db039b9173fd918057f3c79b581f4d6014ba7d0b6ff8381e7493336fc43c6fb2f3af16a4c780dec3459f90a0a7eb5c2c0c64cd67
6
+ metadata.gz: 309a9619aa427d76365ce597d879b21669227407ea811db9739f9f9327f884fbc3d0875ef93265dad9b7ffce1a6979194d9739c679e1b29b223f6388c55bbde1
7
+ data.tar.gz: 1eb119bf70a4588142a31af53e93aaa266956eb835407305d3e8728a2fd8f0d2d2e118b30385cfbd02ff99ed1f4e327f671b4a7478367847060af936ef042364
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
1
  --format progress
2
2
  --color auto
3
3
  --require spec_helper
4
- -b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.0.9
2
+
3
+ 2025-04-20 06:34
4
+
5
+ #### NEW
6
+
7
+ - Random punctuation between clauses
8
+
9
+ #### IMPROVED
10
+
11
+ - Add espanol as a trigger for spanish (with tilde)
12
+
13
+ #### FIXED
14
+
15
+ - Better handling of extended puntuation arguments
16
+
1
17
  ### 1.0.8
2
18
 
3
19
  2025-04-17 13:37
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ MIT License Copyright (c) 2025 Brett Terpstra
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is furnished
8
+ to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice (including the next
11
+ paragraph) shall be included in all copies or substantial portions of the
12
+ Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19
+ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
 
2
2
 
3
- [![RubyGems.org](https://img.shields.io/gem/v/random-words)](https://rubygems.org/gems/random-words)
3
+ [![RubyGems.org](https://img.shields.io/gem/v/random-words)](https://rubygems.org/gems/random-words)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
4
4
 
5
5
  A random text (Lorem Ipsum) generator.
6
6
 
@@ -17,7 +17,7 @@ you use [Homebrew](https://brew.sh).
17
17
  ### CLI
18
18
 
19
19
  The gem installs a binary `randw`. It can generate random
20
- characters, sentences, paragraphs, markdown, html, and
20
+ characters, sentences, paragraphs, markdown, html, and
21
21
  passwords.
22
22
 
23
23
  ```console
@@ -167,6 +167,7 @@ YAML configuration. It contains the keys:
167
167
  name: english
168
168
  description: English words
169
169
  triggers: [english]
170
+ extended_punctuation: false
170
171
  ```
171
172
 
172
173
  A default configuration file will be created when running `--create-dictionary` with the CLI.
@@ -177,8 +178,11 @@ A default configuration file will be created when running `--create-dictionary`
177
178
  - `description`: Just used for display when running `--list-dictionaries`
178
179
  - `triggers`: An array of triggers that can be used to trigger the language.
179
180
 
180
- For example, the `bacon` language has the triggers `[bacon, meat, carnivore]`, so you can use `randw -S meat` on the command line (or with the library).
181
-
181
+ For example, the `bacon` language has the triggers
182
+ `[bacon, meat, carnivore]`, so you can use `randw -S
183
+ meat` on the command line (or with the library).
184
+ - `extended_punctuation`: Whether to include extended
185
+ punctuation like parenthesis, quotes, and ellipsis.
182
186
 
183
187
 
184
188
  ##### Terminators
@@ -211,13 +215,13 @@ the most likely to be used.
211
215
 
212
216
  ##### Names
213
217
 
214
- The `names.txt` file is just used when creating block quotes
215
- in Markdown or HTML output. Sections are split by blank
216
- lines: first names, last names, and optionally full names.
217
- If the first line contains characters other than letters,
218
- single quotes, and dashes, it will be assumed that you've
219
- skipped straight to full names and those will be used
220
- instead of generating random combinations.
218
+ The `names.txt` file is just used when creating random
219
+ names. Sections are split by blank lines: first names, last
220
+ names, and optionally full names. If the first line contains
221
+ characters other than letters, single quotes, and dashes, it
222
+ will be assumed that you've skipped straight to full names
223
+ and those will be used instead of generating random
224
+ combinations.
221
225
 
222
226
  #### Language Notes
223
227
 
@@ -232,8 +236,11 @@ If you create a fun dictionary, please let me know (or make a PR) and I'll gladl
232
236
  ```ruby
233
237
  require 'random-words'
234
238
 
235
- # Argument defines source dictionary (latin, english, corporate, bacon)
239
+ # Argument defines source dictionary (latin, english, corporate, bacon, etc.)
236
240
  rw = RandomWords::Generator.new(:corporate)
241
+
242
+ rw.sources # List all available dictionaries
243
+
237
244
  # Change source dictionary and re-init
238
245
  rw.source = :bacon
239
246
 
data/bin/randw CHANGED
@@ -192,8 +192,7 @@ end
192
192
  method: nil,
193
193
  debug: false,
194
194
  whitespace: true,
195
- separator: " ",
196
- use_extended_punctuation: false,
195
+ separator: " "
197
196
  }
198
197
 
199
198
  markdown_help = <<HELP
@@ -357,6 +356,7 @@ def markdown_settings(settings)
357
356
  mark: false,
358
357
  headers: false,
359
358
  table: false,
359
+ extended: false
360
360
  }
361
361
  sources = []
362
362
  RandomWords::Generator.new(:latin).sources.each { |k, v| sources.concat(v.names.map(&:to_s)) }
@@ -379,6 +379,7 @@ def markdown_settings(settings)
379
379
  headers: true,
380
380
  image: true,
381
381
  table: true,
382
+ extended: true
382
383
  }
383
384
  markdown_options.merge!(new_options)
384
385
  when Regexp.union(sources)
@@ -407,6 +408,8 @@ def markdown_settings(settings)
407
408
  markdown_options[:table] = true
408
409
  when 'short', 's', 'medium', 'med', 'm', 'long', 'l', 'very_long', 'vl'
409
410
  markdown_options[:length] = setting.to_length
411
+ when 'x', 'extended'
412
+ markdown_options[:extended] = true
410
413
  else
411
414
  markdown_options[:source] = setting.to_source
412
415
  end
@@ -418,7 +421,9 @@ end
418
421
  @rw = RandomWords::Generator.new(@options[:source])
419
422
  @rw.sentence_length = @options[:length] || :medium
420
423
  @rw.paragraph_length = @options[:paragraph_length] || 3
421
- @rw.use_extended_punctuation = @options[:use_extended_punctuation] || false
424
+ @options[:use_extended_punctuation] = @options[:use_extended_punctuation] ? true : false
425
+ @rw.use_extended_punctuation = @options[:use_extended_punctuation] ? true : @rw.config.config[:use_extended_punctuation]
426
+
422
427
  @options[:count] = @options[:count].to_i
423
428
 
424
429
  case @options[:method]
@@ -465,7 +470,10 @@ when :markdown, :html
465
470
  @rw.source = settings[:source]
466
471
  @rw.sentence_length = settings[:length] || :medium
467
472
  @rw.paragraph_length = settings[:sentences] || 5
468
- @rw.use_extended_punctuation = settings[:use_extended_punctuation] || false
473
+
474
+ @rw.use_extended_punctuation = settings[:extended] ? true : @options[:use_extended_punctuation]
475
+ settings[:extended] = @rw.use_extended_punctuation
476
+
469
477
  if @options[:method] == :markdown
470
478
  puts @rw.markdown(settings)
471
479
  else
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RandomWords
4
+ # @!visibility private
5
+ # This class is used to convert boolean values to strings, integers, and floats.
6
+ # It also provides a method to check if the value is truish.
7
+ class ::FalseClass
8
+ # Convert a boolean value to a string.
9
+ # @return [String] "true" or "false"
10
+ def to_s
11
+ 'false'
12
+ end
13
+
14
+ # Convert a boolean value to an integer.
15
+ # @return [Integer] 1 for true, 0 for false
16
+ def to_i
17
+ 0
18
+ end
19
+
20
+ # Convert a boolean value to a float.
21
+ # @return [Float] 1.0 for true, 0.0 for false
22
+ def to_f
23
+ 0.0
24
+ end
25
+
26
+ # Shim for truish
27
+ # @return [Boolean] false
28
+ def trueish?
29
+ false
30
+ end
31
+ end
32
+
33
+ # @!visibility private
34
+ # This class is used to convert boolean values to strings, integers, and floats.
35
+ # It also provides a method to check if the value is truish.
36
+ class ::TrueClass
37
+ # Convert a boolean value to a string.
38
+ # @return [String] "true" or "false"
39
+ def to_s
40
+ 'true'
41
+ end
42
+
43
+ # Convert a boolean value to an integer.
44
+ # @return [Integer] 1 for true, 0 for false
45
+ def to_i
46
+ 1
47
+ end
48
+
49
+ # Convert a boolean value to a float.
50
+ # @return [Float] 1.0 for true, 0.0 for false
51
+ def to_f
52
+ 1.0
53
+ end
54
+
55
+ # Shim for truish
56
+ def trueish?
57
+ true
58
+ end
59
+ end
60
+ end
@@ -34,6 +34,9 @@ module RandomWords
34
34
  # Source directory for languages
35
35
  attr_reader :source_dir
36
36
 
37
+ # Base config
38
+ attr_reader :config
39
+
37
40
  # Initialize the config with the given language
38
41
  # @param lang [Symbol] The language to use
39
42
  # @raise [RuntimeError] if no dictionary is found for the given language
@@ -204,10 +207,12 @@ module RandomWords
204
207
  # @param configuration [Hash] The configuration hash
205
208
  # @return [Hash] The converted configuration hash
206
209
  def handle_config(configuration)
210
+ ext_punc = configuration[:extended_punctuation]
207
211
  {
208
212
  source: configuration[:source].to_source || :latin,
209
213
  sentence_length: configuration[:length].to_length || :medium,
210
- paragraph_length: configuration[:paragraph_length].to_i || 5
214
+ paragraph_length: configuration[:paragraph_length].to_i || 5,
215
+ use_extended_punctuation: ext_punc && ext_punc.trueish? || false
211
216
  }
212
217
  end
213
218
 
@@ -244,7 +249,8 @@ module RandomWords
244
249
  config = {
245
250
  'source' => 'latin',
246
251
  'length' => 'medium',
247
- 'paragraph_length' => 5
252
+ 'paragraph_length' => 5,
253
+ 'extended_punctuation' => false
248
254
  }
249
255
  File.write(config_file, config.to_yaml)
250
256
  warn "Created #{config_file}"
@@ -12,6 +12,9 @@ module RandomWords
12
12
  :terminators, :numbers, :plural_nouns, :plural_verbs, :plural_articles, :prepositions, :coordinating_conjunctions,
13
13
  :all_words, :extended_punctuation, :phrases, :names
14
14
 
15
+ # return [Hash] configuration
16
+ attr_reader :config
17
+
15
18
  # Whether to use extended punctuation
16
19
  # @return [Boolean] true if extended punctuation is used, false otherwise
17
20
  attr_reader :use_extended_punctuation
@@ -79,6 +82,7 @@ module RandomWords
79
82
  @use_extended_punctuation = @options[:use_extended_punctuation]
80
83
 
81
84
  @terminators.concat(@config.dictionary[:extended_punctuation]) if @use_extended_punctuation
85
+
82
86
  lengths
83
87
  end
84
88
 
@@ -158,11 +162,13 @@ module RandomWords
158
162
  res << random_article_for_word('bananas')
159
163
  res << random_plural_article
160
164
  res << random_clause
165
+ res << random_separator
161
166
  res << random_subordinate_conjunction
162
167
  res << random_coordinating_conjunction
163
168
  res << random_number_with_plural
164
169
  res << random_phrase
165
170
  res << random_conjunction
171
+ res << random_name
166
172
  res << random_passive_verb
167
173
  res << random_plural_noun
168
174
  res << random_plural_verb
@@ -592,6 +598,17 @@ module RandomWords
592
598
  clauses.sample
593
599
  end
594
600
 
601
+ # Generate a random set of separators
602
+ def random_separators
603
+ [',', ',', ',', ';', ':', ' —']
604
+ end
605
+
606
+ # Generate a random separator
607
+ # @return [String] A randomly selected separator
608
+ def random_separator
609
+ random_separators.sample
610
+ end
611
+
595
612
  # Generate a random subordinate conjunction
596
613
  # @return [String] A randomly selected subordinate conjunction
597
614
  def random_subordinate_conjunction
@@ -655,18 +672,22 @@ module RandomWords
655
672
  def generate_main_clause
656
673
  start_with_phrase = roll(20)
657
674
  start_with_plural = roll(20)
675
+ start_with_name = roll(20)
658
676
  beginning = if start_with_phrase
659
677
  random_phrase
660
678
  elsif start_with_plural
661
679
  "#{random_number_with_plural} #{random_adverb} #{random_plural_verb}"
680
+ elsif start_with_name
681
+ random_name
662
682
  else
663
683
  noun = random_noun
664
684
  adjective = random_adjective
665
685
  "#{random_article_for_word(adjective)} #{adjective} #{noun} #{random_adverb} #{random_verb}"
666
686
  end
667
687
  tail = roll(50) ? " #{random_prepositional_phrase}" : ''
668
- tail += roll(10) ? ", #{random_clause}" : ''
669
- "#{beginning.strip.sub(/,?$/, ', ')}#{tail}"
688
+ separator = random_separator
689
+ tail += roll(10) ? "#{separator} #{random_clause}" : ''
690
+ "#{beginning.strip.sub(/[#{Regexp.escape(separator)}]*$/, separator)}#{tail}"
670
691
  end
671
692
 
672
693
  # Simplified generate_additional_clauses
@@ -35,14 +35,16 @@ module RandomWords
35
35
  code: false,
36
36
  mark: false,
37
37
  headers: false,
38
- table: false
38
+ table: false,
39
+ extended: false
39
40
  }
40
41
 
41
42
  @options = defaults.merge(options)
42
43
 
43
44
  @generator = RandomWords::Generator.new(@options[:source], {
44
45
  sentence_length: @options[:length],
45
- paragraph_length: @options[:sentences]
46
+ paragraph_length: @options[:sentences],
47
+ use_extended_punctuation: @options[:extended]
46
48
  })
47
49
 
48
50
  @output = ''
@@ -107,10 +109,26 @@ module RandomWords
107
109
 
108
110
  ensure_block_newlines
109
111
  compress_newlines
112
+ convert_punctuation
110
113
  end
111
114
 
112
115
  private
113
116
 
117
+ # Convert non-ascii punctuation to Markdown equivalents.
118
+ # @param [String] text The text to convert.
119
+ # @return [String] The converted text.
120
+ def convert_punctuation
121
+ text = @output
122
+ text.gsub!(/“|”/, '"')
123
+ text.gsub!(/‘|’/, "'")
124
+ text.gsub!(/–/, '-')
125
+ text.gsub!(/—/, '--')
126
+ text.gsub!(/—/, '---')
127
+ text.gsub!(/•/, '*')
128
+ text.gsub!(/…/, '...')
129
+ @output = text
130
+ end
131
+
114
132
  # Rolls for zero with the specified odds.
115
133
  def roll(odds)
116
134
  Random.rand(0..odds).zero?
@@ -349,7 +367,6 @@ module RandomWords
349
367
  s = { short: 2, medium: 4, long: 6, very_long: 8 }[@options[:length]]
350
368
  count.times do
351
369
  p = @generator.sentences(s).join(' ')
352
-
353
370
  should_em = force.include?(:em) || (em && roll(1))
354
371
  should_strong = force.include?(:strong) || (strong && roll(1))
355
372
  should_code = force.include?(:code) || (code && roll(6))
@@ -86,16 +86,16 @@ module RandomWords
86
86
  # Remove duplicate commas
87
87
  # @return [String] The string with duplicate commas removed.
88
88
  # @example
89
- # "Hello, , World!".remove_duplicate_commas # => "Hello, World!"
90
- def dedup_commas
91
- gsub(/(, *)+/, ',').gsub(',', ', ')
89
+ # "Hello, , World!".dedup_punctuation # => "Hello, World!"
90
+ def dedup_punctuation
91
+ gsub(/([,.;:—] ?)+/, '\1').gsub(/([,;:—])/, '\1')
92
92
  end
93
93
 
94
94
  # Generate a sentence with capitalization and terminator
95
95
  # @param terminator [Array<String>] An array of beginning and ending punctuation marks.
96
96
  # @return [String] The string with a random punctuation mark at the end.
97
97
  def to_sent(terminator)
98
- capitalize.compress.capitalize_i.dedup_commas.terminate(terminator)
98
+ capitalize.compress.capitalize_i.dedup_punctuation.terminate(terminator)
99
99
  end
100
100
 
101
101
  # Split a string by newlines, clean each line, and remove empty lines.
@@ -1,4 +1,4 @@
1
1
  module RandomWords
2
2
  # The version of the RandomWords gem.
3
- VERSION = '1.0.8'
3
+ VERSION = '1.0.9'
4
4
  end
@@ -14,3 +14,4 @@
14
14
  ",."
15
15
  ',.'
16
16
  (,.)
17
+ ,...
@@ -14,3 +14,4 @@
14
14
  ",."
15
15
  ',.'
16
16
  (,.)
17
+ ,…
@@ -14,3 +14,4 @@
14
14
  ",."
15
15
  ',.'
16
16
  (,.)
17
+ ,…
@@ -14,3 +14,4 @@
14
14
  ",."
15
15
  ',.'
16
16
  (,.)
17
+ ,…
@@ -1,74 +1,74 @@
1
- antes de que anochezca.
2
- antes de que empiece la tormenta.
3
- aunque esté cansado.
4
- aunque esté ocupado.
5
- aunque me digas lo contrario.
6
- aunque me sienta nervioso.
7
- aunque no creas en mí.
8
- aunque no lo creas.
9
- aunque no lo entiendo.
10
- aunque no lo esperaba.
11
- aunque no lo recuerde.
12
- aunque no lo sepas.
13
- aunque no sea fácil.
14
- aunque no sea perfecto.
15
- aunque no tenga ganas.
16
- aunque parezca imposible.
17
- como si no pasara nada.
18
- cuando abrí la puerta.
19
- cuando cruzamos la calle.
20
- cuando el sol salió.
21
- cuando empecé a trabajar.
22
- cuando era niño.
23
- cuando escuché la noticia.
24
- cuando hable con el profesor.
25
- cuando llegó el paquete.
26
- cuando llegué a casa.
27
- cuando lleguen los invitados.
28
- cuando me despierto por la mañana.
29
- cuando me envíes el mensaje.
30
- cuando me llamaste.
31
- cuando me siento feliz.
32
- cuando pasamos por el parque.
33
- cuando salimos de vacaciones.
34
- cuando termine el día.
35
- cuando termine el trabajo.
36
- cuando termine la película.
37
- cuando vi a mis amigos.
38
- después de que acabe la conferencia.
39
- después de que cenamos.
40
- después de que comí.
41
- después de que hable con ella.
42
- después de que se fue.
43
- después de que termine la reunión.
44
- después de que terminó la clase.
45
- mientras él cocinaba.
46
- mientras ella cantaba.
47
- mientras esperábamos el tren.
48
- mientras estudiaba para el examen.
49
- mientras leía un libro.
50
- porque es importante.
51
- porque estaba lloviendo.
52
- porque lo dijo él.
53
- porque no puedo esperar.
54
- porque quiero descansar.
55
- si decides venir.
56
- si encuentras mis llaves.
57
- si hay algo que decir.
58
- si hay tiempo suficiente.
59
- si lo deseas.
60
- si lo haces por mí.
61
- si me das una oportunidad.
62
- si me invitas a la fiesta.
63
- si no hay problemas.
64
- si no llego a tiempo.
65
- si no tienes planes.
66
- si puedo ayudar.
67
- si tienes alguna pregunta.
68
- si tienes tiempo.
69
- si tú me ayudas.
70
- siempre que estés listo.
71
- siempre que lo necesites.
72
- siempre que me necesites.
73
- siempre que sea necesario.
74
- siempre que sea posible.
1
+ antes de que anochezca
2
+ antes de que empiece la tormenta
3
+ aunque esté cansado
4
+ aunque esté ocupado
5
+ aunque me digas lo contrario
6
+ aunque me sienta nervioso
7
+ aunque no creas en
8
+ aunque no lo creas
9
+ aunque no lo entiendo
10
+ aunque no lo esperaba
11
+ aunque no lo recuerde
12
+ aunque no lo sepas
13
+ aunque no sea fácil
14
+ aunque no sea perfecto
15
+ aunque no tenga ganas
16
+ aunque parezca imposible
17
+ como si no pasara nada
18
+ cuando abrí la puerta
19
+ cuando cruzamos la calle
20
+ cuando el sol salió
21
+ cuando empecé a trabajar
22
+ cuando era niño
23
+ cuando escuché la noticia
24
+ cuando hable con el profesor
25
+ cuando llegó el paquete
26
+ cuando llegué a casa
27
+ cuando lleguen los invitados
28
+ cuando me despierto por la mañana
29
+ cuando me envíes el mensaje
30
+ cuando me llamaste
31
+ cuando me siento feliz
32
+ cuando pasamos por el parque
33
+ cuando salimos de vacaciones
34
+ cuando termine el día
35
+ cuando termine el trabajo
36
+ cuando termine la película
37
+ cuando vi a mis amigos
38
+ después de que acabe la conferencia
39
+ después de que cenamos
40
+ después de que comí
41
+ después de que hable con ella
42
+ después de que se fue
43
+ después de que termine la reunión
44
+ después de que terminó la clase
45
+ mientras él cocinaba
46
+ mientras ella cantaba
47
+ mientras esperábamos el tren
48
+ mientras estudiaba para el examen
49
+ mientras leía un libro
50
+ porque es importante
51
+ porque estaba lloviendo
52
+ porque lo dijo él
53
+ porque no puedo esperar
54
+ porque quiero descansar
55
+ si decides venir
56
+ si encuentras mis llaves
57
+ si hay algo que decir
58
+ si hay tiempo suficiente
59
+ si lo deseas
60
+ si lo haces por
61
+ si me das una oportunidad
62
+ si me invitas a la fiesta
63
+ si no hay problemas
64
+ si no llego a tiempo
65
+ si no tienes planes
66
+ si puedo ayudar
67
+ si tienes alguna pregunta
68
+ si tienes tiempo
69
+ si tú me ayudas
70
+ siempre que estés listo
71
+ siempre que lo necesites
72
+ siempre que me necesites
73
+ siempre que sea necesario
74
+ siempre que sea posible
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  name: spanish
3
3
  description: Spanish words
4
- triggers: [spanish,espanol]
4
+ triggers: [spanish,espanol,español,espanola,espanoles]
@@ -6,9 +6,6 @@
6
6
  ,.
7
7
  ¿,?
8
8
  ¿,?
9
- ¿,?
10
- ¡,!
11
- ¡,!
12
9
  ¡,!
13
10
 
14
11
  ",."
data/lib/random-words.rb CHANGED
@@ -8,6 +8,7 @@ require_relative 'random-words/version'
8
8
  require_relative 'random-words/string'
9
9
  require_relative 'random-words/hash'
10
10
  require_relative 'random-words/array'
11
+ require_relative 'random-words/boolean'
11
12
  require_relative 'random-words/source'
12
13
  require_relative 'random-words/config'
13
14
  require_relative 'random-words/generator'
data/src/_README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # RandomWords
2
2
  <!--README-->
3
3
 
4
- [![RubyGems.org](https://img.shields.io/gem/v/random-words)](https://rubygems.org/gems/random-words)
4
+ [![RubyGems.org](https://img.shields.io/gem/v/random-words)](https://rubygems.org/gems/random-words)[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
6
  A random text (Lorem Ipsum) generator.
7
7
 
@@ -18,7 +18,7 @@ you use [Homebrew](https://brew.sh).
18
18
  ### CLI
19
19
 
20
20
  The gem installs a binary `randw`. It can generate random
21
- characters, sentences, paragraphs, markdown, html, and
21
+ characters, sentences, paragraphs, markdown, html, and
22
22
  passwords.
23
23
 
24
24
  ```console
@@ -168,6 +168,7 @@ YAML configuration. It contains the keys:
168
168
  name: english
169
169
  description: English words
170
170
  triggers: [english]
171
+ extended_punctuation: false
171
172
  ```
172
173
 
173
174
  A default configuration file will be created when running `--create-dictionary` with the CLI.
@@ -178,8 +179,11 @@ A default configuration file will be created when running `--create-dictionary`
178
179
  - `description`: Just used for display when running `--list-dictionaries`
179
180
  - `triggers`: An array of triggers that can be used to trigger the language.
180
181
 
181
- For example, the `bacon` language has the triggers `[bacon, meat, carnivore]`, so you can use `randw -S meat` on the command line (or with the library).
182
-
182
+ For example, the `bacon` language has the triggers
183
+ `[bacon, meat, carnivore]`, so you can use `randw -S
184
+ meat` on the command line (or with the library).
185
+ - `extended_punctuation`: Whether to include extended
186
+ punctuation like parenthesis, quotes, and ellipsis.
183
187
 
184
188
 
185
189
  ##### Terminators
@@ -212,13 +216,13 @@ the most likely to be used.
212
216
 
213
217
  ##### Names
214
218
 
215
- The `names.txt` file is just used when creating block quotes
216
- in Markdown or HTML output. Sections are split by blank
217
- lines: first names, last names, and optionally full names.
218
- If the first line contains characters other than letters,
219
- single quotes, and dashes, it will be assumed that you've
220
- skipped straight to full names and those will be used
221
- instead of generating random combinations.
219
+ The `names.txt` file is just used when creating random
220
+ names. Sections are split by blank lines: first names, last
221
+ names, and optionally full names. If the first line contains
222
+ characters other than letters, single quotes, and dashes, it
223
+ will be assumed that you've skipped straight to full names
224
+ and those will be used instead of generating random
225
+ combinations.
222
226
 
223
227
  #### Language Notes
224
228
 
@@ -233,8 +237,11 @@ If you create a fun dictionary, please let me know (or make a PR) and I'll gladl
233
237
  ```ruby
234
238
  require 'random-words'
235
239
 
236
- # Argument defines source dictionary (latin, english, corporate, bacon)
240
+ # Argument defines source dictionary (latin, english, corporate, bacon, etc.)
237
241
  rw = RandomWords::Generator.new(:corporate)
242
+
243
+ rw.sources # List all available dictionaries
244
+
238
245
  # Change source dictionary and re-init
239
246
  rw.source = :bacon
240
247
 
@@ -283,3 +290,7 @@ rw.paragraph_length
283
290
  rw.sentence_length
284
291
  ```
285
292
  <!--END README-->
293
+
294
+ ### License
295
+
296
+ This project is licensed under the [MIT license](LICENSE).
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.8
4
+ version: 1.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-04-17 00:00:00.000000000 Z
10
+ date: 2025-04-20 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: nokogiri
@@ -38,12 +38,13 @@ files:
38
38
  - ".vscode/launch.json"
39
39
  - CHANGELOG.md
40
40
  - Gemfile
41
- - Gemfile.lock
41
+ - LICENSE
42
42
  - README.md
43
43
  - Rakefile
44
44
  - bin/randw
45
45
  - lib/random-words.rb
46
46
  - lib/random-words/array.rb
47
+ - lib/random-words/boolean.rb
47
48
  - lib/random-words/config.rb
48
49
  - lib/random-words/generator.rb
49
50
  - lib/random-words/hash.rb
data/Gemfile.lock DELETED
@@ -1,131 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- random-words (1.0.8)
5
- nokogiri (~> 1.12)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- ansi (1.5.0)
11
- ast (2.4.3)
12
- awesome_print (1.9.2)
13
- diff-lcs (1.6.1)
14
- docile (1.4.1)
15
- gem-release (2.2.4)
16
- json (2.10.2)
17
- language_server-protocol (3.17.0.4)
18
- lint_roller (1.1.0)
19
- mini_portile2 (2.8.8)
20
- multi_json (1.15.0)
21
- nokogiri (1.18.7)
22
- mini_portile2 (~> 2.8.2)
23
- racc (~> 1.4)
24
- nokogiri (1.18.7-arm64-darwin)
25
- racc (~> 1.4)
26
- parallel (1.27.0)
27
- parse_gemspec (1.0.0)
28
- parse_gemspec-cli (1.0.0)
29
- multi_json
30
- parse_gemspec
31
- thor
32
- parser (3.3.8.0)
33
- ast (~> 2.4.1)
34
- racc
35
- prism (1.4.0)
36
- racc (1.8.1)
37
- rainbow (3.1.1)
38
- rake (13.2.1)
39
- rdoc (6.3.4.1)
40
- regexp_parser (2.10.0)
41
- rspec (3.13.0)
42
- rspec-core (~> 3.13.0)
43
- rspec-expectations (~> 3.13.0)
44
- rspec-mocks (~> 3.13.0)
45
- rspec-core (3.13.3)
46
- rspec-support (~> 3.13.0)
47
- rspec-expectations (3.13.3)
48
- diff-lcs (>= 1.2.0, < 2.0)
49
- rspec-support (~> 3.13.0)
50
- rspec-mocks (3.13.2)
51
- diff-lcs (>= 1.2.0, < 2.0)
52
- rspec-support (~> 3.13.0)
53
- rspec-support (3.13.2)
54
- rubocop (1.75.2)
55
- json (~> 2.3)
56
- language_server-protocol (~> 3.17.0.2)
57
- lint_roller (~> 1.1.0)
58
- parallel (~> 1.10)
59
- parser (>= 3.3.0.2)
60
- rainbow (>= 2.2.2, < 4.0)
61
- regexp_parser (>= 2.9.3, < 3.0)
62
- rubocop-ast (>= 1.44.0, < 2.0)
63
- ruby-progressbar (~> 1.7)
64
- unicode-display_width (>= 2.4.0, < 4.0)
65
- rubocop-ast (1.44.1)
66
- parser (>= 3.3.7.2)
67
- prism (~> 1.4)
68
- rubocop-capybara (2.22.1)
69
- lint_roller (~> 1.1)
70
- rubocop (~> 1.72, >= 1.72.1)
71
- rubocop-performance (1.25.0)
72
- lint_roller (~> 1.1)
73
- rubocop (>= 1.75.0, < 2.0)
74
- rubocop-ast (>= 1.38.0, < 2.0)
75
- rubocop-rspec (2.20.0)
76
- rubocop (~> 1.33)
77
- rubocop-capybara (~> 2.17)
78
- ruby-progressbar (1.13.0)
79
- simplecov (0.22.0)
80
- docile (~> 1.1)
81
- simplecov-html (~> 0.11)
82
- simplecov_json_formatter (~> 0.1)
83
- simplecov-console (0.9.3)
84
- ansi
85
- simplecov
86
- terminal-table
87
- simplecov-html (0.13.1)
88
- simplecov_json_formatter (0.1.4)
89
- standard (1.49.0)
90
- language_server-protocol (~> 3.17.0.2)
91
- lint_roller (~> 1.0)
92
- rubocop (~> 1.75.2)
93
- standard-custom (~> 1.0.0)
94
- standard-performance (~> 1.8)
95
- standard-custom (1.0.2)
96
- lint_roller (~> 1.0)
97
- rubocop (~> 1.50)
98
- standard-performance (1.8.0)
99
- lint_roller (~> 1.1)
100
- rubocop-performance (~> 1.25.0)
101
- terminal-table (4.0.0)
102
- unicode-display_width (>= 1.1.1, < 4)
103
- thor (1.3.2)
104
- unicode-display_width (3.1.4)
105
- unicode-emoji (~> 4.0, >= 4.0.4)
106
- unicode-emoji (4.0.4)
107
- yard (0.9.37)
108
-
109
- PLATFORMS
110
- arm64-darwin-24
111
- ruby
112
-
113
- DEPENDENCIES
114
- awesome_print (~> 1.9)
115
- bundler (~> 2.0)
116
- gem-release (~> 2.2)
117
- parse_gemspec-cli (~> 1.0)
118
- rake (~> 13.0)
119
- random-words!
120
- rdoc (~> 6.3.4.1)
121
- rspec (~> 3.0)
122
- rubocop (~> 1.75.2)
123
- rubocop-performance (~> 1.25.0)
124
- rubocop-rspec (~> 2.0)
125
- simplecov (~> 0.21)
126
- simplecov-console (~> 0.9)
127
- standard (~> 1.3)
128
- yard (~> 0.9, >= 0.9.36)
129
-
130
- BUNDLED WITH
131
- 2.6.6