natto 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -49,7 +49,17 @@ Install natto with the following gem command:
49
49
 
50
50
  == Changelog
51
51
 
52
- - **2010/12/22**: 0.0.3 release.
52
+ - **2010/12/28**: 0.0.6 release.
53
+ - Correction to natto.gemspec to include lib/natto/binding.rb.
54
+
55
+ - **2010/12/28**: 0.0.5 release. (yanked)
56
+ - On-going refactoring
57
+ - Project structure refactored for greater maintainability
58
+
59
+ - **2010/12/26**: 0.0.4 release.
60
+ - On-going refactoring
61
+
62
+ - **2010/12/23**: 0.0.3 release.
53
63
  - On-going refactoring
54
64
  - Adding documentation via yard
55
65
 
data/lib/natto.rb CHANGED
@@ -1,5 +1,6 @@
1
- # -*- coding: UTF-8 -*-
1
+ # -*- encoding: utf-8 -*-
2
2
  require 'rubygems' if RUBY_VERSION.to_f < 1.9
3
+ require 'natto/binding'
3
4
 
4
5
  # natto combines the Ruby programming language with MeCab,
5
6
  # the part-of-speech and morphological analyzer for the
@@ -113,11 +114,13 @@ module Natto
113
114
  SUPPORTED_OPTS.each do |k|
114
115
  if options.has_key? k
115
116
  key = k.to_s.gsub('_', '-')
116
- if key.end_with? '_format_' or key.end_with? '_feature'
117
- opt << "--#{key}="+options[k]
118
- else
119
- opt << "--#{key}=#{options[k]}"
120
- end
117
+ opt << "--#{key}=#{options[k]}"
118
+
119
+ #if key.end_with? '_format_' or key.end_with? '_feature'
120
+ # opt << "--#{key}="+options[k]
121
+ #else
122
+ # opt << "--#{key}=#{options[k]}"
123
+ #end
121
124
  end
122
125
  end
123
126
  opt.join(" ")
@@ -158,56 +161,4 @@ module Natto
158
161
  :version, :ushort,
159
162
  :next, :pointer
160
163
  end
161
-
162
- # Module <tt>Binding</tt> encapsulates operations which are
163
- # made available via <tt>FFI</tt> bindings to <tt>mecab</tt>
164
- module Binding
165
- require 'rbconfig'
166
- extend FFI::Library
167
-
168
- # String name for the environment variable used by
169
- # <tt>Natto</tt> to indicate the exact name / full path
170
- # to the <tt>mecab</tt> library.
171
- MECAB_PATH = 'MECAB_PATH'
172
-
173
- # @private
174
- def self.included(base)
175
- base.extend(ClassMethods)
176
- end
177
-
178
- # Returns the name of the <tt>mecab</tt> library based on
179
- # the runtime environment. The value of the environment
180
- # parameter <tt>MECAB_PATH</tt> is checked before this
181
- # function is invoked, and in the case of Windows, a
182
- # <tt>LoadError</tt> will be raised if <tt>MECAB_PATH</tt>
183
- # is <b>not</b> set to the full path of the <tt>mecab</tt>
184
- # library.
185
- def self.find_library
186
- host_os = RbConfig::CONFIG['host_os']
187
-
188
- if host_os =~ /mswin|mingw/i
189
- raise LoadError, "Please set #{MECAB_PATH} to full path to libmecab.dll"
190
- elsif host_os =~ /cygwin/i
191
- 'cygmecab-1'
192
- else
193
- 'mecab'
194
- end
195
- end
196
-
197
- ffi_lib(ENV[MECAB_PATH] || find_library)
198
-
199
- attach_function :mecab_version, [], :string
200
- attach_function :mecab_new2, [:string], :pointer
201
- attach_function :mecab_destroy, [:pointer], :void
202
- attach_function :mecab_sparse_tostr, [:pointer, :string], :string
203
- attach_function :mecab_strerror, [:pointer],:string
204
- attach_function :mecab_dictionary_info, [:pointer], :pointer
205
-
206
- # @private
207
- module ClassMethods
208
- def mecab_version
209
- Natto::Binding.mecab_version
210
- end
211
- end
212
- end
213
164
  end
