vss 0.1.0 → 0.1.1
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.
- data/Manifest +2 -1
- data/README.md +3 -1
- data/Rakefile +2 -2
- data/lib/vss/tokenizer.rb +1 -0
- data/test/search_test.rb +34 -0
- data/vss.gemspec +7 -3
- metadata +16 -5
data/Manifest
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# VSS - Vector Space Search
|
2
2
|
|
3
|
-
A simple vector space search engine with **tf*idf** ranking.
|
3
|
+
A simple vector space search engine with **tf*idf** ranking.
|
4
|
+
|
5
|
+
[More info, and details of how it works.](http://madeofcode.com/posts/69-vss-a-vector-space-search-engine-in-ruby)
|
4
6
|
|
5
7
|
## Install
|
6
8
|
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require "echoe"
|
2
2
|
|
3
|
-
Echoe.new("vss", "0.1.
|
3
|
+
Echoe.new("vss", "0.1.1") do |p|
|
4
4
|
p.description = "Simple vector space search engine"
|
5
5
|
p.url = "http://github.com/mkdynamic/vss"
|
6
6
|
p.author = "Mark Dodwell"
|
7
7
|
p.email = "labs@mkdynamic.co.uk"
|
8
|
-
p.runtime_dependencies = ["stemmer >= 1.0.1"]
|
8
|
+
p.runtime_dependencies = ["stemmer >= 1.0.1", "active_support"]
|
9
9
|
end
|
data/lib/vss/tokenizer.rb
CHANGED
data/test/search_test.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'vss'
|
3
|
+
|
4
|
+
class SearchTest < Test::Unit::TestCase
|
5
|
+
def setup
|
6
|
+
@doc1 = "I'm not even going to mention any TV series."
|
7
|
+
@doc2 = "The Wire is the best thing ever. Fact."
|
8
|
+
@doc3 = "Some would argue that Lost got a bit too wierd after season 2."
|
9
|
+
@doc4 = "Lost is surely not in the same league as The Wire."
|
10
|
+
@docs = [@doc1, @doc2, @doc3, @doc4]
|
11
|
+
@engine = VSS::Engine.new(@docs)
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_result_count
|
15
|
+
results = @engine.search("How can you compare The Wire with Lost?")
|
16
|
+
assert_equal 4, results.size
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_ordering
|
20
|
+
results = @engine.search("How can you compare The Wire with Lost?")
|
21
|
+
assert_equal @doc4, results[0]
|
22
|
+
assert_equal @doc2, results[1]
|
23
|
+
assert_equal @doc3, results[2]
|
24
|
+
assert_equal @doc1, results[3]
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_ranking
|
28
|
+
results = @engine.search("How can you compare The Wire with Lost?")
|
29
|
+
assert_equal 68.2574185835055, results[0].rank
|
30
|
+
assert_equal 58.5749292571254, results[1].rank
|
31
|
+
assert_equal 55.5215763037423, results[2].rank
|
32
|
+
assert_equal 50.0, results[3].rank
|
33
|
+
end
|
34
|
+
end
|
data/vss.gemspec
CHANGED
@@ -2,21 +2,22 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{vss}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Mark Dodwell"]
|
9
|
-
s.date = %q{2010-03-
|
9
|
+
s.date = %q{2010-03-11}
|
10
10
|
s.description = %q{Simple vector space search engine}
|
11
11
|
s.email = %q{labs@mkdynamic.co.uk}
|
12
12
|
s.extra_rdoc_files = ["LICENSE", "README.md", "lib/vss.rb", "lib/vss/engine.rb", "lib/vss/tokenizer.rb"]
|
13
|
-
s.files = ["LICENSE", "
|
13
|
+
s.files = ["LICENSE", "README.md", "Rakefile", "lib/vss.rb", "lib/vss/engine.rb", "lib/vss/tokenizer.rb", "test/search_test.rb", "Manifest", "vss.gemspec"]
|
14
14
|
s.homepage = %q{http://github.com/mkdynamic/vss}
|
15
15
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Vss", "--main", "README.md"]
|
16
16
|
s.require_paths = ["lib"]
|
17
17
|
s.rubyforge_project = %q{vss}
|
18
18
|
s.rubygems_version = %q{1.3.5}
|
19
19
|
s.summary = %q{Simple vector space search engine}
|
20
|
+
s.test_files = ["test/search_test.rb"]
|
20
21
|
|
21
22
|
if s.respond_to? :specification_version then
|
22
23
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
@@ -24,10 +25,13 @@ Gem::Specification.new do |s|
|
|
24
25
|
|
25
26
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
26
27
|
s.add_runtime_dependency(%q<stemmer>, [">= 0", "= 1.0.1"])
|
28
|
+
s.add_runtime_dependency(%q<active_support>, [">= 0"])
|
27
29
|
else
|
28
30
|
s.add_dependency(%q<stemmer>, [">= 0", "= 1.0.1"])
|
31
|
+
s.add_dependency(%q<active_support>, [">= 0"])
|
29
32
|
end
|
30
33
|
else
|
31
34
|
s.add_dependency(%q<stemmer>, [">= 0", "= 1.0.1"])
|
35
|
+
s.add_dependency(%q<active_support>, [">= 0"])
|
32
36
|
end
|
33
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Dodwell
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-03-
|
12
|
+
date: 2010-03-11 00:00:00 +00:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -25,6 +25,16 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.0.1
|
27
27
|
version:
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: active_support
|
30
|
+
type: :runtime
|
31
|
+
version_requirement:
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: "0"
|
37
|
+
version:
|
28
38
|
description: Simple vector space search engine
|
29
39
|
email: labs@mkdynamic.co.uk
|
30
40
|
executables: []
|
@@ -39,12 +49,13 @@ extra_rdoc_files:
|
|
39
49
|
- lib/vss/tokenizer.rb
|
40
50
|
files:
|
41
51
|
- LICENSE
|
42
|
-
- Manifest
|
43
52
|
- README.md
|
44
53
|
- Rakefile
|
45
54
|
- lib/vss.rb
|
46
55
|
- lib/vss/engine.rb
|
47
56
|
- lib/vss/tokenizer.rb
|
57
|
+
- test/search_test.rb
|
58
|
+
- Manifest
|
48
59
|
- vss.gemspec
|
49
60
|
has_rdoc: true
|
50
61
|
homepage: http://github.com/mkdynamic/vss
|
@@ -79,5 +90,5 @@ rubygems_version: 1.3.5
|
|
79
90
|
signing_key:
|
80
91
|
specification_version: 3
|
81
92
|
summary: Simple vector space search engine
|
82
|
-
test_files:
|
83
|
-
|
93
|
+
test_files:
|
94
|
+
- test/search_test.rb
|