dmarkow-raspell 1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +6 -0
- data/LICENSE +342 -0
- data/README +78 -0
- data/ext/extconf.rb +6 -0
- data/ext/raspell.c +726 -0
- data/ext/raspell.h +13 -0
- data/lib/raspell_stub.rb +113 -0
- data/test/simple_test.rb +36 -0
- metadata +62 -0
data/ext/raspell.h
ADDED
data/lib/raspell_stub.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
|
2
|
+
# Stub for documentation purposes
|
3
|
+
raise "This file is only for documentation purposes. Require #{File.dirname(__FILE__)}/../ext/raspell} instead."
|
4
|
+
|
5
|
+
# The functionality of Aspell is accessible via this class.
|
6
|
+
class ::Aspell
|
7
|
+
|
8
|
+
# Creates an Aspell instance. All parameters are optional and have default values. In most situations it is enough to create an Aspell-instance with only a language.
|
9
|
+
# * <tt>language</tt> - ISO639 language code plus optional ISO 3166 counry code as string (eg: "de" or "en_US").
|
10
|
+
# * <tt>jargon</tt> - A special jargon of the selected language.
|
11
|
+
# * <tt>size</tt> - The size of the dictionary to chose (if there are options).
|
12
|
+
# * <tt>encoding</tt> - The encoding to use.
|
13
|
+
def initialize(language, jargon, size, encoding); end
|
14
|
+
|
15
|
+
# Returns a list of AspellDictInfo-objects describing each dictionary.
|
16
|
+
def self.list_dicts; end
|
17
|
+
|
18
|
+
# Returns a list of checker options.
|
19
|
+
def self.CheckerOptions; end
|
20
|
+
|
21
|
+
# Returns a list of dictionary options.
|
22
|
+
def self.DictionaryOptions; end
|
23
|
+
|
24
|
+
# Returns a list of filter options.
|
25
|
+
def self.FilterOptions; end
|
26
|
+
|
27
|
+
# Returns a list of misc options.
|
28
|
+
def self.MiscOptions; end
|
29
|
+
|
30
|
+
# Returns a list of run-together options.
|
31
|
+
def self.RunTogetherOptions; end
|
32
|
+
|
33
|
+
# Returns a list of utility options.
|
34
|
+
def self.UtilityOptions; end
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
# Add a word to the private dictionary.
|
39
|
+
def add_to_personal(word); end
|
40
|
+
|
41
|
+
# Add a word to the session ignore list. The session persists for the lifetime of <tt>self</tt>.
|
42
|
+
def add_to_session(word); end
|
43
|
+
|
44
|
+
# Check given word for correctness. Returns <tt>true</tt> or <tt>false</tt>.
|
45
|
+
def check(word); end
|
46
|
+
|
47
|
+
# Check an entire file for correctness. This method requires a block, which will yield each misspelled word.
|
48
|
+
def correct_file(filename); end
|
49
|
+
|
50
|
+
# Check an array of strings for correctness. This method requires a block, which will yield each misspelled word.
|
51
|
+
def correct_lines(array_of_strings)
|
52
|
+
yield
|
53
|
+
end
|
54
|
+
|
55
|
+
# Clear the the session wordlist.
|
56
|
+
def clear_session(); end
|
57
|
+
|
58
|
+
# Value of an option in config. Returns a string.
|
59
|
+
def get_option(option); end
|
60
|
+
|
61
|
+
# Value of option in config. Returns a list of strings.
|
62
|
+
def get_option_as_list(option); end
|
63
|
+
|
64
|
+
# Returns a list of all words in the passed array that are misspelled.
|
65
|
+
def list_misspelled(array_of_strings); end
|
66
|
+
|
67
|
+
# Return a list of words inside the private dictionary.
|
68
|
+
def personal_wordlist(); end
|
69
|
+
|
70
|
+
# Sync changed dictionaries to disk.
|
71
|
+
def save_all_word_lists(); end
|
72
|
+
|
73
|
+
# Return the session wordlist.
|
74
|
+
def session_wordlist(); end
|
75
|
+
|
76
|
+
# Set a passthrough option to a value. Use the strings "true" and "false" for <tt>true</tt> and <tt>false</tt>.
|
77
|
+
def set_option(option, value); end
|
78
|
+
|
79
|
+
# Returns an array of suggestions for the given word. Note that <tt>suggest</tt> returns multiple corrections even for words that are not wrong.
|
80
|
+
def suggest(word); end
|
81
|
+
|
82
|
+
# Sets the suggestion mode. Use Aspell::ULTRA, Aspell::FAST, Aspell::NORMAL, or Aspell::BADSPELLERS as the parameter.
|
83
|
+
def suggestion_mode=(mode); end
|
84
|
+
|
85
|
+
ULTRA = Fastest mode. Look only for sound-a-likes within one edit distance. No typo analysis.;
|
86
|
+
|
87
|
+
NORMAL = Normal speed mode. Look for sound-a-likes within two edit distances, with typo analysis.;
|
88
|
+
|
89
|
+
FAST = Fast mode. Look for sound-a-likes within one edit distance, with typo analysis.;
|
90
|
+
|
91
|
+
BADSPELLERS = Slowest mode. Tailored for bad spellers.;
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
=begin rdoc
|
96
|
+
Represents an Aspell dictionary. Returned by <tt>Aspell. list_dicts</tt>.
|
97
|
+
=end
|
98
|
+
|
99
|
+
class ::AspellDictInfo
|
100
|
+
|
101
|
+
# Returns the code of the dictionary.
|
102
|
+
def code; end
|
103
|
+
|
104
|
+
# Returns the jargon of the dictionary.
|
105
|
+
def jargon; end
|
106
|
+
|
107
|
+
# Returns the name of the dictionary.
|
108
|
+
def name; end
|
109
|
+
|
110
|
+
# Returns the size of the dictionary.
|
111
|
+
def size; end
|
112
|
+
|
113
|
+
end
|
data/test/simple_test.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
$:.unshift(File.dirname(__FILE__) + "/../lib/")
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require "raspell"
|
5
|
+
|
6
|
+
class TestSpell < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@aspell = Aspell.new
|
10
|
+
@text = ["Hiere is somthing wrong on the planett. And it was not the Apollo."]
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_correct_lines
|
14
|
+
assert_equal(["<wrong word> is <wrong word> wrong on the <wrong word>. And it was not the Apollo."],
|
15
|
+
@aspell.correct_lines(@text) { |word| "<wrong word>" })
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_list_mispelled
|
19
|
+
misspelled = @aspell.list_misspelled(@text).sort
|
20
|
+
assert_equal(3, misspelled.length)
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_suggest
|
24
|
+
suggestions = @aspell.suggest("spel")
|
25
|
+
assert_equal(["spell", "spiel", "spew", "Opel", "spec", "sped"],
|
26
|
+
suggestions)
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_check
|
30
|
+
assert_equal(false, @aspell.check("spel"))
|
31
|
+
assert(@aspell.check("spell"))
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dmarkow-raspell
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "1.2"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Evan Weaver
|
8
|
+
- Dylan Markow
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-04-10 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description: Update of Evan Weaver's raspell gem to support Ruby 1.9.1
|
18
|
+
email: dylan@dylanmarkow.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- LICENSE
|
25
|
+
- README
|
26
|
+
files:
|
27
|
+
- LICENSE
|
28
|
+
- README
|
29
|
+
- lib/raspell_stub.rb
|
30
|
+
- test/simple_test.rb
|
31
|
+
- CHANGELOG
|
32
|
+
- ext/extconf.rb
|
33
|
+
- ext/raspell.h
|
34
|
+
- ext/raspell.c
|
35
|
+
has_rdoc: true
|
36
|
+
homepage: http://github.com/dmarkow/raspell
|
37
|
+
post_install_message:
|
38
|
+
rdoc_options:
|
39
|
+
- --charset=UTF-8
|
40
|
+
require_paths:
|
41
|
+
- lib
|
42
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: "0"
|
47
|
+
version:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: "0"
|
53
|
+
version:
|
54
|
+
requirements: []
|
55
|
+
|
56
|
+
rubyforge_project:
|
57
|
+
rubygems_version: 1.2.0
|
58
|
+
signing_key:
|
59
|
+
specification_version: 2
|
60
|
+
summary: An interface binding for the Aspell spelling checker.
|
61
|
+
test_files:
|
62
|
+
- test/simple_test.rb
|