patrickod-raspell 1.1

Sign up to get free protection for your applications and to get access to all the features.
data/ext/raspell.h ADDED
@@ -0,0 +1,13 @@
1
+
2
+ #ifndef _RASPELL_GLOBAL_H
3
+ #define _RASPELL_GLOBAL_H
4
+
5
+ #include <ruby.h>
6
+ #include <aspell.h>
7
+
8
+ VALUE cAspell;
9
+ VALUE cDictInfo;
10
+
11
+ VALUE cAspellError;
12
+
13
+ #endif
@@ -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/raspell.gemspec ADDED
@@ -0,0 +1,31 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{patrickod-raspell}
5
+ s.version = "1.1"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Patrick O'Doherty"]
9
+ s.date = %q{2010-01-03}
10
+ s.description = %q{A fork of raspell for ruby 1.9.1}
11
+ s.email = %q{}
12
+ s.extensions = ["ext/extconf.rb"]
13
+ s.extra_rdoc_files = ["lib/raspell_stub.rb", "README", "LICENSE", "CHANGELOG"]
14
+ s.files = ["test/simple_test.rb", "lib/raspell_stub.rb", "ext/raspell.h", "ext/raspell.c", "ext/extconf.rb", "README", "LICENSE", "CHANGELOG", "raspell.gemspec", "Rakefile"]
15
+ s.homepage = %q{http://github.com/patrickod/raspell}
16
+ s.require_paths = ["lib", "ext"]
17
+ s.rubyforge_project = %q{raspell}
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{A fork of raspell for ruby 1.9.1}
20
+ s.test_files = ["test/simple_test.rb"]
21
+
22
+ if s.respond_to? :specification_version then
23
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
+ s.specification_version = 3
25
+
26
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
+ else
28
+ end
29
+ else
30
+ end
31
+ end
@@ -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", "spelt", "spew", "Opel", "spec", "sped", "Shel"],
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,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: patrickod-raspell
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.1"
5
+ platform: ruby
6
+ authors:
7
+ - Patrick O'Doherty
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-01-03 00:00:00 +00:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: A fork of raspell for ruby 1.9.1
17
+ email: ""
18
+ executables: []
19
+
20
+ extensions:
21
+ - ext/extconf.rb
22
+ extra_rdoc_files:
23
+ - lib/raspell_stub.rb
24
+ - README
25
+ - LICENSE
26
+ - CHANGELOG
27
+ files:
28
+ - test/simple_test.rb
29
+ - lib/raspell_stub.rb
30
+ - ext/raspell.h
31
+ - ext/raspell.c
32
+ - ext/extconf.rb
33
+ - README
34
+ - LICENSE
35
+ - CHANGELOG
36
+ - raspell.gemspec
37
+ - Rakefile
38
+ has_rdoc: true
39
+ homepage: http://github.com/patrickod/raspell
40
+ licenses: []
41
+
42
+ post_install_message:
43
+ rdoc_options: []
44
+
45
+ require_paths:
46
+ - lib
47
+ - ext
48
+ required_ruby_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: "0"
53
+ version:
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: "1.2"
59
+ version:
60
+ requirements: []
61
+
62
+ rubyforge_project: raspell
63
+ rubygems_version: 1.3.5
64
+ signing_key:
65
+ specification_version: 3
66
+ summary: A fork of raspell for ruby 1.9.1
67
+ test_files:
68
+ - test/simple_test.rb