english_spellchecker 0.1.0
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.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/english_spellchecker.rb +40 -0
- metadata +88 -0
- metadata.gz.sig +0 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c6064eb8930e7a5b0fbf18682e6294fea44bda02
|
4
|
+
data.tar.gz: 1608aedae5716002833d460c224f708212fba453
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72470d31c1462747c2be180e6f91463106d6797f539bf53a05e1257b221f0c71dd8bb27b873c0fb5c5701d17fcd9852877d3a6988182b80c1b34fbda98f5ca87
|
7
|
+
data.tar.gz: 6dbfb08973cae7b6e480231251ab45bf0b694daffb376afb683ffb08f0b0903e7cb1dd77d19ae6ba778c24bea7f1bdb787d05981f2e823a9487040fbe89f87ff
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
ADDED
Binary file
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: english_spellchecker.rb
|
4
|
+
|
5
|
+
|
6
|
+
require 'wordsdotdat'
|
7
|
+
require 'did_you_mean'
|
8
|
+
|
9
|
+
|
10
|
+
class EnglishSpellcheck
|
11
|
+
|
12
|
+
def initialize()
|
13
|
+
@spelling = DidYouMean::SpellChecker.new(dictionary: WordsDotDat.words)
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.spell(w)
|
17
|
+
|
18
|
+
r = DidYouMean::SpellChecker.new(dictionary: WordsDotDat.words).correct(w)
|
19
|
+
r.any? ? r.first : nil
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
def inspect()
|
24
|
+
"<EnglishSpellcheck::#{self.object_id} @spelling=DidYouMean::SpellChecker>"
|
25
|
+
end
|
26
|
+
|
27
|
+
def spell(w)
|
28
|
+
r = @spelling.correct w
|
29
|
+
r.any? ? r.first : nil
|
30
|
+
end
|
31
|
+
|
32
|
+
alias spelling spell
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
if __FILE__ == $0 then
|
37
|
+
|
38
|
+
EnglishSpellcheck.spell ARGV.first
|
39
|
+
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: english_spellchecker
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- James Robertson
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
|
14
|
+
YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
|
15
|
+
8ixkARkWAmV1MB4XDTE3MTEwNTEzNTYyOVoXDTE4MTEwNTEzNTYyOVowSDESMBAG
|
16
|
+
A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
|
17
|
+
EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
18
|
+
ggEBAMqRGLMP9ulcSKVcqMDz6V04T/Jw2gDC8xw+WoWZvDalLG0YobZce2MGD5p0
|
19
|
+
TKPK0X2DCYHYRoNUSLxtAAfjhjtaw2bGdps7rQ5kAfkAk3A5dfO4NM+Wy1nzlpiq
|
20
|
+
P64DWczsVYRacGGgBZSwjVRkpEmARllSbyFCCt6UkKn4RrTHlXkt9iVfxrq08Vv3
|
21
|
+
fZDKD2OXxhaZ8kdskhtofY6/HD/DsxDi1bTom5lD+vzuSB5RxeJa0PdoGYMFKKZK
|
22
|
+
qDWRD9TRmry3w/LpISlsCsjxiPWv3FQ00n6OCcI3xIdbuxSjhSzVNQi8u+kitrpf
|
23
|
+
vYU8fW+O2xad0rD6bFYrc1o2Eh8CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
|
24
|
+
DwQEAwIEsDAdBgNVHQ4EFgQUcy7xxuv+5Y4uxJJJl4vBbTqyAvwwJgYDVR0RBB8w
|
25
|
+
HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
|
26
|
+
c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAq3LD6GE1
|
27
|
+
iaPEcLHCeI7MOMFfQkHKYmL3vBgbopITy+0IVA2p5/c17/meBYPso/McAhSWmMvk
|
28
|
+
v2rfqPFf76+wykLlQGlX8MeX3wsyvHW+OkxePtNdywPwmZbtEVO5F2WgC3Pn0g2o
|
29
|
+
4uucymxMR1cRoCU5jI4FrOwkMSKA0nW+PsW8XcHk9Ug0UPZjQOhbO1zTqdq6QhBk
|
30
|
+
IdWyGQRTpJ7qmKN4PuIgNGlOU0b/EuN2eGGfTJpz1X7tzFRQlxtGOkR8MVP3z/fR
|
31
|
+
hI4uK3ROqPGwICHo1ds+N1Qg8uB0v8blblwjJmUftIRr/vxOvRIhbNAa/CrRGLy9
|
32
|
+
zCdnHSVuNTAd8A==
|
33
|
+
-----END CERTIFICATE-----
|
34
|
+
date: 2017-11-05 00:00:00.000000000 Z
|
35
|
+
dependencies:
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: wordsdotdat
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0.1'
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.1
|
46
|
+
type: :runtime
|
47
|
+
prerelease: false
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0.1'
|
53
|
+
- - ">="
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.1.1
|
56
|
+
description:
|
57
|
+
email: james@jamesrobertson.eu
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- lib/english_spellchecker.rb
|
63
|
+
homepage: https://github.com/jrobertson/english_spellchecker
|
64
|
+
licenses:
|
65
|
+
- MIT
|
66
|
+
metadata: {}
|
67
|
+
post_install_message:
|
68
|
+
rdoc_options: []
|
69
|
+
require_paths:
|
70
|
+
- lib
|
71
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
requirements: []
|
82
|
+
rubyforge_project:
|
83
|
+
rubygems_version: 2.6.13
|
84
|
+
signing_key:
|
85
|
+
specification_version: 4
|
86
|
+
summary: A basic English dictionary spellchecker which returns the correctly spelled
|
87
|
+
word or nil if the word was not found.
|
88
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|