aurelian-ruby-ahocorasick 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/ahocorasick/extconf.rb +1 -1
- data/ext/ahocorasick/ruby-ahocorasick.c +3 -4
- data/lib/ahocorasick.rb +6 -3
- metadata +2 -2
data/ext/ahocorasick/extconf.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
|
2
1
|
//
|
3
|
-
// (c) 2008, Aurelian Oancea < oancea at gmail dot com >
|
2
|
+
// (c) 2008, 2009 Aurelian Oancea < oancea at gmail dot com >
|
4
3
|
//
|
5
4
|
// Released under MIT-LICENSE
|
6
5
|
//
|
@@ -9,7 +8,6 @@
|
|
9
8
|
// TODO: new methods?
|
10
9
|
//
|
11
10
|
// * kwt[id] = word
|
12
|
-
// * kwt.from_file (class instance method)
|
13
11
|
//
|
14
12
|
// * kwt.find_each ("str") {|r| .. }
|
15
13
|
// * kwt.find_first("str")
|
@@ -46,6 +44,7 @@ static VALUE
|
|
46
44
|
rb_rf_init(VALUE self) {
|
47
45
|
return self;
|
48
46
|
}
|
47
|
+
|
49
48
|
static VALUE
|
50
49
|
rb_rf_valid(int argc, VALUE *argv, VALUE self) {
|
51
50
|
VALUE result;
|
@@ -134,7 +133,7 @@ rb_kwt_make(VALUE self)
|
|
134
133
|
* kwt.add_string("one")
|
135
134
|
* kwt.add_string("two")
|
136
135
|
*
|
137
|
-
* kwt.
|
136
|
+
* kwt.find_all( "moved two times already" ).each do | result |
|
138
137
|
* result[:id] # => 2
|
139
138
|
* result[:ends_at] # => 9
|
140
139
|
* result[:starts_at] # => 6
|
data/lib/ahocorasick.rb
CHANGED
@@ -2,15 +2,18 @@
|
|
2
2
|
require 'ahocorasick/native'
|
3
3
|
|
4
4
|
module AhoCorasick
|
5
|
-
VERSION='0.
|
5
|
+
VERSION='0.6.1'
|
6
6
|
|
7
7
|
class KeywordTree
|
8
8
|
|
9
|
+
def from_file file
|
10
|
+
File.read(file).each { | string | self.add_string string }
|
11
|
+
self
|
12
|
+
end
|
13
|
+
|
9
14
|
def self.from_file filename
|
10
15
|
self._from_file filename
|
11
16
|
end
|
12
|
-
|
13
17
|
end
|
14
|
-
|
15
18
|
end
|
16
19
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aurelian-ruby-ahocorasick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aurelian Oancea
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-
|
12
|
+
date: 2008-12-22 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|