random-words 1.0.6 → 1.0.7
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/.rspec_status +118 -100
- data/.rubocop.yml +4 -1
- data/.rubocop_todo.yml +313 -0
- data/CHANGELOG.md +26 -1
- data/Gemfile +15 -12
- data/Gemfile.lock +44 -27
- data/README.md +81 -37
- data/bin/randw +109 -89
- data/lib/random-words/array.rb +27 -7
- data/lib/random-words/config.rb +29 -23
- data/lib/random-words/generator.rb +42 -25
- data/lib/random-words/hash.rb +1 -1
- data/lib/random-words/html2markdown.rb +7 -7
- data/lib/random-words/lorem-markdown.rb +19 -20
- data/lib/random-words/number-to-word.rb +23 -21
- data/lib/random-words/source.rb +10 -9
- data/lib/random-words/string.rb +22 -17
- data/lib/random-words/table-cleanup.rb +3 -3
- data/lib/random-words/version.rb +1 -1
- data/lib/random-words/words/1984/names.txt +10 -72
- data/lib/random-words/words/1984/phrases.txt +16 -0
- data/lib/random-words/words/alice/names.txt +10 -74
- data/lib/random-words/words/alice/phrases.txt +16 -0
- data/lib/random-words/words/bacon/names.txt +53 -73
- data/lib/random-words/words/bacon/phrases.txt +20 -0
- data/lib/random-words/words/corporate/phrases.txt +29 -0
- data/lib/random-words/words/doctor/names.txt +18 -18
- data/lib/random-words/words/doctor/phrases.txt +29 -0
- data/lib/random-words/words/english/phrases.txt +29 -0
- data/lib/random-words/words/foulmouth/articles-plural.txt +3 -1
- data/lib/random-words/words/foulmouth/articles-singular.txt +2 -1
- data/lib/random-words/words/foulmouth/config.yml +1 -1
- data/lib/random-words/words/foulmouth/names.txt +80 -73
- data/lib/random-words/words/foulmouth/phrases.txt +30 -0
- data/lib/random-words/words/hipster/names.txt +72 -73
- data/lib/random-words/words/hipster/phrases.txt +21 -0
- data/lib/random-words/words/latin/names.txt +92 -73
- data/lib/random-words/words/latin/phrases.txt +16 -0
- data/lib/random-words/words/spanish/names.txt +55 -68
- data/lib/random-words/words/spanish/phrases.txt +31 -0
- data/lib/random-words/words/veggie/names.txt +92 -73
- data/lib/random-words/words/veggie/phrases.txt +20 -0
- data/lib/random-words.rb +3 -3
- data/random-words.gemspec +1 -1
- data/src/_README.md +81 -37
- metadata +15 -4
data/Gemfile
CHANGED
@@ -1,18 +1,21 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in snibbets.gemspec.
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
14
|
-
gem
|
15
|
-
gem
|
16
|
-
gem
|
17
|
-
gem
|
18
|
-
gem
|
8
|
+
gem "awesome_print", "~> 1.9"
|
9
|
+
gem "bundler", "~> 2.0"
|
10
|
+
gem "gem-release", "~> 2.2"
|
11
|
+
gem "parse_gemspec-cli", "~> 1.0"
|
12
|
+
gem "rake", "~> 13.0"
|
13
|
+
gem "rdoc", "~> 6.3.4.1"
|
14
|
+
gem "rspec", "~> 3.0"
|
15
|
+
gem "simplecov", "~> 0.21"
|
16
|
+
gem "simplecov-console", "~> 0.9"
|
17
|
+
gem "standard", "~> 1.3"
|
18
|
+
gem "yard", "~> 0.9", ">= 0.9.36"
|
19
|
+
gem "rubocop", "~> 1.75.2"
|
20
|
+
gem "rubocop-performance", "~> 1.25.0"
|
21
|
+
gem "rubocop-rspec", "~> 2.0"
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
random-words (1.0.
|
4
|
+
random-words (1.0.7)
|
5
5
|
nokogiri (~> 1.12)
|
6
6
|
|
7
7
|
GEM
|
@@ -12,20 +12,24 @@ GEM
|
|
12
12
|
awesome_print (1.9.2)
|
13
13
|
diff-lcs (1.6.1)
|
14
14
|
docile (1.4.1)
|
15
|
-
gem-release (2.2.
|
15
|
+
gem-release (2.2.4)
|
16
16
|
json (2.10.2)
|
17
17
|
language_server-protocol (3.17.0.4)
|
18
18
|
lint_roller (1.1.0)
|
19
|
+
mini_portile2 (2.8.8)
|
19
20
|
multi_json (1.15.0)
|
20
|
-
nokogiri (1.18.
|
21
|
+
nokogiri (1.18.7)
|
22
|
+
mini_portile2 (~> 2.8.2)
|
21
23
|
racc (~> 1.4)
|
22
|
-
|
24
|
+
nokogiri (1.18.7-arm64-darwin)
|
25
|
+
racc (~> 1.4)
|
26
|
+
parallel (1.27.0)
|
23
27
|
parse_gemspec (1.0.0)
|
24
28
|
parse_gemspec-cli (1.0.0)
|
25
29
|
multi_json
|
26
30
|
parse_gemspec
|
27
31
|
thor
|
28
|
-
parser (3.3.
|
32
|
+
parser (3.3.8.0)
|
29
33
|
ast (~> 2.4.1)
|
30
34
|
racc
|
31
35
|
prism (1.4.0)
|
@@ -34,7 +38,6 @@ GEM
|
|
34
38
|
rake (13.2.1)
|
35
39
|
rdoc (6.3.4.1)
|
36
40
|
regexp_parser (2.10.0)
|
37
|
-
rexml (3.4.1)
|
38
41
|
rspec (3.13.0)
|
39
42
|
rspec-core (~> 3.13.0)
|
40
43
|
rspec-expectations (~> 3.13.0)
|
@@ -48,48 +51,59 @@ GEM
|
|
48
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
52
|
rspec-support (~> 3.13.0)
|
50
53
|
rspec-support (3.13.2)
|
51
|
-
rubocop (1.
|
54
|
+
rubocop (1.75.2)
|
52
55
|
json (~> 2.3)
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
57
|
+
lint_roller (~> 1.1.0)
|
53
58
|
parallel (~> 1.10)
|
54
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.3.0.2)
|
55
60
|
rainbow (>= 2.2.2, < 4.0)
|
56
|
-
regexp_parser (>=
|
57
|
-
|
58
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
61
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
62
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
59
63
|
ruby-progressbar (~> 1.7)
|
60
|
-
unicode-display_width (>= 2.4.0, <
|
61
|
-
rubocop-ast (1.
|
64
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
65
|
+
rubocop-ast (1.44.1)
|
62
66
|
parser (>= 3.3.7.2)
|
63
67
|
prism (~> 1.4)
|
64
|
-
rubocop-
|
65
|
-
|
66
|
-
rubocop
|
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)
|
67
78
|
ruby-progressbar (1.13.0)
|
68
79
|
simplecov (0.22.0)
|
69
80
|
docile (~> 1.1)
|
70
81
|
simplecov-html (~> 0.11)
|
71
82
|
simplecov_json_formatter (~> 0.1)
|
72
|
-
simplecov-console (0.9.
|
83
|
+
simplecov-console (0.9.3)
|
73
84
|
ansi
|
74
85
|
simplecov
|
75
86
|
terminal-table
|
76
87
|
simplecov-html (0.13.1)
|
77
88
|
simplecov_json_formatter (0.1.4)
|
78
|
-
standard (1.
|
89
|
+
standard (1.49.0)
|
79
90
|
language_server-protocol (~> 3.17.0.2)
|
80
91
|
lint_roller (~> 1.0)
|
81
|
-
rubocop (~> 1.
|
92
|
+
rubocop (~> 1.75.2)
|
82
93
|
standard-custom (~> 1.0.0)
|
83
|
-
standard-performance (~> 1.
|
84
|
-
standard-custom (1.0.
|
85
|
-
lint_roller (~> 1.0)
|
86
|
-
standard-performance (1.1.0)
|
94
|
+
standard-performance (~> 1.8)
|
95
|
+
standard-custom (1.0.2)
|
87
96
|
lint_roller (~> 1.0)
|
88
|
-
rubocop
|
89
|
-
|
90
|
-
|
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)
|
91
103
|
thor (1.3.2)
|
92
|
-
unicode-display_width (
|
104
|
+
unicode-display_width (3.1.4)
|
105
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
106
|
+
unicode-emoji (4.0.4)
|
93
107
|
yard (0.9.37)
|
94
108
|
|
95
109
|
PLATFORMS
|
@@ -105,6 +119,9 @@ DEPENDENCIES
|
|
105
119
|
random-words!
|
106
120
|
rdoc (~> 6.3.4.1)
|
107
121
|
rspec (~> 3.0)
|
122
|
+
rubocop (~> 1.75.2)
|
123
|
+
rubocop-performance (~> 1.25.0)
|
124
|
+
rubocop-rspec (~> 2.0)
|
108
125
|
simplecov (~> 0.21)
|
109
126
|
simplecov-console (~> 0.9)
|
110
127
|
standard (~> 1.3)
|
data/README.md
CHANGED
@@ -16,25 +16,38 @@ you use [Homebrew](https://brew.sh).
|
|
16
16
|
|
17
17
|
### CLI
|
18
18
|
|
19
|
-
The gem installs a binary `randw`. It can generate random
|
19
|
+
The gem installs a binary `randw`. It can generate random
|
20
|
+
characters, sentences, paragraphs, markdown, html, and
|
21
|
+
passwords.
|
20
22
|
|
21
23
|
```console
|
22
24
|
Usage: randw [options]
|
23
25
|
OPTIONS:
|
24
|
-
-S, --source
|
25
|
-
-l [short|medium|long|very_long]
|
26
|
-
--length
|
27
|
-
--
|
28
|
-
-s, --sentences [NUMBER] Generate random sentences
|
26
|
+
-S, --source SOURCE Specify the source language (default: latin)
|
27
|
+
-l, --length LENGTH Specify the length of the sentence [short|medium|long|very_long]
|
28
|
+
--graf-length NUMBER Specify the number of sentences in a paragraph
|
29
|
+
--[no-]extended Specify whether to use extended punctuation in generated text
|
29
30
|
GENERATORS:
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
|
31
|
+
-s, --sentences [NUMBER] Generate NUMBER of random sentences (default: 3)
|
32
|
+
-p, --paragraphs [NUMBER] Generate NUMBER of random paragraphs (default: 3)
|
33
|
+
-w, --words [NUMBER] Generate NUMBER of random words (default: 10)
|
34
|
+
-c, --characters [NUMBER] Generate random characters of length (default: 100)
|
35
|
+
-m, --markdown [SETTINGS] Generate random markdown text, comma separated string like "latin,10,all"
|
36
|
+
dec: add em and strong
|
37
|
+
link: add links
|
38
|
+
ul: add unordered lists
|
39
|
+
ol: add ordered lists
|
40
|
+
dl: add definition lists
|
41
|
+
bq: add block quotes
|
42
|
+
code: add code spans and block
|
43
|
+
mark: add ==highlights==
|
44
|
+
headers: add headlines
|
45
|
+
image: add images
|
46
|
+
table: add tables
|
47
|
+
-H, --html [SETTINGS] Generate random html text, comma separated string like "latin,10,all"
|
48
|
+
--password [LENGTH] Generate a random password of LENGTH (default: 20)
|
35
49
|
PASSWORD OPTIONS:
|
36
|
-
--separator
|
37
|
-
--[no-]extended Specify whether to use extended punctuation in generated text
|
50
|
+
--separator CHAR Specify the separator character for the password (default: " ")
|
38
51
|
-n, --[no-]whitespace Specify whether to remove whitespace in generated text (characters only)
|
39
52
|
DICTIONARIES:
|
40
53
|
--list-dictionaries List available dictionaries
|
@@ -78,9 +91,23 @@ The number of elements inserted depends on the length you specify.
|
|
78
91
|
|
79
92
|
Example commands:
|
80
93
|
|
81
|
-
|
82
|
-
|
94
|
+
```console
|
95
|
+
$ randw -m "latin/1/short/ol"
|
96
|
+
|
97
|
+
Illa brevis muros potior arcesso, apud multae octo centum nonaginta octo nodum! Haec ruosus misericordia mox contendo, apud nullus fors.
|
98
|
+
|
99
|
+
|
100
|
+
1. Hoc cognatus opus facile complor latus discendo
|
101
|
+
2. Aliqua apparens census quod nego
|
102
|
+
3. Nullus salvus dux apud habeo spectabilis
|
103
|
+
4. Quaedam sensus regnum cura gaudeo ornatus faeneo mox
|
104
|
+
|
105
|
+
$ randw -m "english,5,all"
|
83
106
|
|
107
|
+
# Any shiny napkin effectively picks
|
108
|
+
|
109
|
+
Neither sudden lake exceedingly works, outside a clarity even if which is a source of _an_ strength even if which holds _one subtle horse_ the future. Any lovable tank remarkabl...
|
110
|
+
```
|
84
111
|
|
85
112
|
#### Creating A New Dictionary
|
86
113
|
|
@@ -118,9 +145,11 @@ clauses.txt
|
|
118
145
|
config.yml
|
119
146
|
conjunctions-coordinating.txt
|
120
147
|
conjunctions-subordinate.txt
|
148
|
+
names.txt
|
121
149
|
nouns-plural.txt
|
122
150
|
nouns-singular.txt
|
123
151
|
numbers.txt
|
152
|
+
phrases.txt
|
124
153
|
prepositions.txt
|
125
154
|
terminators.txt
|
126
155
|
verbs-passive.txt
|
@@ -128,8 +157,34 @@ verbs-plural.txt
|
|
128
157
|
verbs-singular.txt
|
129
158
|
```
|
130
159
|
|
160
|
+
##### Language Configuration
|
161
|
+
|
162
|
+
The `config.yml` file in a language directory is a simple
|
163
|
+
YAML configuration. It contains the keys:
|
164
|
+
|
165
|
+
```yaml
|
166
|
+
---
|
167
|
+
name: english
|
168
|
+
description: English words
|
169
|
+
triggers: [english]
|
170
|
+
```
|
171
|
+
|
172
|
+
A default configuration file will be created when running `--create-dictionary` with the CLI.
|
173
|
+
|
174
|
+
- `name`: The name of the dictionary
|
175
|
+
|
176
|
+
This should be the same as the directory name in most cases
|
177
|
+
- `description`: Just used for display when running `--list-dictionaries`
|
178
|
+
- `triggers`: An array of triggers that can be used to trigger the language.
|
179
|
+
|
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
|
+
|
182
|
+
|
183
|
+
|
184
|
+
##### Terminators
|
185
|
+
|
131
186
|
The `terminators.txt` file contains pairs of punctuation,
|
132
|
-
separated by commas, one per line. If a
|
187
|
+
separated by commas, one per line. If a sentence terminator
|
133
188
|
doesn't have opening punctuation, start the line with a
|
134
189
|
comma. More than one character can be used in either side of
|
135
190
|
the pair. For example, to create a double quoted sentence
|
@@ -154,30 +209,19 @@ default terminator.txt files, the period, question mark, and
|
|
154
209
|
exclamation point are repeated multiple times to make them
|
155
210
|
the most likely to be used.
|
156
211
|
|
212
|
+
##### Names
|
157
213
|
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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.
|
162
221
|
|
163
|
-
|
164
|
-
---
|
165
|
-
name: english
|
166
|
-
description: English words
|
167
|
-
triggers: [english]
|
168
|
-
```
|
169
|
-
|
170
|
-
A default configuration file will be created when running `--create-dictionary` with the CLI.
|
171
|
-
|
172
|
-
- `name`: The name of the dictionary
|
173
|
-
|
174
|
-
This should be the same as the directory name in most cases
|
175
|
-
- `description`: Just used for display when running `--list-dictionaries`
|
176
|
-
- `triggers`: An array of triggers that can be used to trigger the language.
|
177
|
-
|
178
|
-
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).
|
222
|
+
#### Language Notes
|
179
223
|
|
180
|
-
|
224
|
+
RandomWords loosely uses English rules for sentence construction, so non-English languages will likely generate even more nonsensical strings.
|
181
225
|
|
182
226
|
If you create a fun dictionary, please let me know (or make a PR) and I'll gladly include (most) new dictionaries in the main distribution.
|
183
227
|
|