words 0.3.0 → 0.3.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/README.markdown +10 -1
- data/Rakefile +0 -1
- data/VERSION +1 -1
- data/bin/build_wordnet +2 -1
- data/lib/words.rb +4 -1
- data/words.gemspec +2 -5
- metadata +2 -12
data/README.markdown
CHANGED
@@ -4,6 +4,9 @@
|
|
4
4
|
|
5
5
|
Words implements a fast interface to [Wordnet®](http://wordnet.princeton.edu) which provides both a pure ruby and an FFI powered backend over the same easy-to-use API. The FFI backend makes use of [Tokyo Cabinet](http://1978th.net/tokyocabinet/) and the FFI interface, [rufus-tokyo](http://github.com/jmettraux/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!
|
6
6
|
|
7
|
+
* Version 0.2 Introduced Pure Ruby Backend
|
8
|
+
* Version 0.3 Introduced Evocation Support (see examples & below) as developed by the [Wordnet® Evocation Project](http://wordnet.cs.princeton.edu/downloads/evocation/release-0.4/README.TXT)
|
9
|
+
|
7
10
|
## Pre-Installation ##
|
8
11
|
|
9
12
|
First ensure you have a copy of the wordnet data files. This is generally available from your Linux/OSX package manager:
|
@@ -55,13 +58,16 @@ Then your ready to rock and roll. :)
|
|
55
58
|
|
56
59
|
To build the wordnet dataset (or index for pure) file yourself, from the original wordnet files, you can use the bundled "build_wordnet" command
|
57
60
|
|
58
|
-
build_wordnet -h # this will give you the usage information
|
61
|
+
build_wordnet -h # this will give you the usage information & additional options/features
|
59
62
|
|
60
63
|
# this would attempt to build the tokyo backend data locating the original wordnet files through a search...
|
61
64
|
sudo build_wordnet -v --build-tokyo
|
62
65
|
|
63
66
|
# this would attempt to build the pure backend index locating the original wordnet files through a search...
|
64
67
|
sudo build_wordnet -v --build-pure
|
68
|
+
|
69
|
+
# this would attempt to build the tokyo backend index as above but also builds the evocations information into the dataset
|
70
|
+
sudo build_wordnet -v --build-pure --build-evocations
|
65
71
|
|
66
72
|
## Usage ##
|
67
73
|
|
@@ -107,6 +113,9 @@ Heres a few little examples of using words within your programs.
|
|
107
113
|
sense.derivationally_related_forms.first.destination_word # => "bat"
|
108
114
|
sense.derivationally_related_forms.first.destination # => the synset of v01413191
|
109
115
|
|
116
|
+
data.find("broadcast").senses.first.evocations # => sense relevant evocations
|
117
|
+
data.find("broadcast").senses.first.evocations[1] # => the evocation at index 1
|
118
|
+
|
110
119
|
These and more examples are available from within the examples.rb file!
|
111
120
|
|
112
121
|
## Note on Patches/Pull Requests ##
|
data/Rakefile
CHANGED
@@ -11,7 +11,6 @@ begin
|
|
11
11
|
gem.homepage = "http://github.com/roja/words"
|
12
12
|
gem.authors = ["Roja Buck"]
|
13
13
|
gem.add_dependency "trollop", ">= 1.15"
|
14
|
-
gem.add_dependency 'rufus-tokyo', '>= 1.0.5'
|
15
14
|
gem.executables = [ "build_wordnet" ]
|
16
15
|
gem.default_executable = "build_wordnet"
|
17
16
|
gem.rubyforge_project = 'words'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.1
|
data/bin/build_wordnet
CHANGED
@@ -6,7 +6,6 @@ require 'pathname'
|
|
6
6
|
# gem includes
|
7
7
|
require 'rubygems'
|
8
8
|
require 'trollop'
|
9
|
-
require 'rufus-tokyo'
|
10
9
|
require 'zlib'
|
11
10
|
require 'net/http'
|
12
11
|
|
@@ -33,6 +32,8 @@ end
|
|
33
32
|
Trollop::die :build_tokyo, "You need to specify whether tokyo dataset or pure ruby index building is required" if !opts[:build_tokyo] && !opts[:build_pure]
|
34
33
|
puts "Verbose mode enabled" if (VERBOSE = opts[:verbose])
|
35
34
|
|
35
|
+
require 'rufus-tokyo' if opts[:build_tokyo]
|
36
|
+
|
36
37
|
gem_path = Pathname.new "#{File.dirname(__FILE__)}/.."
|
37
38
|
abort "Ensure you run the command using sudo or as a Superuser / Administrator" unless gem_path.writable?
|
38
39
|
data_path = gem_path + "data/"
|
data/lib/words.rb
CHANGED
@@ -4,7 +4,7 @@ require 'set'
|
|
4
4
|
|
5
5
|
# gem includes
|
6
6
|
require 'rubygems'
|
7
|
-
require 'rufus-tokyo'
|
7
|
+
require 'rufus-tokyo' if Gem.available?('rufus-tokyo')
|
8
8
|
|
9
9
|
module Words
|
10
10
|
|
@@ -21,6 +21,7 @@ module Words
|
|
21
21
|
|
22
22
|
if @data_path.exist?
|
23
23
|
if @connection_type == :tokyo
|
24
|
+
raise "Coulden't find the rufus-tokyo gem. Please ensure it's installed." unless Gem.available?('rufus-tokyo')
|
24
25
|
@connection = Rufus::Tokyo::Table.new(@data_path.to_s, :mode => 'r')
|
25
26
|
@connected = true
|
26
27
|
elsif @connection_type == :pure
|
@@ -384,6 +385,8 @@ module Words
|
|
384
385
|
@to_s
|
385
386
|
end
|
386
387
|
|
388
|
+
alias word lemma
|
389
|
+
|
387
390
|
end
|
388
391
|
|
389
392
|
class Homographs
|
data/words.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{words}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Roja Buck"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-18}
|
13
13
|
s.default_executable = %q{build_wordnet}
|
14
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
15
|
s.email = %q{roja@arbia.co.uk}
|
@@ -48,14 +48,11 @@ Gem::Specification.new do |s|
|
|
48
48
|
|
49
49
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
50
|
s.add_runtime_dependency(%q<trollop>, [">= 1.15"])
|
51
|
-
s.add_runtime_dependency(%q<rufus-tokyo>, [">= 1.0.5"])
|
52
51
|
else
|
53
52
|
s.add_dependency(%q<trollop>, [">= 1.15"])
|
54
|
-
s.add_dependency(%q<rufus-tokyo>, [">= 1.0.5"])
|
55
53
|
end
|
56
54
|
else
|
57
55
|
s.add_dependency(%q<trollop>, [">= 1.15"])
|
58
|
-
s.add_dependency(%q<rufus-tokyo>, [">= 1.0.5"])
|
59
56
|
end
|
60
57
|
end
|
61
58
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: words
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roja Buck
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-18 00:00:00 +00:00
|
13
13
|
default_executable: build_wordnet
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -22,16 +22,6 @@ dependencies:
|
|
22
22
|
- !ruby/object:Gem::Version
|
23
23
|
version: "1.15"
|
24
24
|
version:
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: rufus-tokyo
|
27
|
-
type: :runtime
|
28
|
-
version_requirement:
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.5
|
34
|
-
version:
|
35
25
|
description: "Words, with both pure ruby & tokyo-cabinate backends, implements a fast interface to Wordnet\xC2\xAE 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\xC2\xAE. I have attempted to provide ease of use in the form of a simple yet powerful api and installation is a sintch!"
|
36
26
|
email: roja@arbia.co.uk
|
37
27
|
executables:
|