spellingbee 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. data/.gitignore +3 -0
  2. data/Gemfile +3 -0
  3. data/LICENSE +20 -0
  4. data/README +40 -0
  5. data/Rakefile +2 -0
  6. data/dict/default.txt +2 -0
  7. data/doc/Gemfile.html +98 -0
  8. data/doc/LICENSE.html +117 -0
  9. data/doc/README.html +146 -0
  10. data/doc/Rakefile.html +95 -0
  11. data/doc/SpellingBee.html +586 -0
  12. data/doc/created.rid +8 -0
  13. data/doc/dict/default_txt.html +97 -0
  14. data/doc/images/brick.png +0 -0
  15. data/doc/images/brick_link.png +0 -0
  16. data/doc/images/bug.png +0 -0
  17. data/doc/images/bullet_black.png +0 -0
  18. data/doc/images/bullet_toggle_minus.png +0 -0
  19. data/doc/images/bullet_toggle_plus.png +0 -0
  20. data/doc/images/date.png +0 -0
  21. data/doc/images/find.png +0 -0
  22. data/doc/images/loadingAnimation.gif +0 -0
  23. data/doc/images/macFFBgHack.png +0 -0
  24. data/doc/images/package.png +0 -0
  25. data/doc/images/page_green.png +0 -0
  26. data/doc/images/page_white_text.png +0 -0
  27. data/doc/images/page_white_width.png +0 -0
  28. data/doc/images/plugin.png +0 -0
  29. data/doc/images/ruby.png +0 -0
  30. data/doc/images/tag_green.png +0 -0
  31. data/doc/images/wrench.png +0 -0
  32. data/doc/images/wrench_orange.png +0 -0
  33. data/doc/images/zoom.png +0 -0
  34. data/doc/index.html +80 -0
  35. data/doc/js/darkfish.js +116 -0
  36. data/doc/js/jquery.js +32 -0
  37. data/doc/js/quicksearch.js +114 -0
  38. data/doc/js/thickbox-compressed.js +10 -0
  39. data/doc/lib/spellingbee/version_rb.html +52 -0
  40. data/doc/lib/spellingbee_rb.html +52 -0
  41. data/doc/rdoc.css +706 -0
  42. data/lib/spellingbee.rb +94 -0
  43. data/lib/spellingbee/version.rb +3 -0
  44. data/spellingbee.gemspec +21 -0
  45. metadata +108 -0
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ pkg/*
2
+ *.gem
3
+ .bundle
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Nithin Bekal
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,40 @@
1
+
2
+ Spellingbee is a ruby gem that gives you spelling suggestions based on the
3
+ words present in a source file that acts as the dictionary. The alternate
4
+ spelling suggestions are based on the frequency with which the words occur
5
+ in the source file.
6
+
7
+ Usage
8
+ -----
9
+
10
+ Install the gem by using gem install spellingbee.
11
+
12
+ You can create a new spelling bee and call the correct method for a word. This
13
+ will return an array of suggestions.
14
+
15
+ s = SpellingBee.new
16
+ s.correct "speling" #=> ["spelling"]
17
+
18
+ The above example uses spellingbee's default dictionary text, which contains
19
+ just a few words. To use your own text source:
20
+
21
+ s = SpellingBee.new :source_text => 'my_file.txt'
22
+ s.correct "speling" #=> ["spelling"]
23
+
24
+ The source can be any text file that contains all the words that you might expect
25
+ the spelling corrector to be able to correct.
26
+
27
+ Credits
28
+ -------
29
+
30
+ This gem is based on the Python example in Peter Norvig's article "How to write
31
+ a spelling corrector". [http://norvig.com/spell-correct.html]
32
+
33
+ Brian Adkins wrote a version of this code in ruby and the logic used within the
34
+ SpellingBee class is based on that code.
35
+ [http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/]
36
+
37
+ License
38
+ -------
39
+
40
+ Copyright (c) 2010 Nithin Bekal, released under the MIT license
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
data/dict/default.txt ADDED
@@ -0,0 +1,2 @@
1
+ This file contains data used for testing. Let's put some words here that we
2
+ could test with. This file is loaded by default if no other file is specified.
data/doc/Gemfile.html ADDED
@@ -0,0 +1,98 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: Gemfile [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
45
+
46
+ <li class="file"><a href="./README.html">README</a></li>
47
+
48
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
49
+
50
+ <li class="file"><a href="./dict/default_txt.html">default.txt</a></li>
51
+
52
+ </ul>
53
+ </div>
54
+
55
+
56
+ <div id="classindex-section" class="section project-section">
57
+ <h3 class="section-header">Class Index
58
+ <span class="search-toggle"><img src="./images/find.png"
59
+ height="16" width="16" alt="[+]"
60
+ title="show/hide quicksearch" /></span></h3>
61
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
62
+ <fieldset>
63
+ <legend>Quicksearch</legend>
64
+ <input type="text" name="quicksearch" value=""
65
+ class="quicksearch-field" />
66
+ </fieldset>
67
+ </form>
68
+
69
+ <ul class="link-list">
70
+
71
+ <li><a href="./SpellingBee.html">SpellingBee</a></li>
72
+
73
+ </ul>
74
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
75
+ </div>
76
+
77
+
78
+ </div>
79
+ </div>
80
+
81
+ <div id="documentation">
82
+ <p>
83
+ source &#8220;<a href="http://rubygems.org">rubygems.org</a>&#8220;
84
+ </p>
85
+ <p>
86
+ # Specify your gem&#8217;s dependencies in spellingbee.gemspec gemspec
87
+ </p>
88
+
89
+ </div>
90
+
91
+ <div id="validator-badges">
92
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
93
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
94
+ Rdoc Generator</a> 1.1.6</small>.</p>
95
+ </div>
96
+ </body>
97
+ </html>
98
+
data/doc/LICENSE.html ADDED
@@ -0,0 +1,117 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: LICENSE [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
45
+
46
+ <li class="file"><a href="./README.html">README</a></li>
47
+
48
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
49
+
50
+ <li class="file"><a href="./dict/default_txt.html">default.txt</a></li>
51
+
52
+ </ul>
53
+ </div>
54
+
55
+
56
+ <div id="classindex-section" class="section project-section">
57
+ <h3 class="section-header">Class Index
58
+ <span class="search-toggle"><img src="./images/find.png"
59
+ height="16" width="16" alt="[+]"
60
+ title="show/hide quicksearch" /></span></h3>
61
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
62
+ <fieldset>
63
+ <legend>Quicksearch</legend>
64
+ <input type="text" name="quicksearch" value=""
65
+ class="quicksearch-field" />
66
+ </fieldset>
67
+ </form>
68
+
69
+ <ul class="link-list">
70
+
71
+ <li><a href="./SpellingBee.html">SpellingBee</a></li>
72
+
73
+ </ul>
74
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
75
+ </div>
76
+
77
+
78
+ </div>
79
+ </div>
80
+
81
+ <div id="documentation">
82
+ <p>
83
+ Copyright &#169; 2010 Nithin Bekal
84
+ </p>
85
+ <p>
86
+ Permission is hereby granted, free of charge, to any person obtaining
87
  a
88
+ copy of this software and associated documentation files (the
89
+ &#8220;Software&#8221;), to deal in the Software without restriction,
90
+ including
1
91
  without limitation the rights to use, copy, modify, merge,
92
+ publish,
2
93
  distribute, sublicense, and/or sell copies of the Software, and
94
+ to
3
95
  permit persons to whom the Software is furnished to do so, subject to
96
+ the following conditions:
97
+ </p>
98
+ <p>
99
+ The above copyright notice and this permission notice shall be
4
100
  included in
101
+ all copies or substantial portions of the Software.
102
+ </p>
103
+ <p>
104
+ THE SOFTWARE IS PROVIDED &#8220;AS IS&#8221;, WITHOUT WARRANTY OF ANY
105
+ KIND,
5
106
  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
107
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
6
108
  NONINFRINGEMENT. IN
109
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
7
110
  LIABLE FOR ANY CLAIM,
111
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
8
112
  OF CONTRACT, TORT OR
113
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
9
114
  WITH THE SOFTWARE OR THE
115
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
116
+ </p>
117
+
118
+ </div>
119
+
120
+ <div id="validator-badges">
121
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
122
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
123
+ Rdoc Generator</a> 1.1.6</small>.</p>
124
+ </div>
125
+ </body>
126
+ </html>
127
+
data/doc/README.html ADDED
@@ -0,0 +1,146 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
+
5
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6
+ <head>
7
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
8
+
9
+ <title>File: README [RDoc Documentation]</title>
10
+
11
+ <link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet" />
12
+
13
+ <script src="./js/jquery.js" type="text/javascript"
14
+ charset="utf-8"></script>
15
+ <script src="./js/thickbox-compressed.js" type="text/javascript"
16
+ charset="utf-8"></script>
17
+ <script src="./js/quicksearch.js" type="text/javascript"
18
+ charset="utf-8"></script>
19
+ <script src="./js/darkfish.js" type="text/javascript"
20
+ charset="utf-8"></script>
21
+ </head>
22
+
23
+ <body class="file">
24
+ <div id="metadata">
25
+ <div id="home-metadata">
26
+ <div id="home-section" class="section">
27
+ <h3 class="section-header">
28
+ <a href="./index.html">Home</a>
29
+ <a href="./index.html#classes">Classes</a>
30
+ <a href="./index.html#methods">Methods</a>
31
+ </h3>
32
+ </div>
33
+ </div>
34
+
35
+ <div id="project-metadata">
36
+
37
+
38
+ <div id="fileindex-section" class="section project-section">
39
+ <h3 class="section-header">Files</h3>
40
+ <ul>
41
+
42
+ <li class="file"><a href="./Gemfile.html">Gemfile</a></li>
43
+
44
+ <li class="file"><a href="./LICENSE.html">LICENSE</a></li>
45
+
46
+ <li class="file"><a href="./README.html">README</a></li>
47
+
48
+ <li class="file"><a href="./Rakefile.html">Rakefile</a></li>
49
+
50
+ <li class="file"><a href="./dict/default_txt.html">default.txt</a></li>
51
+
52
+ </ul>
53
+ </div>
54
+
55
+
56
+ <div id="classindex-section" class="section project-section">
57
+ <h3 class="section-header">Class Index
58
+ <span class="search-toggle"><img src="./images/find.png"
59
+ height="16" width="16" alt="[+]"
60
+ title="show/hide quicksearch" /></span></h3>
61
+ <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
62
+ <fieldset>
63
+ <legend>Quicksearch</legend>
64
+ <input type="text" name="quicksearch" value=""
65
+ class="quicksearch-field" />
66
+ </fieldset>
67
+ </form>
68
+
69
+ <ul class="link-list">
70
+
71
+ <li><a href="./SpellingBee.html">SpellingBee</a></li>
72
+
73
+ </ul>
74
+ <div id="no-class-search-results" style="display: none;">No matching classes.</div>
75
+ </div>
76
+
77
+
78
+ </div>
79
+ </div>
80
+
81
+ <div id="documentation">
82
+ <p>
83
+ Spellingbee is a ruby gem that gives you spelling suggestions based on the
84
+ words present in a source file that acts as the dictionary. The alternate
85
+ spelling suggestions are based on the frequency with which the words occur
86
+ in the source file.
87
+ </p>
88
+ <p>
89
+ Usage
90
+ </p>
91
+ <hr style="height: 3px"></hr><p>
92
+ Install the gem by using gem install spellingbee.
93
+ </p>
94
+ <p>
95
+ You can create a new spelling bee and call the correct method for a word.
96
+ This will return an array of suggestions.
97
+ </p>
98
+ <pre>
99
+ s = SpellingBee.new
100
+ s.correct &quot;speling&quot; #=&gt; [&quot;spelling&quot;]
101
+ </pre>
102
+ <p>
103
+ The above example uses spellingbee&#8217;s default dictionary text, which
104
+ contains just a few words. To use your own text source:
105
+ </p>
106
+ <pre>
107
+ s = SpellingBee.new :source_text =&gt; 'my_file.txt'
108
+ s.correct &quot;speling&quot; #=&gt; [&quot;spelling&quot;]
109
+
110
+ </pre>
111
+ <p>
112
+ The source can be any text file that contains all the words that you might
113
+ expect the spelling corrector to be able to correct.
114
+ </p>
115
+ <p>
116
+ Credits
117
+ </p>
118
+ <hr style="height: 5px"></hr><p>
119
+ This gem is based on the Python example in Peter Norvig&#8217;s article
120
+ &#8220;How to write a spelling corrector&#8221;. [<a
121
+ href="http://norvig.com/spell-correct.html">norvig.com/spell-correct.html</a>]
122
+ </p>
123
+ <p>
124
+ Brian Adkins wrote a version of this code in ruby and the logic used within
125
+ the <a href="SpellingBee.html">SpellingBee</a> class is based on that code.
126
+ </p>
127
+ <dl>
128
+ <dt><a href="http://lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/">lojic.com/blog/2008/09/04/how-to-write-a-spelling-corrector-in-ruby/</a></dt><dd></dd>
129
+ </dl>
130
+ <p>
131
+ License
132
+ </p>
133
+ <hr style="height: 5px"></hr><p>
134
+ Copyright &#169; 2010 Nithin Bekal, released under the MIT license
135
+ </p>
136
+
137
+ </div>
138
+
139
+ <div id="validator-badges">
140
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
141
+ <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
142
+ Rdoc Generator</a> 1.1.6</small>.</p>
143
+ </div>
144
+ </body>
145
+ </html>
146
+