ffi-aspell 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/ffi/aspell.rb +55 -0
- data/lib/ffi/aspell/error.rb +11 -0
- data/lib/ffi/aspell/speller.rb +61 -0
- data/lib/ffi/aspell/version.rb +5 -0
- metadata +113 -0
data/lib/ffi/aspell.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'ffi'
|
2
|
+
|
3
|
+
$:.unshift(File.expand_path('../', __FILE__))
|
4
|
+
|
5
|
+
require 'aspell/error'
|
6
|
+
require 'aspell/speller'
|
7
|
+
|
8
|
+
module FFI
|
9
|
+
##
|
10
|
+
# FFI::Aspell is an FFI binding for the Aspell spell checking library.
|
11
|
+
#
|
12
|
+
# @since 13-04-2012
|
13
|
+
#
|
14
|
+
module Aspell
|
15
|
+
extend FFI::Library
|
16
|
+
ffi_lib 'aspell'
|
17
|
+
|
18
|
+
# Configuration functions.
|
19
|
+
attach_function 'config_new',
|
20
|
+
'new_aspell_config',
|
21
|
+
[],
|
22
|
+
:pointer
|
23
|
+
|
24
|
+
attach_function 'config_retrieve',
|
25
|
+
'aspell_config_retrieve',
|
26
|
+
[:pointer, :string],
|
27
|
+
:string
|
28
|
+
|
29
|
+
attach_function 'config_get_default',
|
30
|
+
'aspell_config_get_default',
|
31
|
+
[:pointer, :string],
|
32
|
+
:string
|
33
|
+
|
34
|
+
attach_function 'config_replace',
|
35
|
+
'aspell_config_replace',
|
36
|
+
[:pointer, :string, :string],
|
37
|
+
:bool
|
38
|
+
|
39
|
+
attach_function 'config_remove',
|
40
|
+
'aspell_config_remove',
|
41
|
+
[:pointer, :string],
|
42
|
+
:bool
|
43
|
+
|
44
|
+
# Spell checking related functions.
|
45
|
+
attach_function 'speller_new',
|
46
|
+
'new_aspell_speller',
|
47
|
+
[:pointer],
|
48
|
+
:pointer
|
49
|
+
|
50
|
+
attach_function 'speller_check',
|
51
|
+
'aspell_speller_check',
|
52
|
+
[:pointer, :string, :int],
|
53
|
+
:bool
|
54
|
+
end # Aspell
|
55
|
+
end # FFI
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module FFI
|
2
|
+
module Aspell
|
3
|
+
##
|
4
|
+
# The Speller class is used for spell checking individual words as well as
|
5
|
+
# generating a list of suggestions.
|
6
|
+
#
|
7
|
+
# @since 13-04-2012
|
8
|
+
#
|
9
|
+
class Speller
|
10
|
+
##
|
11
|
+
# Creates a new instance of the class, sets the language as well as the
|
12
|
+
# options specified in the `options` hash.
|
13
|
+
#
|
14
|
+
# @since 13-04-2012
|
15
|
+
# @param [String] language The language to use.
|
16
|
+
# @param [Hash] options A hash containing extra configuration options,
|
17
|
+
# such as the "personal" option to set.
|
18
|
+
#
|
19
|
+
def initialize(language, options = {})
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
##
|
24
|
+
# Checks if the given word is correct or not.
|
25
|
+
#
|
26
|
+
# @since 13-04-2012
|
27
|
+
# @param [String] word The word to check.
|
28
|
+
# @return [TrueClass|FalseClass]
|
29
|
+
#
|
30
|
+
def correct?(word)
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
##
|
35
|
+
# Sets a configuration option.
|
36
|
+
#
|
37
|
+
# @since 13-04-2012
|
38
|
+
# @param [#to_s] key The configuration key to set.
|
39
|
+
# @param [#to_s] value The value of the configuration key.
|
40
|
+
# @raise [FFI::Aspell::ConfigError] Raised when the configuration value
|
41
|
+
# could not be set.
|
42
|
+
#
|
43
|
+
def set(key, value)
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
##
|
48
|
+
# Retrieves the value of the specified configuration item.
|
49
|
+
#
|
50
|
+
# @since 13-04-2012
|
51
|
+
# @param [String] key The configuration key to retrieve.
|
52
|
+
# @return [String]
|
53
|
+
# @raise [FFI::Aspell::ConfigError] Raised when the configuration item
|
54
|
+
# does not exist.
|
55
|
+
#
|
56
|
+
def get(key)
|
57
|
+
|
58
|
+
end
|
59
|
+
end # Speller
|
60
|
+
end # Aspell
|
61
|
+
end # FFI
|
metadata
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ffi-aspell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Yorick Peterse
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-04-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: ffi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.11
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.11
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: yard
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.7.5
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.7.5
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: redcarpet
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 2.1.1
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.1.1
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: bacon
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 1.1.0
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 1.1.0
|
78
|
+
description: FFI bindings for Aspell
|
79
|
+
email: yorickpeterse@gmail.com
|
80
|
+
executables: []
|
81
|
+
extensions: []
|
82
|
+
extra_rdoc_files: []
|
83
|
+
files:
|
84
|
+
- ./lib/ffi/aspell.rb
|
85
|
+
- ./lib/ffi/aspell/version.rb
|
86
|
+
- ./lib/ffi/aspell/error.rb
|
87
|
+
- ./lib/ffi/aspell/speller.rb
|
88
|
+
homepage: https://github.com/YorickPeterse/ffi-aspell
|
89
|
+
licenses: []
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
none: false
|
96
|
+
requirements:
|
97
|
+
- - ! '>='
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
|
+
none: false
|
102
|
+
requirements:
|
103
|
+
- - ! '>='
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: '0'
|
106
|
+
requirements: []
|
107
|
+
rubyforge_project:
|
108
|
+
rubygems_version: 1.8.19
|
109
|
+
signing_key:
|
110
|
+
specification_version: 3
|
111
|
+
summary: FFI bindings for Aspell
|
112
|
+
test_files: []
|
113
|
+
has_rdoc: yard
|