zipfy 1.0.2 → 1.0.3
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/README.md +1 -1
- data/bin/zipfy +26 -8
- data/lib/zipfy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df129a8ae75bcb23ec03736debedd5f724feb5e6
|
4
|
+
data.tar.gz: f9ba891b97644921f769e21fdfdb4474456c3dce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e53b3218e417030cd889e5faf6e23d30eb6427b141a11e7f26e9e158132692223d757c7105fd4891607ef029060ee6d19aa2678a68ec0a871cab20405f8487
|
7
|
+
data.tar.gz: 6f463e6469c97437070094ef696ef84c91d9aa24189699c1948b8d0daa82a650b9164b0f64efffe8e386f8c7e65b30ea2276d29c6358589a7775f4a46505a131
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Zipfy [](https://travis-ci.org/bjubes/zipfy)
|
1
|
+
# Zipfy [](https://travis-ci.org/bjubes/zipfy) [](https://codeclimate.com/github/bjubes/putsplus)
|
2
2
|
|
3
3
|
Zipfy calculates word distribution in text files or strings and their deviation from Zipf's law"
|
4
4
|
|
data/bin/zipfy
CHANGED
@@ -8,18 +8,16 @@ include Zipfy
|
|
8
8
|
verbose = false
|
9
9
|
save_path = nil
|
10
10
|
overwrite_save = false
|
11
|
+
excerpt = nil
|
11
12
|
|
12
13
|
opts = GetoptLong.new(
|
13
14
|
[ '--help', '-h', GetoptLong::NO_ARGUMENT ],
|
14
15
|
[ '--save', '-s', GetoptLong::REQUIRED_ARGUMENT ],
|
15
|
-
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ]
|
16
|
+
[ '--verbose', '-v', GetoptLong::NO_ARGUMENT ],
|
17
|
+
[ '--excerpt', '-e', GetoptLong::REQUIRED_ARGUMENT ]
|
16
18
|
)
|
17
19
|
|
18
|
-
|
19
|
-
if !file_path
|
20
|
-
puts "Please specify a file to evaluate. Run zipf -h for more information"
|
21
|
-
exit
|
22
|
-
end
|
20
|
+
|
23
21
|
|
24
22
|
opts.each do |opt, arg|
|
25
23
|
case opt
|
@@ -41,6 +39,10 @@ FILE:
|
|
41
39
|
|
42
40
|
-f --force:
|
43
41
|
overwrite save file if one already exists
|
42
|
+
|
43
|
+
-e --excerpt:
|
44
|
+
analyzes the string passed as an excerpt
|
45
|
+
|
44
46
|
EOF
|
45
47
|
exit
|
46
48
|
when '--verbose'
|
@@ -49,12 +51,28 @@ exit
|
|
49
51
|
save_path = arg
|
50
52
|
when '--force'
|
51
53
|
overwrite_save = true
|
54
|
+
when '--excerpt'
|
55
|
+
excerpt = arg
|
52
56
|
end
|
53
57
|
end
|
54
58
|
|
59
|
+
file_path = ARGV[0]
|
60
|
+
if !file_path && !excerpt
|
61
|
+
puts "Please specify a file or excerpt to evaluate. Run zipf -h for more information"
|
62
|
+
exit
|
63
|
+
end
|
64
|
+
if file_path && excerpt
|
65
|
+
puts "Please specify either a file or an excerpt, not both"
|
66
|
+
exit
|
67
|
+
end
|
68
|
+
|
55
69
|
z = Zipf.new
|
56
|
-
|
57
|
-
|
70
|
+
|
71
|
+
if excerpt
|
72
|
+
z.create_distribution(excerpt.split(" "))
|
73
|
+
else
|
74
|
+
z.create_distribution( z.load_file file_path)
|
75
|
+
end
|
58
76
|
z.sort_distribution
|
59
77
|
z.calculate_zipfness
|
60
78
|
z.puts_distribution if verbose
|
data/lib/zipfy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zipfy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bjubes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-01-
|
11
|
+
date: 2017-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: putsplus
|