aurelian-ruby-ahocorasick 0.4.1 → 0.4.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +29 -10
- data/ext/extconf.rb +2 -0
- data/spec/ahocorasick_spec.rb +11 -0
- metadata +2 -2
data/README.textile
CHANGED
@@ -1,9 +1,8 @@
|
|
1
|
-
|
2
1
|
h1. This is a work in progress.
|
3
2
|
|
4
3
|
h3. Introduction
|
5
4
|
|
6
|
-
This library is a ruby extension, a wrapper around the "Aho-Corasick":http://en.wikipedia.org/wiki/Aho-Corasick_algorithm implementation in C, found in "Strmat":http://www.cs.ucdavis.edu/~gusfield/strmat.html package.
|
5
|
+
This library is a "Ruby":http://ruby-lang.org extension, a wrapper around the "Aho-Corasick":http://en.wikipedia.org/wiki/Aho-Corasick_algorithm implementation in C, found in "Strmat":http://www.cs.ucdavis.edu/~gusfield/strmat.html package.
|
7
6
|
|
8
7
|
The source code (ac.c and ac.h) was "adapted" from Strmat. In fact, I've changed only 3-4 lines of code from the original implementation so it will feat my needs: search needed to return the current position in the searched string.
|
9
8
|
|
@@ -19,21 +18,35 @@ Well, you can do some crazy things with it, like, you can lookup for DNA pattern
|
|
19
18
|
|
20
19
|
h3. Okay, so how can I install it?
|
21
20
|
|
22
|
-
|
21
|
+
h4. Rubygems - Development Version
|
22
|
+
|
23
|
+
<pre>
|
24
|
+
gem install aurelian-ruby-ahocorasick --source=http://gems.github.com
|
25
|
+
</pre>
|
26
|
+
|
27
|
+
h4. Build it from source
|
23
28
|
|
24
29
|
<pre>
|
25
|
-
|
30
|
+
$ git clone git://github.com/aurelian/ruby-ahocorasick.git
|
31
|
+
$ cd ruby-ahocorasick
|
26
32
|
</pre>
|
27
33
|
|
28
|
-
|
34
|
+
To build and install the gem on your machine (run with sudo if needed):
|
29
35
|
|
30
36
|
<pre>
|
31
|
-
|
37
|
+
$ rake install
|
32
38
|
</pre>
|
33
39
|
|
34
|
-
|
40
|
+
@rake -T@ should list other cool tasks, like @rake spec@ to run the rspec test.
|
41
|
+
|
42
|
+
h4. Rubygems - Stable Version
|
35
43
|
|
36
|
-
|
44
|
+
There's no stable version right now.
|
45
|
+
|
46
|
+
h5. Notes
|
47
|
+
|
48
|
+
It's known to work / compile / install on Ubuntu 8.04 and Mac OS 10.4.*. It should work out of the box if you have gcc around.
|
49
|
+
Unfortunately I don't have a Windows PC around nor required knowledge about Microsoft compliers.
|
37
50
|
|
38
51
|
h3. Okay, so how do I use it?
|
39
52
|
|
@@ -53,12 +66,18 @@ h3. Okay, so how do I use it?
|
|
53
66
|
|
54
67
|
</pre>
|
55
68
|
|
69
|
+
You can get some API reference on the "wiki":http://github.com/aurelian/ruby-ahocorasick/wikis.
|
70
|
+
|
71
|
+
h3. Bugs? Suggestions? Ideas? Patches?
|
72
|
+
|
73
|
+
For now, just use the email address.
|
74
|
+
|
56
75
|
h3. Additional Reading
|
57
76
|
|
58
77
|
Other suffix - tree implementations:
|
59
78
|
|
60
79
|
* "Strmat":http://www.cs.ucdavis.edu/~gusfield/strmat.html
|
61
|
-
* Pytst / Ruby-Pytst
|
80
|
+
* "Pytst":http://nicolas.lehuen.com/download/pytst / "Ruby-Pytst":http://rubyforge.org/projects/ruby-pytst/
|
62
81
|
* "Aho-Corasick extension":http://hkn.eecs.berkeley.edu/~dyoo/python/ahocorasick/
|
63
82
|
* "Keyword Prospector":http://latimes.rubyforge.org/keyword_prospector/rdoc/
|
64
83
|
* "libstree":http://www.cl.cam.ac.uk/~cpk25/libstree/
|
@@ -67,4 +86,4 @@ h3. License
|
|
67
86
|
|
68
87
|
(c) 2008 - Aurelian Oancea, < oancea at gmail dot com >
|
69
88
|
|
70
|
-
released under MIT-LICENCE
|
89
|
+
released under MIT-LICENCE
|
data/ext/extconf.rb
CHANGED
data/spec/ahocorasick_spec.rb
CHANGED
@@ -4,6 +4,17 @@ include AhoCorasick
|
|
4
4
|
|
5
5
|
describe KeywordTree do
|
6
6
|
|
7
|
+
describe "bugs" do
|
8
|
+
it "should not crash Ruby :)" do
|
9
|
+
k= KeywordTree.new
|
10
|
+
k.add_string "@usernameguy"
|
11
|
+
k.add_string "@usernameguy-test"
|
12
|
+
k << "@usernameguy-another+test!"
|
13
|
+
query = "@usernameguy @torrez"
|
14
|
+
k.find_all(query).size.should == 1
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
7
18
|
describe "How to create a new KeywordTree" do
|
8
19
|
it "should create a new KeywordTree" do
|
9
20
|
KeywordTree.new.class.should == KeywordTree
|
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.4.
|
4
|
+
version: 0.4.4
|
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-10-27 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|