random-words 1.0.5 → 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 +166 -39
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +313 -0
- data/CHANGELOG.md +67 -0
- data/Gemfile +15 -12
- data/Gemfile.lock +46 -26
- data/README.md +208 -15
- data/bin/randw +258 -92
- data/lib/random-words/array.rb +71 -0
- data/lib/random-words/config.rb +254 -0
- data/lib/random-words/generator.rb +257 -94
- data/lib/random-words/hash.rb +16 -0
- data/lib/random-words/html2markdown.rb +205 -0
- data/lib/random-words/lorem-markdown.rb +397 -0
- data/lib/random-words/number-to-word.rb +139 -0
- data/lib/random-words/source.rb +106 -0
- data/lib/random-words/string.rb +224 -45
- data/lib/random-words/table-cleanup.rb +210 -0
- data/lib/random-words/version.rb +1 -1
- data/lib/random-words/words/1984/adjectives.txt +103 -0
- data/lib/random-words/words/1984/adverbs.txt +92 -0
- data/lib/random-words/words/1984/articles-plural.txt +10 -0
- data/lib/random-words/words/1984/articles-singular.txt +10 -0
- data/lib/random-words/words/1984/clauses.txt +79 -0
- data/lib/random-words/words/1984/config.yml +4 -0
- data/lib/random-words/words/1984/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/1984/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/1984/names.txt +12 -0
- data/lib/random-words/words/1984/nouns-plural.txt +89 -0
- data/lib/random-words/words/1984/nouns-singular.txt +74 -0
- data/lib/random-words/words/1984/numbers.yml +5 -0
- data/lib/random-words/words/1984/phrases.txt +16 -0
- data/lib/random-words/words/1984/prepositions.txt +89 -0
- data/lib/random-words/words/1984/terminators.txt +16 -0
- data/lib/random-words/words/1984/verbs-passive.txt +83 -0
- data/lib/random-words/words/1984/verbs-plural.txt +91 -0
- data/lib/random-words/words/1984/verbs-singular.txt +110 -0
- data/lib/random-words/words/alice/adjectives.txt +80 -0
- data/lib/random-words/words/alice/adverbs.txt +87 -0
- data/lib/random-words/words/alice/articles-plural.txt +10 -0
- data/lib/random-words/words/alice/articles-singular.txt +10 -0
- data/lib/random-words/words/alice/clauses.txt +81 -0
- data/lib/random-words/words/alice/config.yml +4 -0
- data/lib/random-words/words/alice/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/alice/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/alice/names.txt +10 -0
- data/lib/random-words/words/alice/nouns-plural.txt +95 -0
- data/lib/random-words/words/alice/nouns-singular.txt +82 -0
- data/lib/random-words/words/alice/numbers.yml +5 -0
- data/lib/random-words/words/alice/phrases.txt +16 -0
- data/lib/random-words/words/alice/prepositions.txt +45 -0
- data/lib/random-words/words/alice/terminators.txt +16 -0
- data/lib/random-words/words/alice/verbs-passive.txt +495 -0
- data/lib/random-words/words/alice/verbs-plural.txt +115 -0
- data/lib/random-words/words/alice/verbs-singular.txt +97 -0
- data/lib/random-words/words/bacon/clauses.txt +592 -592
- data/lib/random-words/words/bacon/config.yml +4 -0
- data/lib/random-words/words/bacon/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/bacon/names.txt +54 -0
- data/lib/random-words/words/bacon/numbers.yml +5 -0
- data/lib/random-words/words/bacon/phrases.txt +20 -0
- data/lib/random-words/words/bacon/prepositions.txt +45 -0
- data/lib/random-words/words/bacon/terminators.txt +16 -0
- data/lib/random-words/words/corporate/config.yml +4 -0
- data/lib/random-words/words/corporate/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/corporate/names.txt +74 -0
- data/lib/random-words/words/corporate/numbers.yml +5 -0
- data/lib/random-words/words/corporate/phrases.txt +29 -0
- data/lib/random-words/words/corporate/prepositions.txt +45 -0
- data/lib/random-words/words/corporate/terminators.txt +16 -0
- data/lib/random-words/words/doctor/adjectives.txt +92 -0
- data/lib/random-words/words/doctor/adverbs.txt +92 -0
- data/lib/random-words/words/doctor/articles-plural.txt +10 -0
- data/lib/random-words/words/doctor/articles-singular.txt +10 -0
- data/lib/random-words/words/doctor/clauses.txt +83 -0
- data/lib/random-words/words/doctor/config.yml +10 -0
- data/lib/random-words/words/doctor/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/doctor/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/doctor/names.txt +74 -0
- data/lib/random-words/words/doctor/nouns-plural.txt +84 -0
- data/lib/random-words/words/doctor/nouns-singular.txt +84 -0
- data/lib/random-words/words/doctor/numbers.yml +5 -0
- data/lib/random-words/words/doctor/phrases.txt +29 -0
- data/lib/random-words/words/doctor/prepositions.txt +45 -0
- data/lib/random-words/words/doctor/terminators.txt +16 -0
- data/lib/random-words/words/doctor/verbs-passive.txt +83 -0
- data/lib/random-words/words/doctor/verbs-plural.txt +88 -0
- data/lib/random-words/words/doctor/verbs-singular.txt +83 -0
- data/lib/random-words/words/english/clauses.txt +592 -592
- data/lib/random-words/words/english/config.yml +4 -0
- data/lib/random-words/words/english/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/english/names.txt +74 -0
- data/lib/random-words/words/english/numbers.yml +5 -0
- data/lib/random-words/words/english/phrases.txt +29 -0
- data/lib/random-words/words/english/prepositions.txt +45 -0
- data/lib/random-words/words/english/terminators.txt +16 -0
- data/lib/random-words/words/english/verbs-plural.txt +1 -0
- data/lib/random-words/words/english/verbs-singular.txt +1 -0
- data/lib/random-words/words/foulmouth/adjectives.txt +89 -0
- data/lib/random-words/words/foulmouth/adverbs.txt +97 -0
- data/lib/random-words/words/foulmouth/articles-plural.txt +12 -0
- data/lib/random-words/words/foulmouth/articles-singular.txt +11 -0
- data/lib/random-words/words/foulmouth/clauses.txt +74 -0
- data/lib/random-words/words/foulmouth/config.yml +4 -0
- data/lib/random-words/words/foulmouth/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/foulmouth/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/foulmouth/names.txt +81 -0
- data/lib/random-words/words/foulmouth/nouns-plural.txt +96 -0
- data/lib/random-words/words/foulmouth/nouns-singular.txt +99 -0
- data/lib/random-words/words/foulmouth/numbers.yml +5 -0
- data/lib/random-words/words/foulmouth/phrases.txt +30 -0
- data/lib/random-words/words/foulmouth/prepositions.txt +35 -0
- data/lib/random-words/words/foulmouth/terminators.txt +16 -0
- data/lib/random-words/words/foulmouth/verbs-passive.txt +143 -0
- data/lib/random-words/words/foulmouth/verbs-plural.txt +91 -0
- data/lib/random-words/words/foulmouth/verbs-singular.txt +104 -0
- data/lib/random-words/words/hipster/adjectives.txt +100 -0
- data/lib/random-words/words/hipster/adverbs.txt +89 -0
- data/lib/random-words/words/hipster/articles-plural.txt +10 -0
- data/lib/random-words/words/hipster/articles-singular.txt +10 -0
- data/lib/random-words/words/hipster/clauses.txt +180 -0
- data/lib/random-words/words/hipster/config.yml +4 -0
- data/lib/random-words/words/hipster/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/hipster/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/hipster/names.txt +73 -0
- data/lib/random-words/words/hipster/nouns-plural.txt +96 -0
- data/lib/random-words/words/hipster/nouns-singular.txt +100 -0
- data/lib/random-words/words/hipster/numbers.yml +5 -0
- data/lib/random-words/words/hipster/phrases.txt +21 -0
- data/lib/random-words/words/hipster/prepositions.txt +45 -0
- data/lib/random-words/words/hipster/terminators.txt +16 -0
- data/lib/random-words/words/hipster/verbs-passive.txt +88 -0
- data/lib/random-words/words/hipster/verbs-plural.txt +106 -0
- data/lib/random-words/words/hipster/verbs-singular.txt +114 -0
- data/lib/random-words/words/latin/config.yml +4 -0
- data/lib/random-words/words/latin/conjunctions-coordinating.txt +15 -0
- data/lib/random-words/words/latin/names.txt +93 -0
- data/lib/random-words/words/latin/numbers.yml +5 -0
- data/lib/random-words/words/latin/phrases.txt +16 -0
- data/lib/random-words/words/latin/prepositions.txt +18 -0
- data/lib/random-words/words/latin/terminators.txt +16 -0
- data/lib/random-words/words/spanish/adjectives.txt +81 -0
- data/lib/random-words/words/spanish/adverbs.txt +87 -0
- data/lib/random-words/words/spanish/articles-plural.txt +4 -0
- data/lib/random-words/words/spanish/articles-singular.txt +4 -0
- data/lib/random-words/words/spanish/clauses.txt +74 -0
- data/lib/random-words/words/spanish/config.yml +4 -0
- data/lib/random-words/words/spanish/conjunctions-coordinating.txt +8 -0
- data/lib/random-words/words/spanish/conjunctions-subordinate.txt +16 -0
- data/lib/random-words/words/spanish/names.txt +61 -0
- data/lib/random-words/words/spanish/nouns-plural.txt +92 -0
- data/lib/random-words/words/spanish/nouns-singular.txt +125 -0
- data/lib/random-words/words/spanish/numbers.yml +5 -0
- data/lib/random-words/words/spanish/phrases.txt +31 -0
- data/lib/random-words/words/spanish/prepositions.txt +31 -0
- data/lib/random-words/words/spanish/terminators.txt +17 -0
- data/lib/random-words/words/spanish/verbs-passive.txt +495 -0
- data/lib/random-words/words/spanish/verbs-plural.txt +326 -0
- data/lib/random-words/words/spanish/verbs-singular.txt +351 -0
- data/lib/random-words/words/veggie/adjectives.txt +111 -0
- data/lib/random-words/words/veggie/adverbs.txt +81 -0
- data/lib/random-words/words/veggie/articles-plural.txt +10 -0
- data/lib/random-words/words/veggie/articles-singular.txt +10 -0
- data/lib/random-words/words/veggie/clauses.txt +57 -0
- data/lib/random-words/words/veggie/config.yml +4 -0
- data/lib/random-words/words/veggie/conjunctions-coordinating.txt +20 -0
- data/lib/random-words/words/veggie/conjunctions-subordinate.txt +29 -0
- data/lib/random-words/words/veggie/names.txt +93 -0
- data/lib/random-words/words/veggie/nouns-plural.txt +78 -0
- data/lib/random-words/words/veggie/nouns-singular.txt +105 -0
- data/lib/random-words/words/veggie/numbers.yml +5 -0
- data/lib/random-words/words/veggie/phrases.txt +20 -0
- data/lib/random-words/words/veggie/prepositions.txt +45 -0
- data/lib/random-words/words/veggie/terminators.txt +16 -0
- data/lib/random-words/words/veggie/verbs-passive.txt +56 -0
- data/lib/random-words/words/veggie/verbs-plural.txt +79 -0
- data/lib/random-words/words/veggie/verbs-singular.txt +79 -0
- data/lib/random-words.rb +28 -0
- data/random-words.gemspec +3 -1
- data/src/_README.md +208 -15
- metadata +181 -9
- data/lib/random-words/words/bacon/numbers.txt +0 -21
- data/lib/random-words/words/corporate/numbers.txt +0 -21
- data/lib/random-words/words/english/numbers.txt +0 -21
- data/lib/random-words/words/latin/numbers.txt +0 -21
data/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
random-words (1.0.
|
4
|
+
random-words (1.0.7)
|
5
|
+
nokogiri (~> 1.12)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
@@ -11,18 +12,24 @@ GEM
|
|
11
12
|
awesome_print (1.9.2)
|
12
13
|
diff-lcs (1.6.1)
|
13
14
|
docile (1.4.1)
|
14
|
-
gem-release (2.2.
|
15
|
+
gem-release (2.2.4)
|
15
16
|
json (2.10.2)
|
16
17
|
language_server-protocol (3.17.0.4)
|
17
18
|
lint_roller (1.1.0)
|
19
|
+
mini_portile2 (2.8.8)
|
18
20
|
multi_json (1.15.0)
|
19
|
-
|
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)
|
20
27
|
parse_gemspec (1.0.0)
|
21
28
|
parse_gemspec-cli (1.0.0)
|
22
29
|
multi_json
|
23
30
|
parse_gemspec
|
24
31
|
thor
|
25
|
-
parser (3.3.
|
32
|
+
parser (3.3.8.0)
|
26
33
|
ast (~> 2.4.1)
|
27
34
|
racc
|
28
35
|
prism (1.4.0)
|
@@ -31,7 +38,6 @@ GEM
|
|
31
38
|
rake (13.2.1)
|
32
39
|
rdoc (6.3.4.1)
|
33
40
|
regexp_parser (2.10.0)
|
34
|
-
rexml (3.4.1)
|
35
41
|
rspec (3.13.0)
|
36
42
|
rspec-core (~> 3.13.0)
|
37
43
|
rspec-expectations (~> 3.13.0)
|
@@ -45,48 +51,59 @@ GEM
|
|
45
51
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
52
|
rspec-support (~> 3.13.0)
|
47
53
|
rspec-support (3.13.2)
|
48
|
-
rubocop (1.
|
54
|
+
rubocop (1.75.2)
|
49
55
|
json (~> 2.3)
|
56
|
+
language_server-protocol (~> 3.17.0.2)
|
57
|
+
lint_roller (~> 1.1.0)
|
50
58
|
parallel (~> 1.10)
|
51
|
-
parser (>= 3.
|
59
|
+
parser (>= 3.3.0.2)
|
52
60
|
rainbow (>= 2.2.2, < 4.0)
|
53
|
-
regexp_parser (>=
|
54
|
-
|
55
|
-
rubocop-ast (>= 1.28.0, < 2.0)
|
61
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
62
|
+
rubocop-ast (>= 1.44.0, < 2.0)
|
56
63
|
ruby-progressbar (~> 1.7)
|
57
|
-
unicode-display_width (>= 2.4.0, <
|
58
|
-
rubocop-ast (1.
|
64
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
65
|
+
rubocop-ast (1.44.1)
|
59
66
|
parser (>= 3.3.7.2)
|
60
67
|
prism (~> 1.4)
|
61
|
-
rubocop-
|
62
|
-
|
63
|
-
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)
|
64
78
|
ruby-progressbar (1.13.0)
|
65
79
|
simplecov (0.22.0)
|
66
80
|
docile (~> 1.1)
|
67
81
|
simplecov-html (~> 0.11)
|
68
82
|
simplecov_json_formatter (~> 0.1)
|
69
|
-
simplecov-console (0.9.
|
83
|
+
simplecov-console (0.9.3)
|
70
84
|
ansi
|
71
85
|
simplecov
|
72
86
|
terminal-table
|
73
87
|
simplecov-html (0.13.1)
|
74
88
|
simplecov_json_formatter (0.1.4)
|
75
|
-
standard (1.
|
89
|
+
standard (1.49.0)
|
76
90
|
language_server-protocol (~> 3.17.0.2)
|
77
91
|
lint_roller (~> 1.0)
|
78
|
-
rubocop (~> 1.
|
92
|
+
rubocop (~> 1.75.2)
|
79
93
|
standard-custom (~> 1.0.0)
|
80
|
-
standard-performance (~> 1.
|
81
|
-
standard-custom (1.0.
|
82
|
-
lint_roller (~> 1.0)
|
83
|
-
standard-performance (1.1.0)
|
94
|
+
standard-performance (~> 1.8)
|
95
|
+
standard-custom (1.0.2)
|
84
96
|
lint_roller (~> 1.0)
|
85
|
-
rubocop
|
86
|
-
|
87
|
-
|
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)
|
88
103
|
thor (1.3.2)
|
89
|
-
unicode-display_width (
|
104
|
+
unicode-display_width (3.1.4)
|
105
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
106
|
+
unicode-emoji (4.0.4)
|
90
107
|
yard (0.9.37)
|
91
108
|
|
92
109
|
PLATFORMS
|
@@ -102,6 +119,9 @@ DEPENDENCIES
|
|
102
119
|
random-words!
|
103
120
|
rdoc (~> 6.3.4.1)
|
104
121
|
rspec (~> 3.0)
|
122
|
+
rubocop (~> 1.75.2)
|
123
|
+
rubocop-performance (~> 1.25.0)
|
124
|
+
rubocop-rspec (~> 2.0)
|
105
125
|
simplecov (~> 0.21)
|
106
126
|
simplecov-console (~> 0.9)
|
107
127
|
standard (~> 1.3)
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
[](https://rubygems.org/gems/random-words)
|
4
4
|
|
5
5
|
A random text (Lorem Ipsum) generator.
|
6
6
|
|
@@ -8,32 +8,225 @@ A random text (Lorem Ipsum) generator.
|
|
8
8
|
|
9
9
|
gem install random-words
|
10
10
|
|
11
|
-
Depending on your setup, you may need
|
11
|
+
Depending on your setup, you may need
|
12
|
+
`gem install --user-install random-words`, or in
|
13
|
+
worst case scenario, `sudo gem install random-words`.
|
14
|
+
You can also use `brew gem install random-words` if
|
15
|
+
you use [Homebrew](https://brew.sh).
|
12
16
|
|
13
17
|
### CLI
|
14
18
|
|
15
|
-
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.
|
16
22
|
|
17
23
|
```console
|
18
24
|
Usage: randw [options]
|
19
|
-
|
20
|
-
-S, --source
|
21
|
-
-l [short|medium|long|very_long]
|
22
|
-
--length
|
23
|
-
--
|
24
|
-
|
25
|
-
-
|
26
|
-
-
|
27
|
-
-
|
28
|
-
|
29
|
-
|
30
|
-
|
25
|
+
OPTIONS:
|
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
|
30
|
+
GENERATORS:
|
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)
|
49
|
+
PASSWORD OPTIONS:
|
50
|
+
--separator CHAR Specify the separator character for the password (default: " ")
|
51
|
+
-n, --[no-]whitespace Specify whether to remove whitespace in generated text (characters only)
|
52
|
+
DICTIONARIES:
|
53
|
+
--list-dictionaries List available dictionaries
|
54
|
+
--create-dictionary [NAME] Create a new dictionary
|
55
|
+
OTHER OPTIONS:
|
31
56
|
-d, --debug Enable debug mode, displays sentence/word/character counts
|
32
57
|
-h, --help Display this help message
|
33
58
|
-v, --version Display the version
|
34
59
|
-t, --test Run the full debug test
|
35
60
|
```
|
36
61
|
|
62
|
+
#### Generating Markdown text
|
63
|
+
|
64
|
+
The `--markdown` flag takes a SETTINGS argument. This is a
|
65
|
+
comma- or slash-separated string that determines the
|
66
|
+
elements to include.
|
67
|
+
|
68
|
+
First, the source language (defaults to latin), then the
|
69
|
+
length of paragraphs and tables: e.g. `english/medium`. You
|
70
|
+
can add any digits to determine how many paragraps are
|
71
|
+
generated (default 5), e.g. `corporate/medium/10`.
|
72
|
+
|
73
|
+
Then you can add individual elements, or use `/all` to
|
74
|
+
trigger all elements. The elements available are:
|
75
|
+
|
76
|
+
| trigger | element |
|
77
|
+
| :------ | :------------------------ |
|
78
|
+
| dec | add em and strong |
|
79
|
+
| link | add links |
|
80
|
+
| ul | add unordered lists |
|
81
|
+
| ol | add ordered lists |
|
82
|
+
| dl | add definition lists |
|
83
|
+
| bq | add block quotes |
|
84
|
+
| code | add code spans and blocks |
|
85
|
+
| mark | add ==highlights== |
|
86
|
+
| headers | add headlines |
|
87
|
+
| image | add images |
|
88
|
+
| table | add tables |
|
89
|
+
|
90
|
+
The number of elements inserted depends on the length you specify.
|
91
|
+
|
92
|
+
Example commands:
|
93
|
+
|
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"
|
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
|
+
```
|
111
|
+
|
112
|
+
#### Creating A New Dictionary
|
113
|
+
|
114
|
+
You can add your own sources for generating your random
|
115
|
+
text. A dictionary is a directory containing several text
|
116
|
+
files, one for each part of speech that RandomWords uses.
|
117
|
+
All of the parts must exist. The directory name is the same
|
118
|
+
as the name of the dictionary.
|
119
|
+
|
120
|
+
User dictionaries must be stored in `~/.config/random-words/words/[NAME]`.
|
121
|
+
|
122
|
+
The easiest way to generate a new language is to use the CLI:
|
123
|
+
|
124
|
+
```console
|
125
|
+
randw --create-dictionary [NAME]
|
126
|
+
```
|
127
|
+
|
128
|
+
Once this command is run, a new directory in
|
129
|
+
`~/.config/random-words/words` will be created containing
|
130
|
+
all of the necessary files with English defaults. Simply
|
131
|
+
edit these files, and then you'll be able to call the
|
132
|
+
language by its name (or triggers defined in the config, see
|
133
|
+
below). If a language of the same name exists, missing files
|
134
|
+
will be filled in, but existing files will not be
|
135
|
+
overwritten.
|
136
|
+
|
137
|
+
The necessary files are:
|
138
|
+
|
139
|
+
```console
|
140
|
+
adjectives.txt
|
141
|
+
adverbs.txt
|
142
|
+
articles-plural.txt
|
143
|
+
articles-singular.txt
|
144
|
+
clauses.txt
|
145
|
+
config.yml
|
146
|
+
conjunctions-coordinating.txt
|
147
|
+
conjunctions-subordinate.txt
|
148
|
+
names.txt
|
149
|
+
nouns-plural.txt
|
150
|
+
nouns-singular.txt
|
151
|
+
numbers.txt
|
152
|
+
phrases.txt
|
153
|
+
prepositions.txt
|
154
|
+
terminators.txt
|
155
|
+
verbs-passive.txt
|
156
|
+
verbs-plural.txt
|
157
|
+
verbs-singular.txt
|
158
|
+
```
|
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
|
+
|
186
|
+
The `terminators.txt` file contains pairs of punctuation,
|
187
|
+
separated by commas, one per line. If a sentence terminator
|
188
|
+
doesn't have opening punctuation, start the line with a
|
189
|
+
comma. More than one character can be used in either side of
|
190
|
+
the pair. For example, to create a double quoted sentence
|
191
|
+
with a period inside the closing quote, you would use:
|
192
|
+
|
193
|
+
",."
|
194
|
+
|
195
|
+
A blank line (or any line not containing a comma) will
|
196
|
+
separate regular punctuation from extended punctuation. In
|
197
|
+
the default file, `.`, `?`, and `!` are considered regular
|
198
|
+
punctuation, and parenthesis and quotes are considered
|
199
|
+
extended punctuation. Extended punctuation is off by
|
200
|
+
default, but in the CLI can be enabled with `--extended`,
|
201
|
+
and using the library you can include
|
202
|
+
`use_extended_punctuation: true` in the options when
|
203
|
+
initializing, or use `@rw.use_extended_punctuation = true`
|
204
|
+
to set it after initializing.
|
205
|
+
|
206
|
+
Repeating words or terminators more than once in the config
|
207
|
+
files increases their likelihood of being used. In the
|
208
|
+
default terminator.txt files, the period, question mark, and
|
209
|
+
exclamation point are repeated multiple times to make them
|
210
|
+
the most likely to be used.
|
211
|
+
|
212
|
+
##### Names
|
213
|
+
|
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.
|
221
|
+
|
222
|
+
#### Language Notes
|
223
|
+
|
224
|
+
RandomWords loosely uses English rules for sentence construction, so non-English languages will likely generate even more nonsensical strings.
|
225
|
+
|
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.
|
227
|
+
|
228
|
+
> The easiest way to get words is with AI. A ChatGPT prompt like "give me 100 plural nouns related to the medical profession, in plain text, one per line, sorted alphabetically" will get you a good list of words you can then just paste into `nouns-plural.txt` in your dictionary.
|
229
|
+
|
37
230
|
### Library
|
38
231
|
|
39
232
|
```ruby
|