M .hgignore +2 -2
@@ 12,8 12,8 @@ pkg/
^wordnet-defaultdb/LICENSE-.*\.txt$
^wordnet-defaultdb/.*\.zip$
^ChangeLog$
-^doc/
+^docs/
\.(pdf|svg)$
coverage/
spec/.state
-
+\.lock$
M .pryrc +16 -10
@@ 18,19 18,25 @@ begin
$stderr.puts "Loading WordNet..."
require 'loggability'
require 'wordnet'
-
- Loggability.level = :debug if $DEBUG
-
- if Gem::Specification.find_all_by_name( 'pg' ).any?
- puts "Instantiating the lexicon against the PostgreSQL (wordnet31) DB as $lex"
- $lex = WordNet::Lexicon.new( 'postgres:/wordnet31' )
- else
- puts "Instantiating the lexicon against the default DB as $lex"
- $lex = WordNet::Lexicon.new
- end
rescue Exception => e
$stderr.puts "Ack! WordNet failed to load: #{e.message}\n\t" +
e.backtrace.join( "\n\t" )
end
+Loggability.level = :debug if $DEBUG
+if Gem::Specification.find_all_by_name( 'pg' ).any?
+ begin
+ puts "Instantiating the lexicon against the PostgreSQL (wordnet31) DB as $lex"
+ $lex = WordNet::Lexicon.new( 'postgres:/wordnet31' )
+ rescue => err
+ puts "That didn't work."
+ end
+end
+
+unless $lex
+ puts "Instantiating the lexicon against the default DB as $lex"
+ $lex = WordNet::Lexicon.new
+end
+
+
M .ruby-version +1 -1
R Gemfile => +0 -2
@@ 1,2 0,0 @@
-source "https://rubygems.org"
-gemspec
M Manifest.txt +0 -15
@@ 1,20 1,6 @@
-.gems
-.ruby-gemset
-.ruby-version
-.simplecov
-ChangeLog
-Gemfile
History.rdoc
-LICENSE
-Manifest.txt
README.md
-README.rdoc
-Rakefile
-TODO
WordNet30-license.txt
-certs/ged.pem
-examples/gcs.rb
-examples/hypernym_tree.rb
lib/wordnet.rb
lib/wordnet/constants.rb
lib/wordnet/lexicallink.rb
@@ 34,4 20,3 @@ spec/wordnet/sense_spec.rb
spec/wordnet/synset_spec.rb
spec/wordnet/word_spec.rb
spec/wordnet_spec.rb
-wordnet.gemspec
M README.md +140 -1
@@ 1,1 1,140 @@
-The README is in RDoc format, which Bitbucket/Github doesn't support; [see the source](https://bitbucket.org/ged/ruby-wordnet/src/3db62d5ed69878e8e7c36795d3379291db0402d6/README.rdoc?at=default).
No newline at end of file
+# Ruby-WordNet
+
+home
+: https://hg.sr.ht/~ged/ruby-wordnet
+
+code
+: https://hg.sr.ht/~ged/ruby-wordnet/browse
+
+docs
+: http://deveiate.org/code/wordnet
+
+github
+: https://github.com/ged/ruby-wordnet
+
+
+## Description
+
+This library is a Ruby interface to WordNet®[https://wordnet.princeton.edu/].
+WordNet® is an online lexical reference system whose design is inspired by
+current psycholinguistic theories of human lexical memory. English nouns,
+verbs, adjectives and adverbs are organized into synonym sets, each
+representing one underlying lexical concept. Different relations link the
+synonym sets.
+
+This library uses SqlUNET[http://sqlunet.sourceforge.net/], which is a
+conversion of the WordNet (along with a number of other linguistic databases)
+lexicon flatfiles into a relational database format. You can either install the
+[wordnet-defaultdb](https://rubygems.org/gems/wordnet-defaultdb) gem, which
+packages up the SQLite3 version of SqlUNet, or install your own and point the
+lexicon at it by passing [Sequel connection
+parameters](http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html)
+to the constructor.
+
+## Usage
+
+There are three major parts to this library:
+
+WordNet::Lexicon
+: the interface to the dictionary, used to connect to the
+database and look up Words and Synsets.
+
+WordNet::Word
+: the English word entries in the Lexicon that are mapped
+to Synsets via one or more Senses.
+
+WordNet::Synset
+: the main artifact of WordNet: a "synonym set". These
+: are connected to one or more Words through a Sense,
+and are connected to each other via SemanticLinks.
+
+The other object classes exist mostly as a way of representing relationships
+between the main three:
+
+WordNet::Sense
+: represents a link between one or more Words and
+one or more Synsets for one meaning of the word.
+
+WordNet::SemanticLink
+: represents a link between Synsets
+
+WordNet::LexicalLink
+: represents a link between Words in Synsets
+
+WordNet::Morph
+: an interface to a lookup table of irregular word
+forms mapped to their base form (lemma)
+
+
+The last class (WordNet::Model) is the abstract superclass for all the others,
+and inherits most of its functionality from Sequel::Model, the ORM layer
+of the Sequel toolkit. It's mostly just a container for the database
+connection, with some convenience methods to allow the database connection
+to be deferred until runtime instead of when the library loads.
+
+The library also comes with the beginnings of support for the SUMO-WordNet
+mapping:
+
+WordNet::SumoTerm
+: [Suggested Upper Merged Ontology](http://www.ontologyportal.org/) terms,
+with associations back to related Synsets.
+
+As mentioned above, SqlUNet has done an amazing job of linking up a number of
+other useful linguistic lexicons via WordNet synsets. I plan on adding support
+for at minimum VerbNet, FrameNet, and PropBank.
+
+
+## Requirements
+
+* Ruby >= 3.0
+* Sequel >= 5.0
+
+
+## Contributing
+
+You can check out the current development source with Mercurial via its
+[project page](https://hg.sr.ht/~ged/ruby-wordnet). Or if you prefer
+Git, via [its Github mirror](https://github.com/ged/ruby-wordnet).
+
+After checking out the source, run:
+
+ $ gem install -Ng
+ $ rake setup
+
+This will do any necessary development environment set up.
+
+
+## Authors
+
+* Michael Granger <ged@FaerieMUD.org>
+
+
+## License
+
+Copyright (c) 2002-2023, Michael Granger
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+* Neither the name of the author/s, nor the names of the project's
+ contributors may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
M Rakefile +8 -91
@@ 1,42 1,13 @@
-#!/usr/bin/env rake
-
-require 'pathname'
+# -*- ruby -*-
-begin
- require 'hoe'
-rescue LoadError => err
- $stderr.puts "Couldn't load hoe: %p: %s" % [ err.class, err.message ] if
- Rake.application.options.trace
- abort "This Rakefile requires hoe (gem install hoe)"
-end
+require 'rake/deveiate'
-GEMSPEC = 'wordnet.gemspec'
-
-Hoe.plugin :mercurial
-Hoe.plugin :signing
-
-Hoe.plugins.delete :rubyforge
-BASEDIR = Pathname( __FILE__ ).dirname
-LIBDIR = BASEDIR + 'lib'
-DATADIR = BASEDIR + 'data'
-
-hoespec = Hoe.spec( 'wordnet' ) do
- self.readme_file = 'README.rdoc'
- self.history_file = 'History.rdoc'
- self.extra_rdoc_files = FileList[ '*.rdoc' ]
- self.license 'BSD-3-Clause'
-
- self.developer 'Michael Granger', 'ged@FaerieMUD.org'
-
- self.dependency 'sequel', '~> 5.0'
- self.dependency 'loggability', '~> 0.11'
-
- self.dependency 'sqlite3', '~> 1.3', :developer
- self.dependency 'rspec', '~> 3.5', :developer
- self.dependency 'simplecov', '~> 0.12', :developer
-
- self.spec_extras[:post_install_message] = %{
+Rake::DevEiate.setup( 'wordnet' ) do |project|
+ project.publish_to = 'deveiate:/usr/local/www/public/code'
+ project.required_ruby_version = '~> 3.0'
+ project.rdoc_generator = :sixfish
+ project.post_install_message = <<~END_MESSAGE
If you don't already have a WordNet database installed somewhere,
you'll need to either download and install one from:
@@ 44,59 15,5 @@ hoespec = Hoe.spec( 'wordnet' ) do
or just install the 'wordnet-defaultdb' gem, which will install
the SQLite version for you.
-
- }.gsub( /^\t/, '' )
-
- self.require_ruby_version( '>=2.2.0' )
-
- self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags )
- self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
-
- self.rdoc_locations << "deveiate:/usr/local/www/public/code/ruby-#{remote_rdoc_dir}"
-end
-
-ENV['VERSION'] ||= hoespec.spec.version.to_s
-
-# Run the tests before checking in
-task 'hg:precheckin' => [ :check_history, :check_manifest, :gemspec, :spec ]
-
-# Rebuild the ChangeLog immediately before release
-task :prerelease => 'ChangeLog'
-CLOBBER.include( 'ChangeLog' )
-
-desc "Build a coverage report"
-task :coverage do
- ENV["COVERAGE"] = 'yes'
- Rake::Task[:spec].invoke
+ END_MESSAGE
end
-
-
-# Use the fivefish formatter for docs generated from development checkout
-if File.directory?( '.hg' )
- require 'rdoc/task'
-
- Rake::Task[ 'docs' ].clear
- RDoc::Task.new( 'docs' ) do |rdoc|
- rdoc.main = "README.rdoc"
- rdoc.rdoc_files.include( "*.rdoc", "*.md", "ChangeLog", "lib/**/*.rb" )
- rdoc.generator = :fivefish
- rdoc.title = 'Ruby WordNet'
- rdoc.rdoc_dir = 'doc'
- end
-end
-
-task :gemspec => [ 'ChangeLog', GEMSPEC ]
-file GEMSPEC => __FILE__ do |task|
- spec = $hoespec.spec
- spec.files.delete( '.gemtest' )
- spec.signing_key = nil
- spec.version = "#{spec.version.bump}.0.pre#{Time.now.strftime("%Y%m%d%H%M%S")}"
- spec.cert_chain = [ 'certs/ged.pem' ]
- File.open( task.name, 'w' ) do |fh|
- fh.write( spec.to_ruby )
- end
-end
-CLOBBER.include( GEMSPEC )
-
-task :default => :gemspec
-
M certs/ged.pem +22 -24
@@ 1,26 1,24 @@
-----BEGIN CERTIFICATE-----
-MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
-GTAXBgoJkiaJk/IsZAEZ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4aar2okb/RA6VS87o+d7g6LpDDMMQjH4G9OPnJENLdhu8KnPw/ivSVvQw7
+N2I4L/ZOIe2DIVuYH7aLHfjZDQv/mNgpAgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYD
+VR0PBAQDAgSwMB0GA1UdDgQWBBRyjf55EbrHagiRLqt5YAd3yb8k4DANBgkqhkiG
+9w0BAQsFAAOCAYEARYCeUVBWARNKqF0cvNnLJvFf4hdW2+Rtc7NfC5jQvX9a1oom
+sfVvS96eER/9cbrphu+vc59EELw4zT+RY3/IesnoE7CaX6zIOFmSmG7K61OHsSLR
+KqMygcWwyuPXT2JG7JsGHuxbzgaRWe29HbSjBbLYxiMH8Zxh4tKutxzKF7jb0Ggq
+KAf9MH5LwG8IHVIfV5drT14PvgR3tcvmrn1timPyJl+eZ3LNnm9ofOCweuZCq1cy
+4Q8LV3vP2Cofy9q+az3DHdaUGlmMiZZZqKixDr1KSS9nvh0ZrKMOUL1sWj/IaxrQ
+RV3y6td14q49t+xnbj00hPlbW7uE2nLJLt2NAoXiE1Nonndz1seB2c6HL79W9fps
+E/O12pQjCp/aPUZMt8/8tKW31RIy/KP8XO6OTJNWA8A/oNEI0g5p/LmmEtJKWYr1
+WmEdESlpWhzFECctefIF2lsN9vaOuof57RM77t2otrtcscDtNarIqjZsIyqtDvtL
+DttITiit0Vwz7bY0
-----END CERTIFICATE-----
M examples/gcs.rb +0 -1
@@ 1,5 1,4 @@
#!/usr/bin/env ruby
-#encoding: utf-8
#
# Find least general hypernymial synsets between all noun senses of two words.
M examples/hypernym_tree.rb +0 -1
@@ 1,5 1,4 @@
#!/usr/bin/env ruby
-#encoding: utf-8
#
# Find all the hypernyms of all senses of a given noun and display them in a
M experiments/unhandled_pointer_types.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
#
# Trying to find a minimal testcase for reproducing the error that happens with
# the new '~i' and '@i' synset pointer types.
A => gem.deps.rb +11 -0
@@ 0,0 1,11 @@
+source 'https://rubygems.org/'
+
+gem 'loggability', '~> 0.18'
+gem 'pg', '~> 1.4'
+gem 'sequel', '~> 5.64'
+gem 'sqlite3', '~> 1.5'
+
+group :development do
+ gem 'rake-deveiate', '~> 0.22'
+ gem 'rdoc-generator-sixfish', '~> 0.3'
+end
M lib/wordnet.rb +0 -1
@@ 1,5 1,4 @@
#!/usr/bin/env ruby
-#encoding: utf-8
require 'loggability'
require 'sequel'
M lib/wordnet/constants.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
M lib/wordnet/lexicallink.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/synset' unless defined?( WordNet::Synset )
M lib/wordnet/lexicon.rb +7 -6
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'pathname'
require 'loggability'
@@ 224,11 223,13 @@ class WordNet::Lexicon
### #lookup_synsets instead.
###
### The +word+ can be one of:
- ### [Integer]
+ ###
+ ### [+Integer+]
### Looks up the corresponding Word or Synset by ID. This assumes that all Synset IDs are
### all 9 digits or greater, which is true as of WordNet 3.1. Any additional +args+ are
### ignored.
- ### [Symbol, String]
+ ###
+ ### [+Symbol+, +String+]
### Look up a Word by its gloss using #lookup_synsets, passing any additional +args+,
### and return the first one that is found.
def []( word, *args )
@@ 250,13 251,13 @@ class WordNet::Lexicon
###
### The *args* can contain:
###
- ### [Integer, Range]
+ ### [+Integer+, +Range+]
### The sense/s of the Word (1-indexed) to use when searching for Synsets. If not specified,
### all senses of the +word+ are used.
- ### [Regexp]
+ ### [+Regexp+]
### The Word's Synsets are filtered by definition using an RLIKE filter. Note that not all
### databases (including the default one, sqlite3) support RLIKE.
- ### [Symbol, String]
+ ### [+Symbol+, +String+]
### If it matches one of either a lexical domain (e.g., "verb.motion") or a part of
### speech (e.g., "adjective", :noun, :v), the resulting Synsets are filtered by that
### criteria.
M lib/wordnet/model.rb +0 -2
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'loggability'
require 'sequel'
@@ 37,7 36,6 @@ module WordNet
### Reset the database connection that all model objects will use.
- ### @param [Sequel::Database] newdb the new database object.
def self::db=( newdb )
Loggability.with_level( :fatal ) do
super
M lib/wordnet/morph.rb +12 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/model'
@@ 22,6 21,15 @@ class WordNet::Morph < WordNet::Model( :
set_primary_key :morphid
+
+ ##
+ # :method: morphid
+ # The Integer ID of the morph
+
+ ##
+ # :method: morph
+ # The text of the morph
+
# Table "public.morphmaps"
# Column | Type | Modifiers
# ---------+--------------+-------------------------------
@@ 35,6 43,9 @@ class WordNet::Morph < WordNet::Model( :
# Foreign-key constraints:
# "fk_morphmaps_morphid" FOREIGN KEY (morphid) REFERENCES morphs(morphid)
# "fk_morphmaps_wordid" FOREIGN KEY (wordid) REFERENCES words(wordid)
+
+ ##
+ # The WordNet::Word entries associated with this Morph
many_to_many :words,
join_table: :morphmaps,
right_key: :wordid,
M lib/wordnet/semanticlink.rb +8 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/constants'
@@ 12,11 11,19 @@ class WordNet::SemanticLink < WordNet::M
set_primary_key [:synset1id, :synset2id, :linkid]
+ ##
+ # :method: linkid
+ # The ID of this semlink
+
+ ##
+ # The "origin" WordNet::Synset associated with this SemanticLink
many_to_one :origin,
class: 'WordNet::Synset',
key: :synset1id,
primary_key: :synsetid
+ ##
+ # The "target" WordNet::Synset associated with this SemanticLink
one_to_one :target,
class: 'WordNet::Synset',
key: :synsetid,
M lib/wordnet/sense.rb +44 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/model'
@@ 10,6 9,50 @@ class WordNet::Sense < WordNet::Model( :
set_primary_key :senseid
+ # Table "wn.senses"
+ # Column | Type | Collation | Nullable | Default
+ # -------------+------------------------+-----------+----------+-------------
+ # wordid | bigint | | not null | '0'::bigint
+ # casedwordid | bigint | | |
+ # synsetid | bigint | | not null | '0'::bigint
+ # senseid | bigint | | |
+ # sensenum | bigint | | not null | '0'::bigint
+ # lexid | bigint | | not null | '0'::bigint
+ # tagcount | bigint | | |
+ # sensekey | character varying(100) | | |
+ # Indexes:
+ # "idx_192341_primary" PRIMARY KEY, btree (wordid, synsetid)
+ # "k_senses_lexid" btree (lexid)
+ # "k_senses_synsetid" btree (synsetid)
+ # "k_senses_wordid" btree (wordid)
+ # "unq_senses_senseid" UNIQUE, btree (senseid)
+ # "unq_senses_sensekey" UNIQUE, btree (sensekey)
+ # Foreign-key constraints:
+ # "senses_synsetid_fkey" FOREIGN KEY (synsetid) REFERENCES synsets(synsetid)
+ # "senses_wordid_fkey" FOREIGN KEY (wordid) REFERENCES words(wordid)
+ #
+
+ ##
+ # :method: wordid
+ # The integer ID of the WordNet::Word this Sense is linked to
+
+ ##
+ # :method: synsetid
+ # The integer ID Of the WordNet::Synset this Sense is linked to.
+
+ ##
+ # :method: senseid
+ # The unique integer ID of the Sense.
+
+ ##
+ # :method: sensenum
+ # The index of this Sense in relation to its Synset
+
+ ##
+ # :method: sensekey
+ # The raw sense key as it appeared in the sources
+
+
##
# The Synset this is a Sense for
many_to_one :synset, key: :synsetid
M lib/wordnet/sumoterm.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/model'
M lib/wordnet/synset.rb +1 -2
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/constants'
@@ 353,7 352,7 @@ class WordNet::Synset < WordNet::Model(
### Return the table of part-of-speech types, keyed by letter identifier.
def self::postype_table
@postype_table ||= self.db[:postypes].inject({}) do |hash, row|
- hash[ row[:pos].untaint.to_sym ] = row[:posname]
+ hash[ row[:pos].to_sym ] = row[:posname]
hash
end
end
M lib/wordnet/word.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet' unless defined?( WordNet )
require 'wordnet/model'
M spec/helpers.rb +17 -5
@@ 1,9 1,14 @@
# -*- ruby -*-
-#encoding: utf-8
-# coding: utf-8
# SimpleCov test coverage reporting; enable this using the :coverage rake task
-require 'simplecov' if ENV['COVERAGE']
+if ENV['COVERAGE']
+ require 'simplecov'
+ SimpleCov.start do
+ add_filter 'spec/'
+ enable_coverage :branch
+ end
+end
+
$LOAD_PATH.unshift( 'wordnet-defaultdb/lib' )
@@ 29,8 34,15 @@ RSpec.configure do |config|
config.example_status_persistence_file_path = "spec/.state"
if Gem::Specification.find_all_by_name( 'pg' ).any?
- $dburi = 'postgres:/sqlunet50'
- else
+ begin
+ dburi = 'postgres:/sqlunet50'
+ Sequel.connect( dburi )
+ $dburi = dburi
+ rescue
+ end
+ end
+
+ if ! $dburi
config.filter_run_excluding( :requires_pg )
unless (( $dburi = WordNet::Lexicon.default_db_uri ))
config.filter_run_excluding( :requires_database )
A => wordnet-defaultdb/certs +1 -0
@@ 0,0 1,1 @@
+../certs
No newline at end of file
M wordnet-defaultdb/lib/wordnet-defaultdb.rb +0 -1
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet/defaultdb'
M wordnet-defaultdb/lib/wordnet/defaultdb.rb +0 -4
@@ 1,5 1,4 @@
# -*- ruby -*-
-#encoding: utf-8
require 'wordnet'
require 'pathname'
@@ 15,9 14,6 @@ module WordNet::DefaultDB
# Library version constant
VERSION = '2.0.1'
- # Version-control revision constant
- REVISION = %q$Revision$
-
# The data directory which contains the database file
DATA_DIR = if ENV['WORDNET_DEFAULTDB_DATADIR']
Pathname( ENV['WORDNET_DEFAULTDB_DATADIR'] )
M wordnet-defaultdb/spec/spec_helper.rb +8 -7
@@ 18,15 18,16 @@ RSpec.configure do |config|
mocks.verify_partial_doubles = true
end
- config.shared_context_metadata_behavior = :apply_to_host_groups
-
+ config.disable_monkey_patching!
+ config.example_status_persistence_file_path = "spec/.state"
+ config.filter_run :focus
config.filter_run_when_matching :focus
- config.example_status_persistence_file_path = "spec/.state"
- config.disable_monkey_patching!
+ config.order = :random
+ config.profile_examples = 5
+ config.run_all_when_everything_filtered = true
+ config.shared_context_metadata_behavior = :apply_to_host_groups
config.warnings = true
- config.profile_examples = 10
- config.order = :random
- Kernel.srand config.seed
+ Kernel.srand( config.seed )
end
M wordnet.gemspec +19 -51
@@ 1,63 1,31 @@
# -*- encoding: utf-8 -*-
-# stub: wordnet 1.1.0.pre20170926144654 ruby lib
+# stub: wordnet 1.2.0.pre.20230510154013 ruby lib
Gem::Specification.new do |s|
s.name = "wordnet".freeze
- s.version = "1.1.0.pre20170926144654"
+ s.version = "1.2.0.pre.20230510154013"
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1".freeze) if s.respond_to? :required_rubygems_version=
+ s.metadata = { "bug_tracker_uri" => "https://todo.sr.ht/~ged/ruby-wordnet/browse", "changelog_uri" => "http://deveiate.org/code/wordnet/History_md.html", "documentation_uri" => "http://deveiate.org/code/wordnet", "homepage_uri" => "https://hg.sr.ht/~ged/ruby-wordnet", "source_uri" => "https://hg.sr.ht/~ged/ruby-wordnet/browse" } if s.respond_to? :metadata=
s.require_paths = ["lib".freeze]
s.authors = ["Michael Granger".freeze]
- s.cert_chain = ["certs/ged.pem".freeze]
- s.date = "2017-09-26"
- s.description = "This library is a Ruby interface to WordNet\u00AE[http://wordnet.princeton.edu/].\nWordNet\u00AE is an online lexical reference system whose design is inspired\nby current psycholinguistic theories of human lexical memory. English\nnouns, verbs, adjectives and adverbs are organized into synonym sets, each\nrepresenting one underlying lexical concept. Different relations link\nthe synonym sets.\n\nThis library uses WordNet-SQL[http://wnsql.sourceforge.net/], which is a\nconversion of the lexicon flatfiles into a relational database format. You\ncan either install the 'wordnet-defaultdb' gem, which packages up the\nSQLite3 version of WordNet-SQL, or install your own and point the lexicon\nat it by passing \n{Sequel connection parameters}[http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html]\nto the constructor.".freeze
+ s.date = "2023-05-10"
+ s.description = "This library is a Ruby interface to WordNet\u00AE. WordNet\u00AE is an online lexical reference system whose design is inspired by current psycholinguistic theories of human lexical memory. English nouns, verbs, adjectives and adverbs are organized into synonym sets, each representing one underlying lexical concept. Different relations link the synonym sets.".freeze
s.email = ["ged@FaerieMUD.org".freeze]
- s.extra_rdoc_files = ["History.rdoc".freeze, "Manifest.txt".freeze, "README.md".freeze, "README.rdoc".freeze, "WordNet30-license.txt".freeze, "History.rdoc".freeze, "README.rdoc".freeze]
- s.files = [".gems".freeze, ".ruby-gemset".freeze, ".ruby-version".freeze, ".simplecov".freeze, "ChangeLog".freeze, "Gemfile".freeze, "History.rdoc".freeze, "LICENSE".freeze, "Manifest.txt".freeze, "README.md".freeze, "README.rdoc".freeze, "Rakefile".freeze, "TODO".freeze, "WordNet30-license.txt".freeze, "certs/ged.pem".freeze, "examples/gcs.rb".freeze, "examples/hypernym_tree.rb".freeze, "lib/wordnet.rb".freeze, "lib/wordnet/constants.rb".freeze, "lib/wordnet/lexicallink.rb".freeze, "lib/wordnet/lexicon.rb".freeze, "lib/wordnet/model.rb".freeze, "lib/wordnet/morph.rb".freeze, "lib/wordnet/semanticlink.rb".freeze, "lib/wordnet/sense.rb".freeze, "lib/wordnet/sumoterm.rb".freeze, "lib/wordnet/synset.rb".freeze, "lib/wordnet/word.rb".freeze, "spec/helpers.rb".freeze, "spec/wordnet/lexicon_spec.rb".freeze, "spec/wordnet/model_spec.rb".freeze, "spec/wordnet/semanticlink_spec.rb".freeze, "spec/wordnet/sense_spec.rb".freeze, "spec/wordnet/synset_spec.rb".freeze, "spec/wordnet/word_spec.rb".freeze, "spec/wordnet_spec.rb".freeze, "wordnet.gemspec".freeze]
- s.homepage = "http://deveiate.org/projects/Ruby-WordNet".freeze
+ s.files = ["History.rdoc".freeze, "README.md".freeze, "WordNet30-license.txt".freeze, "lib/wordnet.rb".freeze, "lib/wordnet/constants.rb".freeze, "lib/wordnet/lexicallink.rb".freeze, "lib/wordnet/lexicon.rb".freeze, "lib/wordnet/model.rb".freeze, "lib/wordnet/morph.rb".freeze, "lib/wordnet/semanticlink.rb".freeze, "lib/wordnet/sense.rb".freeze, "lib/wordnet/sumoterm.rb".freeze, "lib/wordnet/synset.rb".freeze, "lib/wordnet/word.rb".freeze, "spec/helpers.rb".freeze, "spec/wordnet/lexicon_spec.rb".freeze, "spec/wordnet/model_spec.rb".freeze, "spec/wordnet/semanticlink_spec.rb".freeze, "spec/wordnet/sense_spec.rb".freeze, "spec/wordnet/synset_spec.rb".freeze, "spec/wordnet/word_spec.rb".freeze, "spec/wordnet_spec.rb".freeze]
+ s.homepage = "https://hg.sr.ht/~ged/ruby-wordnet".freeze
s.licenses = ["BSD-3-Clause".freeze]
- s.post_install_message = "\nIf you don't already have a WordNet database installed somewhere,\nyou'll need to either download and install one from:\n\n http://wnsql.sourceforge.net/\n\nor just install the 'wordnet-defaultdb' gem, which will install\nthe SQLite version for you.\n\n".freeze
- s.rdoc_options = ["--main".freeze, "README.rdoc".freeze]
- s.required_ruby_version = Gem::Requirement.new(">= 2.2.0".freeze)
- s.rubygems_version = "2.6.13".freeze
- s.summary = "This library is a Ruby interface to WordNet\u00AE[http://wordnet.princeton.edu/]".freeze
-
- if s.respond_to? :specification_version then
- s.specification_version = 4
+ s.post_install_message = "If you don't already have a WordNet database installed somewhere,\nyou'll need to either download and install one from:\n\n http://wnsql.sourceforge.net/\n\nor just install the 'wordnet-defaultdb' gem, which will install\nthe SQLite version for you.\n".freeze
+ s.required_ruby_version = Gem::Requirement.new("~> 3.0".freeze)
+ s.rubygems_version = "3.4.12".freeze
+ s.summary = "This library is a Ruby interface to WordNet\u00AE.".freeze
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<sequel>.freeze, ["~> 5.0"])
- s.add_runtime_dependency(%q<loggability>.freeze, ["~> 0.11"])
- s.add_development_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
- s.add_development_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
- s.add_development_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
- s.add_development_dependency(%q<sqlite3>.freeze, ["~> 1.3"])
- s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5"])
- s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.12"])
- s.add_development_dependency(%q<rdoc>.freeze, ["~> 4.0"])
- s.add_development_dependency(%q<hoe>.freeze, ["~> 3.16"])
- else
- s.add_dependency(%q<sequel>.freeze, ["~> 5.0"])
- s.add_dependency(%q<loggability>.freeze, ["~> 0.11"])
- s.add_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
- s.add_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
- s.add_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
- s.add_dependency(%q<sqlite3>.freeze, ["~> 1.3"])
- s.add_dependency(%q<rspec>.freeze, ["~> 3.5"])
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.12"])
- s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
- s.add_dependency(%q<hoe>.freeze, ["~> 3.16"])
- end
- else
- s.add_dependency(%q<sequel>.freeze, ["~> 5.0"])
- s.add_dependency(%q<loggability>.freeze, ["~> 0.11"])
- s.add_dependency(%q<hoe-mercurial>.freeze, ["~> 1.4"])
- s.add_dependency(%q<hoe-deveiate>.freeze, ["~> 0.9"])
- s.add_dependency(%q<hoe-highline>.freeze, ["~> 0.2"])
- s.add_dependency(%q<sqlite3>.freeze, ["~> 1.3"])
- s.add_dependency(%q<rspec>.freeze, ["~> 3.5"])
- s.add_dependency(%q<simplecov>.freeze, ["~> 0.12"])
- s.add_dependency(%q<rdoc>.freeze, ["~> 4.0"])
- s.add_dependency(%q<hoe>.freeze, ["~> 3.16"])
- end
+ s.specification_version = 4
+
+ s.add_runtime_dependency(%q<loggability>.freeze, ["~> 0.18"])
+ s.add_runtime_dependency(%q<pg>.freeze, ["~> 1.4"])
+ s.add_runtime_dependency(%q<sequel>.freeze, ["~> 5.64"])
+ s.add_runtime_dependency(%q<sqlite3>.freeze, ["~> 1.5"])
+ s.add_development_dependency(%q<rake-deveiate>.freeze, ["~> 0.22"])
+ s.add_development_dependency(%q<rdoc-generator-sixfish>.freeze, ["~> 0.3"])
end