words-wordnet 0.4.6

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.
@@ -0,0 +1,151 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ require 'words'
3
+
4
+ describe "Words Constructer" do
5
+
6
+ it "should reject bad modes" do
7
+ lambda { Words::Wordnet.new(:rubbish) }.should raise_exception(Words::BadWordnetConnector)
8
+ end
9
+
10
+ it "should when in pure mode, when provided with a bad wordnet directory, return a BadWordnetDataset exception" do
11
+ lambda { Words::Wordnet.new(:pure, '/lib') }.should raise_exception(Words::BadWordnetDataset)
12
+ end
13
+
14
+ it "should when in tokyo mode, when provided with a bad dataset directory, return a BadWordnetDataset exception" do
15
+ lambda { Words::Wordnet.new(:tokyo, :search, '/lib') }.should raise_exception(Words::BadWordnetDataset)
16
+ end
17
+
18
+ end
19
+
20
+ describe "Pure Words Constructor" do
21
+
22
+ # should when in pure mode, , return
23
+
24
+ before do
25
+ @words = Words::Wordnet.new(:pure)
26
+ end
27
+
28
+ after do
29
+ @words.close!
30
+ end
31
+
32
+ it "should accept pure mode" do
33
+ @words.should_not be_nil
34
+ end
35
+
36
+ it "should when given the request for a pure mode return a pure connection" do
37
+ @words.wordnet_connection.should be_kind_of Words::PureWordnetConnection
38
+ end
39
+
40
+ it "should when given the request for a pure mode return an open pure connection" do
41
+ @words.connected?.should be_true
42
+ end
43
+
44
+ it "should when in pure mode, report itself as to in to_s" do
45
+ @words.to_s.should match /Words running in pure mode using wordnet files found at .*/
46
+ end
47
+
48
+ it "should when in pure mode, when the connection is closed, report itself as closed" do
49
+ @words.close!
50
+ @words.connected?.should be_false
51
+ end
52
+
53
+ it "should when in pure mode, when the connection is closed, report itself as closed in to_s" do
54
+ @words.close!
55
+ @words.to_s.should match 'Words not connected'
56
+ end
57
+
58
+ it "should when in pure mode, when the connection is closed and then re-opened, report itself as open" do
59
+ @words.close!
60
+ @words.open!
61
+ @words.connected?.should be_true
62
+ end
63
+
64
+ it "should when in pure mode, when the connection is closed, raise NoWordnetConnection exception if a find is attempted" do
65
+ @words.close!
66
+ lambda { @words.find('test') }.should raise_exception(Words::NoWordnetConnection)
67
+ end
68
+
69
+ it "should when checked report itself as a pure connection" do
70
+ @words.connection_type.should equal :pure
71
+ end
72
+
73
+ it "should when in pure mode, when given a term within wordnet, return a valid response" do
74
+ @words.find("mouse").should_not be_nil
75
+ end
76
+
77
+ it "should when in pure mode, when given a term not in wordnet, return nil" do
78
+ @words.find("lksdhflasdf;lkjdsfkljsdlkfjsadlkf").should be_nil
79
+ end
80
+
81
+ it "should when in pure mode, (assuming evocations are installed on the test environment) return true when asked if evocations are available, return nil" do
82
+ @words.evocations?.should be_true
83
+ end
84
+
85
+ end
86
+
87
+ describe "Tokyo Words Constructor" do
88
+
89
+ before do
90
+ @words = Words::Wordnet.new(:tokyo)
91
+ end
92
+
93
+ after do
94
+ @words.close!
95
+ end
96
+
97
+ it "should accept tokyo mode" do
98
+ @words.should_not be_nil
99
+ end
100
+
101
+ it "should when given the request for a tokyo mode return a tokyo connection" do
102
+ @words.wordnet_connection.should be_kind_of Words::TokyoWordnetConnection
103
+ end
104
+
105
+ it "should when given the request for a tokyo mode return an open tokyo connection" do
106
+ @words.connected?.should be_true
107
+ end
108
+
109
+ it "should when in tokyo mode should report itself as to in to_s" do
110
+ @words.to_s.should match /Words running in tokyo mode with dataset at .*/
111
+ end
112
+
113
+ it "should when in tokyo mode should when the connection is closed report itself as closed" do
114
+ @words.close!
115
+ @words.connected?.should be_false
116
+ end
117
+
118
+ it "should when in tokyo mode should when the connection is closed report itself as closed in to_s" do
119
+ @words.close!
120
+ @words.to_s.should match 'Words not connected'
121
+ end
122
+
123
+ it "should when in tokyo mode, when the connection is closed and then re-opened, report itself as open" do
124
+ @words.close!
125
+ @words.open!
126
+ @words.connected?.should be_true
127
+ end
128
+
129
+ it "should when in tokyo mode, when the connection is closed, raise NoWordnetConnection exception if a find is attempted" do
130
+ @words.close!
131
+ lambda { @words.find('test') }.should raise_exception(Words::NoWordnetConnection)
132
+ end
133
+
134
+ it "should when checked report itself as a tokyo connection" do
135
+ @words.connection_type.should equal :tokyo
136
+ end
137
+
138
+ it "should when in tokyo mode, when given a term within wordnet, return a valid response" do
139
+ @words.find("mouse").should_not be_nil
140
+ end
141
+
142
+ it "should when in tokyo mode, when given a term not in wordnet, return nil" do
143
+ @words.find("lksdhflasdf;lkjdsfkljsdlkfjsadlkf").should be_nil
144
+ end
145
+
146
+ it "should when in tokyo mode, (assuming evocations are installed on the test environment) return true when asked if evocations are available, return nil" do
147
+ @words.evocations?.should be_true
148
+ end
149
+
150
+ end
151
+
@@ -0,0 +1,57 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{words-wordnet}
8
+ s.version = "0.4.6"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Roja Buck"]
12
+ s.date = %q{2012-09-22}
13
+ s.default_executable = %q{build_wordnet}
14
+ s.description = %q{Words, with both pure ruby & tokyo-cabinate backends, implements a fast interface to Wordnet over the same easy-to-use API. The FFI backend makes use of Tokyo Cabinet and the FFI interface, rufus-tokyo, to provide cross ruby distribution compatability and blistering speed. The pure ruby interface operates on a special ruby optimised index along with the basic dictionary files provided by WordNet. I have attempted to provide ease of use in the form of a simple yet powerful api and installation is a sintch!}
15
+ s.email = %q{roja@arbia.co.uk}
16
+ s.executables = ["build_wordnet"]
17
+ s.extra_rdoc_files = [
18
+ "LICENSE",
19
+ "README.markdown"
20
+ ]
21
+ s.files = [
22
+ "LICENSE",
23
+ "README.markdown",
24
+ "Rakefile",
25
+ "VERSION",
26
+ "bin/build_wordnet",
27
+ "examples.rb",
28
+ "lib/evocations.rb",
29
+ "lib/homographs.rb",
30
+ "lib/relation.rb",
31
+ "lib/synset.rb",
32
+ "lib/wordnet_connectors/pure_wordnet_connection.rb",
33
+ "lib/wordnet_connectors/tokyo_wordnet_connection.rb",
34
+ "lib/words.rb",
35
+ "spec/words_spec.rb",
36
+ "words.gemspec"
37
+ ]
38
+ s.homepage = %q{http://github.com/roja/words}
39
+ s.require_paths = ["lib"]
40
+ s.rubyforge_project = %q{words}
41
+ s.rubygems_version = %q{1.3.6}
42
+ s.summary = %q{A Fast & Easy to use interface to WordNet with cross ruby distribution compatibility.}
43
+
44
+ if s.respond_to? :specification_version then
45
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
46
+ s.specification_version = 3
47
+
48
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
49
+ s.add_development_dependency(%q<rspec>, [">= 2.11.0"])
50
+ else
51
+ s.add_dependency(%q<rspec>, [">= 2.11.0"])
52
+ end
53
+ else
54
+ s.add_dependency(%q<rspec>, [">= 2.11.0"])
55
+ end
56
+ end
57
+
metadata ADDED
@@ -0,0 +1,95 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: words-wordnet
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 6
10
+ version: 0.4.6
11
+ platform: ruby
12
+ authors:
13
+ - Roja Buck
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-09-22 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 35
29
+ segments:
30
+ - 2
31
+ - 11
32
+ - 0
33
+ version: 2.11.0
34
+ type: :development
35
+ version_requirements: *id001
36
+ description: Words, with both pure ruby & tokyo-cabinate backends, implements a fast interface to Wordnet over the same easy-to-use API. The FFI backend makes use of Tokyo Cabinet and the FFI interface, rufus-tokyo, to provide cross ruby distribution compatability and blistering speed. The pure ruby interface operates on a special ruby optimised index along with the basic dictionary files provided by WordNet. I have attempted to provide ease of use in the form of a simple yet powerful api and installation is a sintch!
37
+ email: roja@arbia.co.uk
38
+ executables:
39
+ - build_wordnet
40
+ extensions: []
41
+
42
+ extra_rdoc_files:
43
+ - LICENSE
44
+ - README.markdown
45
+ files:
46
+ - LICENSE
47
+ - README.markdown
48
+ - Rakefile
49
+ - VERSION
50
+ - bin/build_wordnet
51
+ - examples.rb
52
+ - lib/evocations.rb
53
+ - lib/homographs.rb
54
+ - lib/relation.rb
55
+ - lib/synset.rb
56
+ - lib/wordnet_connectors/pure_wordnet_connection.rb
57
+ - lib/wordnet_connectors/tokyo_wordnet_connection.rb
58
+ - lib/words.rb
59
+ - spec/words_spec.rb
60
+ - words.gemspec
61
+ homepage: http://github.com/roja/words
62
+ licenses: []
63
+
64
+ post_install_message:
65
+ rdoc_options: []
66
+
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ none: false
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
78
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ hash: 3
84
+ segments:
85
+ - 0
86
+ version: "0"
87
+ requirements: []
88
+
89
+ rubyforge_project: words
90
+ rubygems_version: 1.8.24
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: A Fast & Easy to use interface to WordNet with cross ruby distribution compatibility.
94
+ test_files: []
95
+