blurrily 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -3
- data/ext/blurrily/map_ext.c +1 -1
- data/lib/blurrily/map.rb +22 -10
- data/lib/blurrily/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2fb2ab9e2c0e96d8a65f2a86ab5ccda4686cec85
|
4
|
+
data.tar.gz: 1cf52f8ba96a911f8e0ba140c87ff2ed50e68aac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f464ef07e4140191d33d14192eb32a5f39c6493b0709bd0bd3316b0e33b52de6b9cf9ed56bd961f3dd4c2d1078633a0be3007431587efb12e4c2f859310dd61f
|
7
|
+
data.tar.gz: 8b81f4c68be6b464f8d4408e458037c1602e6e448f658c6b2b333b5d8f83f8b6ddfa7fe849b244a0e61b11f6937b68a1b3189f9a417b14cdb97f002bb379f960
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Blurrily — Millisecond fuzzy string matching
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/blurrily.png)](http://badge.fury.io/rb/blurrily)
|
3
4
|
[![Build Status](https://travis-ci.org/mezis/blurrily.png?branch=master)](https://travis-ci.org/mezis/blurrily)
|
4
5
|
[![Dependency Status](https://gemnasium.com/mezis/blurrily.png)](https://gemnasium.com/mezis/blurrily)
|
5
6
|
[![Code Climate](https://codeclimate.com/github/mezis/blurrily.png)](https://codeclimate.com/github/mezis/blurrily)
|
@@ -9,9 +10,10 @@
|
|
9
10
|
> Here aresome photos of **Marrakesh**, Morroco.
|
10
11
|
> Did you mean **Martanesh**, Albania, **Marakkanam**, India, or **Marasheshty**, Romania?
|
11
12
|
|
12
|
-
Blurrily
|
13
|
-
It scales well: its response time is typically 1-2ms on
|
14
|
-
and 75-100ms on pathological datasets
|
13
|
+
Blurrily finds misspelled, prefix, or partial needles in a haystack of
|
14
|
+
strings, quickly. It scales well: its response time is typically 1-2ms on
|
15
|
+
user-input datasets and 75-100ms on pathological datasets
|
16
|
+
([more](#benchmarks)).
|
15
17
|
|
16
18
|
Blurrily is compatible and tested with all MRI Rubies from 1.8.7 to 2.0.0.
|
17
19
|
It is tested on Linux 2.6 (32bit and 64bit) and MacOS X 10.8.
|
data/ext/blurrily/map_ext.c
CHANGED
@@ -210,7 +210,7 @@ void Init_map_ext(void) {
|
|
210
210
|
eBlurrilyModule = rb_define_module("Blurrily");
|
211
211
|
assert(eBlurrilyModule != Qnil);
|
212
212
|
|
213
|
-
klass = rb_define_class_under(eBlurrilyModule, "
|
213
|
+
klass = rb_define_class_under(eBlurrilyModule, "RawMap", rb_cObject);
|
214
214
|
assert(klass != Qnil);
|
215
215
|
|
216
216
|
eClosedError = rb_define_class_under(klass, "ClosedError", rb_eRuntimeError);
|
data/lib/blurrily/map.rb
CHANGED
@@ -3,24 +3,37 @@ require 'active_support/core_ext/module/aliasing' # alias_method_chain
|
|
3
3
|
require 'active_support/core_ext/string/multibyte' # mb_chars
|
4
4
|
|
5
5
|
module Blurrily
|
6
|
-
Map
|
6
|
+
class Map < RawMap
|
7
7
|
|
8
|
-
def
|
8
|
+
def put(needle, reference, weight=nil)
|
9
9
|
weight ||= 0
|
10
10
|
needle = normalize_string needle
|
11
|
-
|
11
|
+
@clean_path = nil
|
12
|
+
super(needle, reference, weight)
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
def find_with_string_normalize(needle, limit=10)
|
15
|
+
def find(needle, limit=10)
|
18
16
|
needle = normalize_string needle
|
19
|
-
|
17
|
+
super(needle, limit)
|
18
|
+
end
|
19
|
+
|
20
|
+
def delete(*args)
|
21
|
+
@clean_path = nil
|
22
|
+
super(*args)
|
20
23
|
end
|
21
24
|
|
22
|
-
|
25
|
+
def save(path)
|
26
|
+
return if @clean_path == path
|
27
|
+
super(path)
|
28
|
+
@clean_path = path
|
29
|
+
nil
|
30
|
+
end
|
23
31
|
|
32
|
+
def self.load(path)
|
33
|
+
super(path).tap do |map|
|
34
|
+
map.instance_variable_set :@clean_path, path
|
35
|
+
end
|
36
|
+
end
|
24
37
|
|
25
38
|
private
|
26
39
|
|
@@ -32,6 +45,5 @@ module Blurrily
|
|
32
45
|
end
|
33
46
|
result.gsub(/\s+/,' ').strip
|
34
47
|
end
|
35
|
-
|
36
48
|
end
|
37
49
|
end
|
data/lib/blurrily/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurrily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-04-
|
11
|
+
date: 2013-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
268
|
version: '0'
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
|
-
rubygems_version: 2.0.
|
271
|
+
rubygems_version: 2.0.3
|
272
272
|
signing_key:
|
273
273
|
specification_version: 4
|
274
274
|
summary: Native fuzzy string search
|