ffi-hunspell 0.3.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f1f146caea929efea0b2d0ea4853410c9693a271
4
- data.tar.gz: 7f29da7a3b1a6e272a1f17aed2ff75b771128f56
3
+ metadata.gz: 57957bc047538f1b983ecef0573c50b6989ac7bf
4
+ data.tar.gz: 173b95b98026f1988a4aeae6642afcf6135bfc67
5
5
  SHA512:
6
- metadata.gz: 65c59a19ade6f500cfe8782699432efc0a28c573cd81a760982b8335db1d78fe740c521f8a5c526ae66d0fb7a2b94950f32a59d6fc347b9e6411ec14b5b342c8
7
- data.tar.gz: 645580d8d22a25966345a86d5303130a801e6236120c02ca8314280f2b79e038ebb3ce68e21864685ca2e24d50807715e34bc6e45a7fcaedae30d8d6ef89c9b7
6
+ metadata.gz: aed5c80fb30d725cfdc62e10e150bb472b3f49c48552449fa31e3e904d52bc1818c16a96b730b47a731243dc04e85dd49de4d6077daa054dca534dcdd05abf64
7
+ data.tar.gz: 543846a757f85d057cc5c24bc2cda27a8a6676b7863b1ed5ae494249bd734fc32f66fdd8bc46e64b9cc162cb29dff49f2746bdc0c296327287f89a9b882220c1
@@ -1,3 +1,11 @@
1
+ ### 0.4.0 / 2017-04-21
2
+
3
+ * Added support for libhunspell-1.6.
4
+ * Added support for libhunspell-1.5 (@trench8891).
5
+ * Added support for libhunspell-1.4 (@willmoorefyi).
6
+ * Renamed `#add_affix` to {FFI::Hunspell::Dictionary#add_with_affix}
7
+ (@cdchapman).
8
+
1
9
  ### 0.3.1 / 2016-01-14
2
10
 
3
11
  * Prefer loading hunspell-1.3 over hunspell-1.2, if both are installed.
data/README.md CHANGED
@@ -14,48 +14,49 @@ Ruby FFI bindings for [Hunspell][libhunspell].
14
14
  ## Examples
15
15
 
16
16
  Open a dictionary:
17
-
18
- require 'ffi/hunspell'
17
+ ```rb
18
+ require 'ffi/hunspell'
19
19
 
20
- FFI::Hunspell.dict do |dict|
21
- # ...
22
- end
20
+ FFI::Hunspell.dict do |dict|
21
+ # ...
22
+ end
23
23
 
24
- FFI::Hunspell.dict('en_GB') do |dict|
25
- # ...
26
- end
24
+ FFI::Hunspell.dict('en_GB') do |dict|
25
+ # ...
26
+ end
27
27
 
28
- dict = FFI::Hunspell.dict('en_GB')
29
- # ...
30
- dict.close
28
+ dict = FFI::Hunspell.dict('en_GB')
29
+ # ...
30
+ dict.close
31
+ ```
31
32
 
32
33
  Check if a word is valid:
34
+ ```rb
35
+ dict.check?('dog')
36
+ # => true
33
37
 
34
- dict.check?('dog')
35
- # => true
36
-
37
- dict.check?('d0g')
38
- # => false
39
-
38
+ dict.check?('d0g')
39
+ # => false
40
+ ```
40
41
  Find the stems of a word:
41
-
42
- dict.stem('dogs')
43
- # => ["dog"]
44
-
42
+ ```rb
43
+ dict.stem('dogs')
44
+ # => ["dog"]
45
+ ```
45
46
  Suggest alternate spellings for a word:
46
-
47
- dict.suggest('arbitrage')
48
- # => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
49
-
47
+ ```rb
48
+ dict.suggest('arbitrage')
49
+ # => ["arbitrage", "arbitrages", "arbitrager", "arbitraged", "arbitrate"]
50
+ ```
50
51
  ## Requirements
51
52
 
52
53
  * [libhunspell] >= 1.2.0
53
54
  * [ffi] ~> 1.0
54
55
 
55
56
  ## Install
56
-
57
- $ gem install ffi-hunspell
58
-
57
+ ```sh
58
+ $ gem install ffi-hunspell
59
+ ```
59
60
  ## License
60
61
 
61
62
  Copyright (c) 2010-2016 Hal Brodigan
@@ -1,5 +1,5 @@
1
1
  name: ffi-hunspell
2
- version: 0.3.1
2
+ version: 0.4.0
3
3
  summary: FFI bindings for Hunspell
4
4
  description: Ruby FFI bindings for the Hunspell spell checker.
5
5
  license: MIT
@@ -109,15 +109,33 @@ module FFI
109
109
  #
110
110
  # Adds a word to the dictionary.
111
111
  #
112
- # @param [String] word
112
+ # @param [#to_s] word
113
113
  # The word to add to the dictionary.
114
114
  #
115
115
  def add(word)
116
116
  Hunspell.Hunspell_add(self,word.to_s)
117
117
  end
118
118
 
119
+ #
120
+ # Adds a word to the dictionary with affix flags.
121
+ #
122
+ # @param [#to_s] word
123
+ # The word to add to the dictionary.
124
+ #
125
+ # @param [#to_s] example
126
+ # Affix flags.
127
+ #
128
+ # @since 0.4.0
129
+ #
130
+ def add_with_affix(word,example)
131
+ Hunspell.Hunspell_add_with_affix(self,word.to_s,example.to_s)
132
+ end
133
+
134
+ #
135
+ # @deprecated Please use {#add_with_affix} instead.
136
+ #
119
137
  def add_affix(word,example)
120
- Hunspell.Hunspell_add_affix(self,word.to_s,example.to_s)
138
+ add_with_affix(word,example)
121
139
  end
122
140
 
123
141
  alias << add
@@ -125,7 +143,7 @@ module FFI
125
143
  #
126
144
  # Removes a word from the dictionary.
127
145
  #
128
- # @param [String] word
146
+ # @param [#to_s] word
129
147
  # The word to remove.
130
148
  #
131
149
  def remove(word)
@@ -137,7 +155,7 @@ module FFI
137
155
  #
138
156
  # Checks if the word is validate.
139
157
  #
140
- # @param [String] word
158
+ # @param [#to_s] word
141
159
  # The word in question.
142
160
  #
143
161
  # @return [Boolean]
@@ -152,7 +170,7 @@ module FFI
152
170
  #
153
171
  # Finds the stems of a word.
154
172
  #
155
- # @param [String] word
173
+ # @param [#to_s] word
156
174
  # The word in question.
157
175
  #
158
176
  # @return [Array<String>]
@@ -176,7 +194,7 @@ module FFI
176
194
  #
177
195
  # Suggests alternate spellings of a word.
178
196
  #
179
- # @param [String] word
197
+ # @param [#to_s] word
180
198
  # The word in question.
181
199
  #
182
200
  # @return [Array<String>]
@@ -5,6 +5,9 @@ module FFI
5
5
  extend FFI::Library
6
6
 
7
7
  ffi_lib [
8
+ 'hunspell-1.6', 'libhunspell-1.6.so.0',
9
+ 'hunspell-1.5', 'libhunspell-1.5.so.0',
10
+ 'hunspell-1.4', 'libhunspell-1.4.so.0',
8
11
  'hunspell-1.3', 'libhunspell-1.3.so.0',
9
12
  'hunspell-1.2', 'libhunspell-1.2.so.0'
10
13
  ]
@@ -57,6 +57,20 @@ describe Hunspell::Dictionary do
57
57
  expect(subject.valid?('dxg')).to be false
58
58
  end
59
59
 
60
+ describe "#add" do
61
+ it "should add a word" do
62
+ expect(subject.add('cat')).to be 0
63
+ end
64
+ end
65
+
66
+ describe "#add_with_affix" do
67
+ it "should add a word with an example word" do
68
+ expect(subject.add_with_affix('cat', 'agree')).to be 0
69
+ expect(subject.valid?('disagreeable')).to be true
70
+ expect(subject.valid?('discatable')).to be true
71
+ end
72
+ end
73
+
60
74
  describe "#stem" do
61
75
  it "should find the stems of a word" do
62
76
  expect(subject.stem('fishing')).to be == %w[fishing fish]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffi-hunspell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Postmodern
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-14 00:00:00.000000000 Z
11
+ date: 2017-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements:
114
114
  - libhunspell >= 1.2.0
115
115
  rubyforge_project:
116
- rubygems_version: 2.4.7
116
+ rubygems_version: 2.5.2
117
117
  signing_key:
118
118
  specification_version: 4
119
119
  summary: FFI bindings for Hunspell