Module: FFI::Aspell
- Extended by:
- Library
- Defined in:
- lib/ffi/aspell/aspell.rb,
lib/ffi/aspell/error.rb,
lib/ffi/aspell/speller.rb,
lib/ffi/aspell/version.rb
Overview
FFI::Aspell is an FFI binding for the Aspell spell checking library. Basic usage is as following:
require 'ffi/aspell'
speller = FFI::Aspell::Speller.new
speller.correct?('cookie') # => true
speller.correct?('cookei') # => false
For more information see Speller.
Defined Under Namespace
Classes: ConfigError, Speller
Constant Summary collapse
- VERSION =
'1.0.0'
Class Method Summary collapse
-
.config_delete(config) ⇒ Object
Removes a config pointer and frees the memory associated with said pointer.
-
.config_new ⇒ FFI::Pointer
Creates a pointer for a configuration struct.
-
.config_remove(config, key) ⇒ TrueClass|FalseClass
Sets the value of the specified configuration item back to its default value.
-
.config_replace(config, key, value) ⇒ TrueClass|FalseClass
Sets the new value of the specified configuration item.
-
.config_retrieve(config, key) ⇒ String
Retrieves the value of a given configuration item.
-
.config_retrieve_default(config, key) ⇒ Object
Retrieves the default value of a configuration item.
-
.speller_check(speller, word, length) ⇒ TrueClass|FalseClass
Checks if a given word is spelled correctly or not.
-
.speller_delete(speller) ⇒ Object
Removes a speller pointer and frees the memory associated with said pointer.
-
.speller_new(config) ⇒ FFI::Pointer
Creates a pointer to a speller struct.
-
.string_enumeration_delete(elements) ⇒ Object
Removes the pointer returned by Aspell.word_list_elements and frees the associated memory.
-
.string_enumeration_next(elements) ⇒ String|NilClass
Retrieves the next item in the list of suggestions.
-
.word_list_elements(suggestions) ⇒ FFI::Pointer
Returns a pointer to a list which can be used by Aspell.string_enumeration_next to retrieve all the suggested words.
Instance Method Summary collapse
-
#speller_suggest(speller, word, length) ⇒ FFI::Pointer
Returns a pointer that can be used to retrieve a list of suggestions for a given word.
Class Method Details
.config_delete(config) ⇒ Object
Removes a config pointer and frees the memory associated with said pointer.
39 40 41 42 |
# File 'lib/ffi/aspell/aspell.rb', line 39 attach_function 'config_delete', 'delete_aspell_config', [:pointer], :void |
.config_new ⇒ FFI::Pointer
Creates a pointer for a configuration struct.
26 27 28 29 |
# File 'lib/ffi/aspell/aspell.rb', line 26 attach_function 'config_new', 'new_aspell_config', [], :pointer |
.config_remove(config, key) ⇒ TrueClass|FalseClass
Sets the value of the specified configuration item back to its default value.
113 114 115 116 |
# File 'lib/ffi/aspell/aspell.rb', line 113 attach_function 'config_remove', 'aspell_config_remove', [:pointer, :string], :bool |
.config_replace(config, key, value) ⇒ TrueClass|FalseClass
Sets the new value of the specified configuration item.
92 93 94 95 |
# File 'lib/ffi/aspell/aspell.rb', line 92 attach_function 'config_replace', 'aspell_config_replace', [:pointer, :string, :string], :bool |
.config_retrieve(config, key) ⇒ String
Retrieves the value of a given configuration item. The value is returned as a string or nil upon failure.
60 61 62 63 |
# File 'lib/ffi/aspell/aspell.rb', line 60 attach_function 'config_retrieve', 'aspell_config_retrieve', [:pointer, :string], :string |
.config_retrieve_default(config, key) ⇒ Object
Retrieves the default value of a configuration item.
72 73 74 75 |
# File 'lib/ffi/aspell/aspell.rb', line 72 attach_function 'config_retrieve_default', 'aspell_config_get_default', [:pointer, :string], :string |
.speller_check(speller, word, length) ⇒ TrueClass|FalseClass
Checks if a given word is spelled correctly or not. If the word is valid
true will be returned, false otherwise.
174 175 176 177 |
# File 'lib/ffi/aspell/aspell.rb', line 174 attach_function 'speller_check', 'aspell_speller_check', [:pointer, :string, :int], :bool |
.speller_delete(speller) ⇒ Object
Removes a speller pointer and frees the memory associated with said pointer.
146 147 148 149 |
# File 'lib/ffi/aspell/aspell.rb', line 146 attach_function 'speller_delete', 'delete_aspell_speller', [:pointer], :void |
.speller_new(config) ⇒ FFI::Pointer
Creates a pointer to a speller struct.
133 134 135 136 |
# File 'lib/ffi/aspell/aspell.rb', line 133 attach_function 'speller_new', 'new_aspell_speller', [:pointer], :pointer |
.string_enumeration_delete(elements) ⇒ Object
Removes the pointer returned by word_list_elements and frees the associated memory.
218 219 220 221 |
# File 'lib/ffi/aspell/aspell.rb', line 218 attach_function 'string_enumeration_delete', 'delete_aspell_string_enumeration', [:pointer], :void |
.string_enumeration_next(elements) ⇒ String|NilClass
Retrieves the next item in the list of suggestions.
246 247 248 249 |
# File 'lib/ffi/aspell/aspell.rb', line 246 attach_function 'string_enumeration_next', 'aspell_string_enumeration_next', [:pointer], :string |
.word_list_elements(suggestions) ⇒ FFI::Pointer
Returns a pointer to a list which can be used by string_enumeration_next to retrieve all the suggested words.
204 205 206 207 |
# File 'lib/ffi/aspell/aspell.rb', line 204 attach_function 'word_list_elements', 'aspell_word_list_elements', [:pointer], :pointer |
Instance Method Details
#speller_suggest(speller, word, length) ⇒ FFI::Pointer
Returns a pointer that can be used to retrieve a list of suggestions for a given word.
189 190 191 192 |
# File 'lib/ffi/aspell/aspell.rb', line 189 attach_function 'speller_suggest', 'aspell_speller_suggest', [:pointer, :string, :int], :pointer |