blurrily 1.0.1 → 1.0.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 +4 -4
- data/README.md +1 -1
- data/ext/blurrily/blurrily.h +6 -1
- data/ext/blurrily/storage.c +3 -3
- data/ext/blurrily/storage.h +5 -1
- data/ext/blurrily/tokeniser.h +5 -0
- 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: 6d589b491f1c3cb4e02d4d01c537481214849b79
|
4
|
+
data.tar.gz: 6878872b390a92ce118ec9d2f882628e0c79c460
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1cd22deb6a6e87899e4a99b395da4e2f661a9f233717e4b451f5744897d5cfec4c82b5bbae28b017622894439af70dddf792fcda77aad0a7b02ffbadadcae98
|
7
|
+
data.tar.gz: 3725e7de9b874849c8fb27ba6dad46c2f0a2098302aaa8c138cd5227d83e9cff58dee590be944540060df6636a9e43f2ceaef4e3736f42953103da111236fe83
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
> Show me photos of **Marakech** !
|
10
10
|
>
|
11
|
-
> Here
|
11
|
+
> Here are some photos of **Marrakesh**, Morroco.
|
12
12
|
> Did you mean **Martanesh**, Albania, **Marakkanam**, India, or **Marasheshty**, Romania?
|
13
13
|
|
14
14
|
Blurrily finds misspelled, prefix, or partial needles in a haystack of
|
data/ext/blurrily/blurrily.h
CHANGED
@@ -6,7 +6,10 @@
|
|
6
6
|
|
7
7
|
*/
|
8
8
|
|
9
|
-
#
|
9
|
+
#ifndef __BLURRILY_H__
|
10
|
+
#define __BLURRILY_H__ 1
|
11
|
+
|
12
|
+
#define BR_PACKED_STRUCT __attribute__ ((__packed__))
|
10
13
|
#define UNUSED(_IDENT) _IDENT __attribute__ ((unused))
|
11
14
|
|
12
15
|
#ifdef DEBUG
|
@@ -14,3 +17,5 @@
|
|
14
17
|
#else
|
15
18
|
#define LOG(...)
|
16
19
|
#endif
|
20
|
+
|
21
|
+
#endif
|
data/ext/blurrily/storage.c
CHANGED
@@ -33,7 +33,7 @@
|
|
33
33
|
/******************************************************************************/
|
34
34
|
|
35
35
|
/* one trigram entry -- client reference and sorting weight */
|
36
|
-
struct
|
36
|
+
struct BR_PACKED_STRUCT trigram_entry_t
|
37
37
|
{
|
38
38
|
uint32_t reference;
|
39
39
|
uint32_t weight;
|
@@ -44,7 +44,7 @@ typedef struct trigram_entry_t trigram_entry_t;
|
|
44
44
|
/* collection of entries for a given trigram */
|
45
45
|
/* <entries> points to an array of <buckets> entries */
|
46
46
|
/* of which <used> are filled */
|
47
|
-
struct
|
47
|
+
struct BR_PACKED_STRUCT trigram_entries_t
|
48
48
|
{
|
49
49
|
uint32_t buckets;
|
50
50
|
uint32_t used;
|
@@ -59,7 +59,7 @@ typedef struct trigram_entries_t trigram_entries_t;
|
|
59
59
|
|
60
60
|
/* hash map of all possible trigrams to collection of entries */
|
61
61
|
/* there are 28^3 = 19,683 possible trigrams */
|
62
|
-
struct
|
62
|
+
struct BR_PACKED_STRUCT trigram_map_t
|
63
63
|
{
|
64
64
|
char magic[6]; /* the string "trigra" */
|
65
65
|
uint8_t big_endian;
|
data/ext/blurrily/storage.h
CHANGED
@@ -5,6 +5,9 @@
|
|
5
5
|
Trigram map creation, persistence, and qurying.
|
6
6
|
|
7
7
|
*/
|
8
|
+
#ifndef __STORAGE_H__
|
9
|
+
#define __STORAGE_H__
|
10
|
+
|
8
11
|
#include <inttypes.h>
|
9
12
|
#include "tokeniser.h"
|
10
13
|
#include "blurrily.h"
|
@@ -12,7 +15,7 @@
|
|
12
15
|
struct trigram_map_t;
|
13
16
|
typedef struct trigram_map_t* trigram_map;
|
14
17
|
|
15
|
-
struct
|
18
|
+
struct BR_PACKED_STRUCT trigram_match_t {
|
16
19
|
uint32_t reference;
|
17
20
|
uint32_t matches;
|
18
21
|
uint32_t weight;
|
@@ -113,3 +116,4 @@ int blurrily_storage_find(trigram_map haystack, const char* needle, uint16_t lim
|
|
113
116
|
*/
|
114
117
|
int blurrily_storage_stats(trigram_map haystack, trigram_stat_t* stats);
|
115
118
|
|
119
|
+
#endif
|
data/ext/blurrily/tokeniser.h
CHANGED
@@ -14,6 +14,9 @@
|
|
14
14
|
Each trigram is represented by a 16-bit integer.
|
15
15
|
|
16
16
|
*/
|
17
|
+
#ifndef __TOKENISER_H__
|
18
|
+
#define __TOKENISER_H__
|
19
|
+
|
17
20
|
#include <inttypes.h>
|
18
21
|
|
19
22
|
#define TRIGRAM_BASE 28
|
@@ -39,3 +42,5 @@ int blurrily_tokeniser_parse_string(const char* input, trigram_t* output);
|
|
39
42
|
Returns positive on success, negative on failure.
|
40
43
|
*/
|
41
44
|
int blurrily_tokeniser_trigram(trigram_t input, char* output);
|
45
|
+
|
46
|
+
#endif
|
data/lib/blurrily/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blurrily
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Julien Letessier
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-01-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
@@ -270,7 +270,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
270
270
|
version: '0'
|
271
271
|
requirements: []
|
272
272
|
rubyforge_project:
|
273
|
-
rubygems_version: 2.
|
273
|
+
rubygems_version: 2.4.5
|
274
274
|
signing_key:
|
275
275
|
specification_version: 4
|
276
276
|
summary: Native fuzzy string search
|