english_spellchecker 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d118ffc67e55e9143620181f273940f4f7e7be2eb2b0de812e33d8783e18fe75
4
- data.tar.gz: f6f00e8be81fea8f9c8dba4e143fbd4797b85dd103906720f33ede1e983a0d77
3
+ metadata.gz: 056ba76eec4fef9a43ee6f6f11a19ae1c226a402a085da7a6671dfb2ccbe1dc6
4
+ data.tar.gz: 779525c9fc9c98e5246f750321e73eba164fc053064128ee5b8e969433a375b2
5
5
  SHA512:
6
- metadata.gz: 537814cd8b0f61782c5a4daa438f2142b0d2aa2c9d08f94a344ee8b532fd41ed50b7df76e934eb0d766cbfa68bffe5d76da6f6152de5a97cc41e37b85a78cf71
7
- data.tar.gz: 83c9c99457a609e817ccd53cbe66c81c6914daed5adca6ef863218e654dbe2ca2f2711d148490c86565ee0bc66fc454f65a717c4e28c9202c416edbb4d4a25f2
6
+ metadata.gz: 84dad9b1cb4eb8ee8203fed86d578cb221d1cbd3399fb26bd1a69d46cc86688430b219a3b8540a3846c8eb9eef731958ccecb7cca15eb2fac0071f17d1fa04e7
7
+ data.tar.gz: a86576181da3d4e6b475618fe18a4b8c7adbb834c7fc7388b13906105b7365434f930e551c8b2cda41023b65f4bd78b13591b3e84b9ecefd18c5d40a8e06dd8e
checksums.yaml.gz.sig CHANGED
Binary file
@@ -11,9 +11,14 @@ class EnglishSpellcheck
11
11
 
12
12
  @words = Words2DotDat.words
13
13
 
14
- def initialize()
14
+ def initialize(debug: false)
15
+
16
+ @debug = debug
15
17
  @words = Words2DotDat.words
16
- @spelling = DidYouMean::SpellChecker.new(dictionary: @words)
18
+ @spelling = ('a'..'z').map do |c|
19
+ DidYouMean::SpellChecker.new(dictionary: @words.select {|x| x[0] == c})
20
+ end
21
+
17
22
  end
18
23
 
19
24
  def self.spell(raww, verbose: true)
@@ -21,7 +26,8 @@ class EnglishSpellcheck
21
26
  w = raww.downcase
22
27
 
23
28
  return raww if @words.include? w
24
- r = DidYouMean::SpellChecker.new(dictionary: @words).correct(w)
29
+ list = @words.select {|x| x[0] == w[0]}
30
+ r = DidYouMean::SpellChecker.new(dictionary: list).correct(w)
25
31
 
26
32
  if r.any? then
27
33
 
@@ -60,7 +66,9 @@ class EnglishSpellcheck
60
66
  w = raww.downcase
61
67
 
62
68
  return raww if @words.include? w
63
- r = @spelling.correct w
69
+ c = w[0].ord - 97
70
+ puts 'c: ' + c.inspect if @debug
71
+ r = @spelling[c].correct w
64
72
 
65
73
  if r.any? then
66
74
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: english_spellchecker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -36,7 +36,7 @@ cert_chain:
36
36
  i/2txSflqYUUrcpt7Nw/jBhIhPD17gtkt93TyMkMATK8LOOiRBzUeSoLmcUZV/cd
37
37
  Os7I/4C4AaEaqtRAvendPVG41n9/F/5Hp2c=
38
38
  -----END CERTIFICATE-----
39
- date: 2022-11-02 00:00:00.000000000 Z
39
+ date: 2022-11-04 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: words2dotdat
metadata.gz.sig CHANGED
Binary file