soulmate 0.1.3 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  module Soulmate
2
4
  module Helpers
3
5
 
@@ -11,8 +13,9 @@ module Soulmate
11
13
  end
12
14
 
13
15
  def normalize(str)
14
- str.downcase.gsub(/[^a-z0-9 ]/i, '').strip
16
+ # Letter, Mark, Number, Connector_Punctuation (Chinese, Japanese, etc.)
17
+ str.downcase.gsub(/[^\p{Word}\ ]/i, '').strip
15
18
  end
16
19
 
17
20
  end
18
- end
21
+ end
@@ -1,8 +1,8 @@
1
1
  module Soulmate
2
2
  module Version
3
- MAJOR = 0
4
- MINOR = 1
5
- PATCH = 3
3
+ MAJOR = 1
4
+ MINOR = 0
5
+ PATCH = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
data/soulmate.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{soulmate}
8
- s.version = "0.1.3"
7
+ s.name = "soulmate"
8
+ s.version = "1.0.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Eric Waller"]
12
- s.date = %q{2012-03-29}
13
- s.description = %q{Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences.}
14
- s.email = %q{eric@seatgeek.com}
12
+ s.date = "2013-02-04"
13
+ s.description = "Soulmate is a tool to help solve the common problem of developing a fast autocomplete feature. It uses Redis's sorted sets to build an index of partial words and corresponding top matches, and provides a simple sinatra app to query them. Soulmate finishes your sentences."
14
+ s.email = "eric@seatgeek.com"
15
15
  s.executables = ["soulmate", "soulmate-web"]
16
16
  s.extra_rdoc_files = [
17
17
  "LICENSE.txt",
@@ -40,15 +40,11 @@ Gem::Specification.new do |s|
40
40
  "test/test.conf",
41
41
  "test/test_soulmate.rb"
42
42
  ]
