sentino 0.2.1 → 0.2.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d248961bc584b3dd5908477776a03126337a822b
4
- data.tar.gz: 02134d3edbb165f9b1cb3b25f59e1e2f34007226
3
+ metadata.gz: e57080c59573aa3c0b0e2fc34007ffeed0d3e6e0
4
+ data.tar.gz: 76092a3d41038d6d4474885e38e38751fc185a75
5
5
  SHA512:
6
- metadata.gz: c8651282b7b1d78f89a084def4e353da86d069bfbff835137817a102bb2212fe747b50f45b12c961ea3a0511c09658c44cdc08c40be6b4c14eb3e8565d961485
7
- data.tar.gz: 092d68aaaa736fbff7e88f510fa7ec67cd48b63adfbc0737ec264d488e50e4ebc85399b7d8e11db8e38017b105b2cc7087f76a2e193c61ad07c31b819723cf63
6
+ metadata.gz: aaec1c17e79368c04f72956168ea526f1a9cd834d01c4c6cc63026a441a956feaede9ec9d460b1b374c4fd554b87ade578c287b73c09c436f4359390ee8762fc
7
+ data.tar.gz: 45d0f88d26e7cb82ff669a8963a7603d45af7b78c79bf5cf507acecb2d491a40a26d72441d4079997e9b3df8f3d95ab1ad71fcc7470dd519aafcbd4f32ad1e30
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -14,7 +14,10 @@ private
14
14
  words = string.split(" ").map{|s| s.downcase}
15
15
  matchings = []
16
16
  for word in words
17
- matchings += create_matchings(word) if word.length > 3
17
+ if word.length > 3
18
+ wordgroups = create_matchings(word)
19
+ matchings << wordgroups
20
+ end
18
21
  end
19
22
  matchings
20
23
  end
@@ -36,9 +39,21 @@ private
36
39
  end
37
40
 
38
41
  def check(string)
42
+ checked_words = []
39
43
  counts = []
40
- for mathcer in @reference
41
- counts << count_matchings(string, mathcer)
44
+ for words in @reference
45
+ #counts << count_matchings(string, mathcer)
46
+ res = 0
47
+ words = words.sort_by(&:length).reverse
48
+ for word in words
49
+ break if checked_words.include? word
50
+ res = count_matchings(string, word)
51
+ if res > 0
52
+ checked_words << word
53
+ break
54
+ end
55
+ end
56
+ counts << res
42
57
  end
43
58
  total_length = counts.map{|x| x == 0 ? 1 : x}.reduce(:+)
44
59
  matching_length = counts.reduce(:+)
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: sentino 0.2.1 ruby lib
5
+ # stub: sentino 0.2.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sentino"
9
- s.version = "0.2.1"
9
+ s.version = "0.2.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -32,5 +32,13 @@ class TestSentino < Test::Unit::TestCase
32
32
  assert_true sentino.match(obst) < sentino.match(suger)
33
33
  end
34
34
 
35
+ should "give a higher value for roggen then for mohn" do
36
+ reference = "Brot, Cerealien & Backwaren > Mehl, Getreide & Backzutaten > Getreide > Roggen"
37
+ mohn = "Lebens­mittel Backen Backzutaten Mohn"
38
+ roggen = "Lebens­mittel Mehl Stärke & Co. Mehl & Getreide Roggenmehl"
39
+ sentino = Sentino::Pattern.new(reference)
40
+ assert_true sentino.match(mohn) < sentino.match(roggen)
41
+ end
42
+
35
43
 
36
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sentino
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ferhat Ziba