kotodama 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/wordgen +12 -8
  2. data/lib/kotodama.rb +1 -1
  3. metadata +2 -2
@@ -36,6 +36,9 @@ optparse = OptionParser.new do |opt|
36
36
  opt.on '-o', '--out FILE', 'Write results to FILE' do |file|
37
37
  options[:output] = file
38
38
  end
39
+ opt.in '-z', '--zipf', 'Output Zipf frequencies' do
40
+ options[:zipf] = true
41
+ end
39
42
  end
40
43
 
41
44
  optparse.parse!
@@ -52,19 +55,20 @@ if File.exist? ARGV[0]
52
55
  end
53
56
  if result.parsed?
54
57
  output = []
58
+ output_file = options[:output] ? File.open(options[:output], 'w') : STDOUT
59
+ if options[:zipf]
60
+ result.result.zipf.each do |key, value|
61
+ output_file.puts "#{key} => #{value}"
62
+ end
63
+ end
55
64
  times.times do
56
65
  output << result.result.generate(options)
57
66
  end
58
- if options[:output]
59
- File.open options[:output], 'w' do |file|
60
- file.puts output
61
- end
62
- else
63
- puts output
64
- end
67
+ output_file.puts output
68
+ output_file.close if output_file != STDOUT
65
69
  else
66
70
  STDERR.puts result.error
67
71
  end
68
72
  else
69
73
  STDERR.puts "File `#{ARGV[0]}' does not exist"
70
- end
74
+ end
@@ -1,7 +1,7 @@
1
1
  require 'kaiseki'
2
2
 
3
3
  module Kotodama
4
- VERSION = '1.1.1'
4
+ VERSION = '1.2.1'
5
5
  file_path = File.dirname __FILE__
6
6
 
7
7
  #load base class mods
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
+ - 2
7
8
  - 1
8
- - 1
9
- version: 1.1.1
9
+ version: 1.2.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - William Hamilton-Levi