43
- s.homepage = %q{http://github.com/seatgeek/soulmate}
43
+ s.homepage = "http://github.com/seatgeek/soulmate"
44
44
  s.licenses = ["MIT"]
45
45
  s.require_paths = ["lib"]
46
- s.rubygems_version = %q{1.6.2}
47
- s.summary = %q{Redis-backed service for fast autocompleting - extracted from SeatGeek}
48
- s.test_files = [
49
- "test/helper.rb",
50
- "test/test_soulmate.rb"
51
- ]
46
+ s.rubygems_version = "1.8.24"
47
+ s.summary = "Redis-backed service for fast autocompleting - extracted from SeatGeek"
52
48
 
53
49
  if s.respond_to? :specification_version then
54
50
  s.specification_version = 3
@@ -4,3 +4,4 @@
4
4
  {"id":29,"term":"Sun Life Stadium","score":75,"data":{"url":"\/sun-life-stadium-tickets\/","subtitle":"Miami, FL"},"aliases":["Dolphins Stadium","Land Shark Stadium"]}
5
5
  {"id":2,"term":"Turner Field","score":50,"data":{"url":"\/turner-field-tickets\/","subtitle":"Atlanta, GA"}}
6
6
  {"id":3,"term":"Citi Field","score":92,"data":{"url":"\/citi-field-tickets\/","subtitle":"Atlanta, GA"},"aliases":["Shea Stadium"]}
7
+ {"id":8,"term":"中国佛山 李小龙","score":94,"data":{"url":"\/Bruce Lee\/","subtitle":"Chinese Foshan"},"aliases":["Li XiaoLong"]}
@@ -1,3 +1,5 @@
1
+ # coding: utf-8
2
+
1
3
  require 'helper'
2
4
 
3
5
  class TestSoulmate < Test::Unit::TestCase
@@ -10,7 +12,7 @@ class TestSoulmate < Test::Unit::TestCase
10
12
 
11
13
  items_loaded = Soulmate::Loader.new('venues').load(items)
12
14
 
13
- assert_equal 6, items_loaded.size
15
+ assert_equal 7, items_loaded.size
14
16
 
15
17
  matcher = Soulmate::Matcher.new('venues')
16
18
  results = matcher.matches_for_term('stad', :limit => 5)
@@ -28,7 +30,7 @@ class TestSoulmate < Test::Unit::TestCase
28
30
 
29
31
  items_loaded = Soulmate::Loader.new('venues').load(items)
30
32
 
31
- assert_equal 6, items_loaded.size
33
+ assert_equal 7, items_loaded.size
32
34
 
33
35
  matcher = Soulmate::Matcher.new('venues')
34
36
  results = matcher.matches_for_term('land shark stadium', :limit => 5)
@@ -36,6 +38,11 @@ class TestSoulmate < Test::Unit::TestCase
36
38
  assert_equal 1, results.size
37
39
  assert_equal 'Sun Life Stadium', results[0]['term']
38
40
 
41
+ # Test Chinese
42
+ results = matcher.matches_for_term('中国', :limit => 5)
43
+ assert_equal 1, results.size
44
+ assert_equal '中国佛山 李小龙', results[0]['term']
45
+
39
46
  # Make sure we don't get dupes between aliases and the original term
40
47
  # this shouldn't happen due to Redis doing an intersect, but just in case!
41
48
 
@@ -101,5 +108,7 @@ class TestSoulmate < Test::Unit::TestCase
101
108
  assert_equal ["te", "tes", "test", "testi", "testin", "th", "thi", "this"], loader.prefixes_for_phrase("testin' this")
102
109
  assert_equal ["te", "tes", "test"], loader.prefixes_for_phrase("test test")
103
110
  assert_equal ["so", "sou", "soul", "soulm", "soulma", "soulmat", "soulmate"], loader.prefixes_for_phrase("SoUlmATE")
111
+
112
+ assert_equal ['测试', '测试中', '测试中文', 'te', 'tes', 'test'], loader.prefixes_for_phrase('测试中文 test')
104
113
  end
105
114
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soulmate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-29 00:00:00.000000000 -04:00
13
- default_executable:
12
+ date: 2013-02-04 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: redis
17
- requirement: &2167703600 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,15 @@ dependencies:
22
21
  version: '2.0'
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *2167703600
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
26
30
  - !ruby/object:Gem::Dependency
27
31
  name: vegas
28
- requirement: &2167702760 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ! '>='
@@ -33,10 +37,15 @@ dependencies:
33
37
  version: 0.1.0
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *2167702760
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: 0.1.0
37
46
  - !ruby/object:Gem::Dependency
38
47
  name: sinatra
39
- requirement: &2167702240 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
50
  requirements:
42
51
  - - ! '>='
@@ -44,10 +53,15 @@ dependencies:
44
53
  version: '1.0'
45
54
  type: :runtime
46
55
  prerelease: false
47
- version_requirements: *2167702240
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: multi_json
50
- requirement: &2167701580 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
66
  requirements:
53
67
  - - ! '>='
@@ -55,10 +69,15 @@ dependencies:
55
69
  version: '1.0'
56
70
  type: :runtime
57
71
  prerelease: false
58
- version_requirements: *2167701580
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '1.0'
59
78
  - !ruby/object:Gem::Dependency
60
79
  name: shoulda
61
- requirement: &2167700960 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
62
81
  none: false
63
82
  requirements:
64
83
  - - ! '>='
@@ -66,10 +85,15 @@ dependencies:
66
85
  version: '0'
67
86
  type: :development
68
87
  prerelease: false
69
- version_requirements: *2167700960
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
70
94
  - !ruby/object:Gem::Dependency
71
95
  name: bundler
72
- requirement: &2167700400 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
73
97
  none: false
74
98
  requirements:
75
99
  - - ~>
@@ -77,10 +101,15 @@ dependencies:
77
101
  version: '1.0'
78
102
  type: :development
79
103
  prerelease: false
80
- version_requirements: *2167700400
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '1.0'
81
110
  - !ruby/object:Gem::Dependency
82
111
  name: jeweler
83
- requirement: &2167699780 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
84
113
  none: false
85
114
  requirements:
86
115
  - - ~>
@@ -88,7 +117,12 @@ dependencies:
88
117
  version: '1.5'
89
118
  type: :development
90
119
  prerelease: false
91
- version_requirements: *2167699780
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '1.5'
92
126
  description: Soulmate is a tool to help solve the common problem of developing a fast
93
127
  autocomplete feature. It uses Redis's sorted sets to build an index of partial words
94
128
  and corresponding top matches, and provides a simple sinatra app to query them.
@@ -123,7 +157,6 @@ files:
123
157
  - test/samples/venues.json
124
158
  - test/test.conf
125
159
  - test/test_soulmate.rb
126
- has_rdoc: true
127
160
  homepage: http://github.com/seatgeek/soulmate
128
161
  licenses:
129
162
  - MIT
@@ -139,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
139
172
  version: '0'
140
173
  segments:
141
174
  - 0
142
- hash: -3030070471099645634
175
+ hash: 2119288237740455138
143
176
  required_rubygems_version: !ruby/object:Gem::Requirement
144
177
  none: false
145
178
  requirements:
@@ -148,10 +181,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
181
  version: '0'
149
182
  requirements: []
150
183
  rubyforge_project:
151
- rubygems_version: 1.6.2
184
+ rubygems_version: 1.8.24
152
185
  signing_key:
153
186
  specification_version: 3
154
187
  summary: Redis-backed service for fast autocompleting - extracted from SeatGeek
155
- test_files:
156
- - test/helper.rb
157
- - test/test_soulmate.rb
188
+ test_files: []