@@ -0,0 +1,55 @@
1
+ module Natto
2
+
3
+ # Module <tt>Binding</tt> encapsulates operations which are
4
+ # made available via <tt>FFI</tt> bindings to <tt>mecab</tt>
5
+ module Binding
6
+ require 'ffi'
7
+ require 'rbconfig'
8
+ extend FFI::Library
9
+
10
+ # String name for the environment variable used by
11
+ # <tt>Natto</tt> to indicate the exact name / full path
12
+ # to the <tt>mecab</tt> library.
13
+ MECAB_PATH = 'MECAB_PATH'
14
+
15
+ # @private
16
+ def self.included(base)
17
+ base.extend(ClassMethods)
18
+ end
19
+
20
+ # Returns the name of the <tt>mecab</tt> library based on
21
+ # the runtime environment. The value of the environment
22
+ # parameter <tt>MECAB_PATH</tt> is checked before this
23
+ # function is invoked, and in the case of Windows, a
24
+ # <tt>LoadError</tt> will be raised if <tt>MECAB_PATH</tt>
25
+ # is <b>not</b> set to the full path of the <tt>mecab</tt>
26
+ # library.
27
+ def self.find_library
28
+ host_os = RbConfig::CONFIG['host_os']
29
+
30
+ if host_os =~ /mswin|mingw/i
31
+ raise LoadError, "Please set #{MECAB_PATH} to full path to libmecab.dll"
32
+ elsif host_os =~ /cygwin/i
33
+ 'cygmecab-1'
34
+ else
35
+ 'mecab'
36
+ end
37
+ end
38
+
39
+ ffi_lib(ENV[MECAB_PATH] || find_library)
40
+
41
+ attach_function :mecab_version, [], :string
42
+ attach_function :mecab_new2, [:string], :pointer
43
+ attach_function :mecab_destroy, [:pointer], :void
44
+ attach_function :mecab_sparse_tostr, [:pointer, :string], :string
45
+ attach_function :mecab_strerror, [:pointer],:string
46
+ attach_function :mecab_dictionary_info, [:pointer], :pointer
47
+
48
+ # @private
49
+ module ClassMethods
50
+ def mecab_version
51
+ Natto::Binding.mecab_version
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,5 @@
1
+ # -*- encoding: utf-8 -*-
2
+ module Natto
3
+ # Version string for this Rubygem.
4
+ VERSION = "0.0.6"
5
+ end
data/test/test_natto.rb CHANGED
@@ -1,4 +1,4 @@
1
- # -*- coding: UTF-8 -*-
1
+ # -*- encoding: utf-8 -*-
2
2
  $:.unshift('lib')
3
3
  require 'rubygems' if RUBY_VERSION.to_f < 1.9
4
4
  require 'test/unit'
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: natto
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 0
8
- - 4
9
- version: 0.0.4
9
+ - 6
10
+ version: 0.0.6
10
11
  platform: ruby
11
12
  authors:
12
13
  - Brooke M. Fujita
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-12-27 00:00:00 +09:00
18
+ date: 2010-12-28 00:00:00 +09:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,6 +26,7 @@ dependencies:
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 1
28
30
  segments:
29
31
  - 0
30
32
  - 6
@@ -43,6 +45,8 @@ extra_rdoc_files:
43
45
  - README
44
46
  files:
45
47
  - lib/natto.rb
48
+ - lib/natto/binding.rb
49
+ - lib/natto/version.rb
46
50
  - test/test_natto.rb
47
51
  - LICENSE
48
52
  - README
@@ -60,6 +64,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
64
  requirements:
61
65
  - - ">="
62
66
  - !ruby/object:Gem::Version
67
+ hash: 57
63
68
  segments:
64
69
  - 1
65
70
  - 8
@@ -70,6 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
70
75
  requirements:
71
76
  - - ">="
72
77
  - !ruby/object:Gem::Version
78
+ hash: 3
73
79
  segments:
74
80
  - 0
75
81
  version: "0"