goospell 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,8 @@ module Goospell
30
30
  doc.elements.each('spellresult/c') do |correction|
31
31
  #string = "asdfasf tehes"
32
32
  #format is <c o="8" l="5">these the theory</c>
33
- out.merge!({ full_text[correction.attributes['o'].to_i,correction.attributes['l'].to_i] => correction.text.split("\t") })
33
+ variants = correction.text ? correction.text.split("\t") : []
34
+ out.merge!({ full_text[correction.attributes['o'].to_i,correction.attributes['l'].to_i] => variants })
34
35
  end
35
36
  end
36
37
  out
@@ -1,3 +1,3 @@
1
1
  module Goospell
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -11,4 +11,10 @@ class GoospellTest < Test::Unit::TestCase
11
11
  corrections = Goospell::spell('teh')
12
12
  assert corrections['teh'].include?('the')
13
13
  end
14
+
15
+ def test_returns_empty_list_of_variants_if_none_found
16
+ example = 'm'*10
17
+ corrections = Goospell::spell(example)
18
+ assert corrections[example].empty?
19
+ end
14
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goospell
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-26 00:00:00.000000000 Z
12
+ date: 2013-01-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: to_xml