momblish 0.1.0
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 +7 -0
- data/.gitignore +8 -0
- data/.travis.yml +7 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +40 -0
- data/README.md +64 -0
- data/Rakefile +10 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/corpuses/simple.txt +1001 -0
- data/lib/corpuses/spanish.txt +86059 -0
- data/lib/freq.txt +0 -0
- data/lib/momblish/corpus.rb +30 -0
- data/lib/momblish/corpus_analyzer.rb +65 -0
- data/lib/momblish/version.rb +3 -0
- data/lib/momblish.rb +90 -0
- data/momblish.gemspec +29 -0
- metadata +115 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c823c9e7c66d1e512049506406bea140fadd6bf0047b56dbced7bcda90ddcc63
|
4
|
+
data.tar.gz: b8be4162f693a4c5a6d82b134cd16bb9ae19f3326a628338f280632e0f3f2a5f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12e8fd02096d2d4cb46f880cd26f65726a8a32ceb3e4ffc1ddd4be86e785b465fa2503c75df03448c824ac1fc756192fa828e0db1c7ee9f88bb278d15c6d1e37
|
7
|
+
data.tar.gz: 51ab00551d6bc9981090d1cda07028dc1ef00c7708c6e86597f91db39f35af938226546a02fd857fa073919588fb74826dca5c5f554d439bf9f2aaf3f00497dc
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
momblish (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
debug (1.9.0)
|
10
|
+
irb (~> 1.10)
|
11
|
+
reline (>= 0.3.8)
|
12
|
+
io-console (0.7.0)
|
13
|
+
irb (1.10.1)
|
14
|
+
rdoc
|
15
|
+
reline (>= 0.3.8)
|
16
|
+
minitest (5.20.0)
|
17
|
+
minitest-focus (1.4.0)
|
18
|
+
minitest (>= 4, < 6)
|
19
|
+
psych (5.1.1.1)
|
20
|
+
stringio
|
21
|
+
rake (13.1.0)
|
22
|
+
rdoc (6.6.1)
|
23
|
+
psych (>= 4.0.0)
|
24
|
+
reline (0.4.1)
|
25
|
+
io-console (~> 0.5)
|
26
|
+
stringio (3.1.0)
|
27
|
+
|
28
|
+
PLATFORMS
|
29
|
+
arm64-darwin-22
|
30
|
+
|
31
|
+
DEPENDENCIES
|
32
|
+
bundler (~> 2.4)
|
33
|
+
debug (~> 1.9)
|
34
|
+
minitest (~> 5.20)
|
35
|
+
minitest-focus (~> 1.4)
|
36
|
+
momblish!
|
37
|
+
rake (~> 13.1)
|
38
|
+
|
39
|
+
BUNDLED WITH
|
40
|
+
2.4.10
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# Momblish
|
2
|
+
|
3
|
+
Momblish is a library for generating fake words in any phoenetic.
|
4
|
+
|
5
|
+
[http://mentalfloss.com/article/69880/7-fake-words-ended-dictionary](http://mentalfloss.com/article/69880/7-fake-words-ended-dictionary)
|
6
|
+
|
7
|
+
It is named after a "fake" word put into the OED on accident.
|
8
|
+
|
9
|
+
Momblish uses trigram analysis to generate (mostly) pronounacble gibberish - so
|
10
|
+
it can be used for any language that can be n-gram analyzed.
|
11
|
+
|
12
|
+
## Description
|
13
|
+
|
14
|
+
To use moblish, require it -
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
require 'momblish'
|
18
|
+
english = Momblish.english()
|
19
|
+
english.word
|
20
|
+
```
|
21
|
+
|
22
|
+
|
23
|
+
Currently availabe corpuses are:
|
24
|
+
|
25
|
+
- English
|
26
|
+
- Spanish
|
27
|
+
- 1000 Most Frequent English Words (Simple)
|
28
|
+
- Names
|
29
|
+
|
30
|
+
|
31
|
+
Each time you load the English momblish it will perform an analysis on
|
32
|
+
the corpus file and use that data to generate nonsense words.
|
33
|
+
|
34
|
+
To avoid this computation overhead, you can save the pre-analyzed corpus
|
35
|
+
as a file and read it in on demand.
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
require 'momblish'
|
39
|
+
m = Momblish.english()
|
40
|
+
m.corpus.save('/tmp/corpus.json')
|
41
|
+
|
42
|
+
c = Corpus.load('/tmp/corpus.json')
|
43
|
+
n = Momblish(c)
|
44
|
+
```
|
45
|
+
|
46
|
+
To get Momblish to generate words for you call `word` on a Momblish instance.
|
47
|
+
|
48
|
+
`sentence` will yield a word to a block. You can feed this to your program to make word lists
|
49
|
+
of varying length. If you don't provide a length to `sentence` it will yield forever.
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
|
53
|
+
require 'momblish'
|
54
|
+
|
55
|
+
simple = Momblish.simple
|
56
|
+
|
57
|
+
simple.sentence(10).map(&:1)
|
58
|
+
|
59
|
+
# or
|
60
|
+
|
61
|
+
simple.sentence do |word|
|
62
|
+
# do some stuff and remember to break
|
63
|
+
end
|
64
|
+
```
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "momblish"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|