wordnet 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: ad96c50badb95731cea04d9413faee469842b80b9831ccd17fbe60206069cb9d
4
- data.tar.gz: f8d045d5d3d4d4ece365c66cca1b8a630b6133b7164d6000f016b7eae74b8812
2
+ SHA1:
3
+ metadata.gz: 27d43321cb1c8ba285945387a8eedd6bd25f5647
4
+ data.tar.gz: 6b7f5d9abef4970f46a98bc06f621ef2de26744d
5
5
  SHA512:
6
- metadata.gz: c518543f3492cb5365c2b21ee775213bbfb8aab36f6dcf5294123453a45b8c819559d0f2a88b0245874775c044fb13d494382a9a18d8ac6f99e1c09f8c619e85
7
- data.tar.gz: d2de124e23a91f9f1cac09d0c150a7336649fbaf5b8ef45141838c5a6a9b37b6a70f31da99b7bd27b97e88823e36558ce6abe7ae14b102e621835576c4330944
6
+ metadata.gz: 6dac34d56a4eea80abe63377c08e8f68e1d149e40e230757bb05213f3bd45d88b0238eb4f3cb04d46e0ef2a016bb9229e8a22e6240c94295e19e32fed023ec31
7
+ data.tar.gz: 7b93069a12a31970a977afcf2ecf8a12113f103d56818c99c417c83f5f7f2c3f4d1f93e0ffd268d73f81d0910c760de20c5d923ab06d214d00e320bf391c80f5
Binary file
data.tar.gz.sig CHANGED
Binary file
data/.gems CHANGED
@@ -1,5 +1,6 @@
1
- hoe-deveiate -v0.8.0
2
- sequel -v4.38.0
3
- sqlite3 -v1.3.11
4
- loggability -v0.11.0
5
- simplecov -v0.12.0
1
+ hoe-deveiate
2
+ loggability
3
+ pg
4
+ sequel
5
+ simplecov
6
+ sqlite3
@@ -1 +1 @@
1
- 2.3
1
+ 2.4
@@ -1,3 +1,12 @@
1
+ == v1.1.0 [2017-09-26] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Enhancements:
4
+
5
+ - Update to WordNet 3.1 (from SQLUNet 5.2.0), Sequel 5.0.
6
+ - Made fetching Synset by ordinal deterministic
7
+ - Documentation updates/fixes
8
+
9
+
1
10
  == v1.0.1 [2016-09-18] Michael Granger <ged@FaerieMUD.org>
2
11
 
3
12
  - Finish up and fix WordNet::Sense
data/README.md CHANGED
@@ -1 +1 @@
1
- The README is in RDoc format, which Bitbucket doesn't support; [see the source](https://bitbucket.org/ged/ruby-wordnet/src/3db62d5ed69878e8e7c36795d3379291db0402d6/README.rdoc?at=default).
1
+ 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).
@@ -1,22 +1,23 @@
1
1
  = Ruby-WordNet
2
2
 
3
- * http://deveiate.org/projects/Ruby-WordNet
3
+ * https://bitbucket.org/ged/ruby-wordnet/
4
4
 
5
5
  == Description
6
6
 
7
7
  This library is a Ruby interface to WordNet®[http://wordnet.princeton.edu/].
8
- WordNet® is an online lexical reference system whose design is inspired
9
- by current psycholinguistic theories of human lexical memory. English
10
- nouns, verbs, adjectives and adverbs are organized into synonym sets, each
11
- representing one underlying lexical concept. Different relations link
12
- the synonym sets.
13
-
14
- This library uses WordNet-SQL[http://wnsql.sourceforge.net/], which is a
15
- conversion of the lexicon flatfiles into a relational database format. You
16
- can either install the 'wordnet-defaultdb' gem, which packages up the
17
- SQLite3 version of WordNet-SQL, or install your own and point the lexicon
18
- at it by passing
19
- {Sequel connection parameters}[http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html]
8
+ WordNet® is an online lexical reference system whose design is inspired by
9
+ current psycholinguistic theories of human lexical memory. English nouns,
10
+ verbs, adjectives and adverbs are organized into synonym sets, each
11
+ representing one underlying lexical concept. Different relations link the
12
+ synonym sets.
13
+
14
+ This library uses SqlUNET[http://sqlunet.sourceforge.net/], which is a
15
+ conversion of the WordNet (along with a number of other linguistic databases)
16
+ lexicon flatfiles into a relational database format. You can either install the
17
+ {wordnet-defaultdb}[https://rubygems.org/gems/wordnet-defaultdb] gem, which
18
+ packages up the SQLite3 version of SqlUNet, or install your own and point the
19
+ lexicon at it by passing {Sequel connection
20
+ parameters}[http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html]
20
21
  to the constructor.
21
22
 
22
23
  === Usage
@@ -53,15 +54,15 @@ mapping:
53
54
  [WordNet::SumoTerm] {Suggested Upper Merged Ontology}[http://www.ontologyportal.org/]
54
55
  terms, with associations back to related Synsets.
55
56
 
56
- This is only supported by a subset of the WordNetSQL databases, and there
57
- is a fair amount of work left to be done before it's really functional. Drop
58
- me a note if you're interested in working on this.
57
+ As mentioned above, SqlUNet has done an amazing job of linking up a number of
58
+ other useful linguistic lexicons via WordNet synsets. I plan on adding support
59
+ for at minimum VerbNet, FrameNet, and PropBank.
59
60
 
60
61
 
61
62
  == Requirements
62
63
 
63
- * Ruby >= 1.9.3
64
- * Sequel >= 3.38.0
64
+ * Ruby >= 2.3
65
+ * Sequel >= 5.0
65
66
 
66
67
 
67
68
  == Authors
@@ -71,7 +72,7 @@ me a note if you're interested in working on this.
71
72
 
72
73
  == License
73
74
 
74
- Copyright (c) 2002-2012, The FaerieMUD Consortium
75
+ Copyright (c) 2002-2017, Michael Granger
75
76
  All rights reserved.
76
77
 
77
78
  Redistribution and use in source and binary forms, with or without
data/Rakefile CHANGED
@@ -29,12 +29,12 @@ hoespec = Hoe.spec( 'wordnet' ) do
29
29
 
30
30
  self.developer 'Michael Granger', 'ged@FaerieMUD.org'
31
31
 
32
- self.dependency 'sequel', '~> 4.38'
33
- self.dependency 'loggability', '~> 0.11'
32
+ self.dependency 'sequel', '~> 5.0'
33
+ self.dependency 'loggability', '~> 0.11'
34
34
 
35
- self.dependency 'sqlite3', '~> 1.3', :developer
36
- self.dependency 'rspec', '~> 3.5', :developer
37
- self.dependency 'simplecov', '~> 0.12', :developer
35
+ self.dependency 'sqlite3', '~> 1.3', :developer
36
+ self.dependency 'rspec', '~> 3.5', :developer
37
+ self.dependency 'simplecov', '~> 0.12', :developer
38
38
 
39
39
  self.spec_extras[:post_install_message] = %{
40
40
  If you don't already have a WordNet database installed somewhere,
@@ -1,7 +1,7 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQsFADA+MQwwCgYDVQQDDANnZWQx
2
+ MIIEbDCCAtSgAwIBAgIBATANBgkqhkiG9w0BAQUFADA+MQwwCgYDVQQDDANnZWQx
3
3
  GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
4
- HhcNMTYwODIwMTgxNzQyWhcNMTcwODIwMTgxNzQyWjA+MQwwCgYDVQQDDANnZWQx
4
+ HhcNMTcwOTI3MDAzMDQ0WhcNMTgwOTI3MDAzMDQ0WjA+MQwwCgYDVQQDDANnZWQx
5
5
  GTAXBgoJkiaJk/IsZAEZFglGYWVyaWVNVUQxEzARBgoJkiaJk/IsZAEZFgNvcmcw
6
6
  ggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQC/JWGRHO+USzR97vXjkFgt
7
7
  83qeNf2KHkcvrRTSnR64i6um/ziin0I0oX23H7VYrDJC9A/uoUa5nGRJS5Zw/+wW
@@ -14,13 +14,13 @@ soo/6za/bWajOKUmDhpqvaiRv9EDpVLzuj53uDoukMMwxCMfgb04+ckQ0t2G7wqc
14
14
  /D+K9JW9DDs3Yjgv9k4h7YMhW5gftosd+NkNC/+Y2CkCAwEAAaN1MHMwCQYDVR0T
15
15
  BAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFHKN/nkRusdqCJEuq3lgB3fJvyTg
16
16
  MBwGA1UdEQQVMBOBEWdlZEBGYWVyaWVNVUQub3JnMBwGA1UdEgQVMBOBEWdlZEBG
17
- YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBCwUAA4IBgQAPJzKiT0zBU7kpqe0aS2qb
18
- FI0PJ4y5I8buU4IZGUD5NEt/N7pZNfOyBxkrZkXhS44Fp+xwBH5ebLbq/WY78Bqd
19
- db0z6ZgW4LMYMpWFfbXsRbd9TU2f52L8oMAhxOvF7Of5qJMVWuFQ8FPagk2iHrdH
20
- inYLQagqAF6goWTXgAJCdPd6SNeeSNqA6vlY7CV1Jh5kfNJJ6xu/CVij1GzCLu/5
21
- DMOr26DBv+qLJRRC/2h34uX71q5QgeOyxvMg+7V3u/Q06DXyQ2VgeeqiwDFFpEH0
22
- PFkdPO6ZqbTRcLfNH7mFgCBJjsfSjJrn0sPBlYyOXgCoByfZnZyrIMH/UY+lgQqS
23
- 6Von1VDsfQm0eJh5zYZD64ZF86phSR7mUX3mXItwH04HrZwkWpvgd871DZVR3i1n
24
- w8aNA5re5+Rt/Vvjxj5AcEnZnZiz5x959NaddQocX32Z1unHw44pzRNUur1GInfW
25
- p4vpx2kUSFSAGjtCbDGTNV2AH8w9OU4xEmNz8c5lyoA=
17
+ YWVyaWVNVUQub3JnMA0GCSqGSIb3DQEBBQUAA4IBgQB/qyi5pCjK8ceoKalfVAjS
18
+ vG64FEnLnD1bm39T5UaFIRmo+abZtfpg2QhwKvPbPjOicau2+m+MDQ2Cc3tgyaC3
19
+ dZxcP6w8APFg4AId09uWAZKf0xajvBMS2aOz8Bbmag6fwqRRkTMqsNYnmqcF7aRT
20
+ DuEzbEMfaOUYjU9RuB48vr4q8yRft0ww+3jq5iwNkrX1buL2pwBbyvgms6D/BV41
21
+ MaTVMjsHqJUwU2xVfhGtxGAWAer5S1HGYHkbio6mGVtiie0uWjmnzi7ppIlMr48a
22
+ 7BNTsoZ+/JRk3iQWmmNsyFT7xfqBKye7cH11BX8V8P4MeGB5YWlMI+Myj5DZY3fQ
23
+ st2AGD4rb1l0ia7PfubcBThSIdz61eCb8gRi/RiZZwb3/7+eyEncLJzt2Ob9fGSF
24
+ X0qdrKi+2aZZ0NGuFj9AItBsVmAvkBGIpX4TEKQp5haEbPpmaqO5nIIhV26PXmyT
25
+ OMKv6pWsoS81vw5KAGBmfX8nht/Py90DQrbRvakATGI=
26
26
  -----END CERTIFICATE-----
@@ -4,9 +4,9 @@
4
4
  require 'loggability'
5
5
  require 'sequel'
6
6
 
7
- # This is a Ruby interface to the WordNet® lexical database. It uses the WordNet-SQL
8
- # project's databases instead of reading from the canonical flatfiles for speed and
9
- # easy modification.
7
+ # This is a Ruby interface to the WordNet® lexical database. It uses the SqlUNet
8
+ # project's databases instead of reading from the canonical flatfiles for speed,
9
+ # easy modification, and correlation with other linguistic lexicons.
10
10
  module WordNet
11
11
  extend Loggability
12
12
 
@@ -15,15 +15,11 @@ module WordNet
15
15
 
16
16
 
17
17
  # Release version
18
- VERSION = '1.0.1'
18
+ VERSION = '1.1.0'
19
19
 
20
20
  # VCS revision
21
21
  REVISION = %q$Revision: $
22
22
 
23
- # Abort if not >=2.2.0
24
- abort "This version of WordNet requires Ruby 2.2.0 or greater." unless
25
- RUBY_VERSION >= '2.2.0'
26
-
27
23
 
28
24
  ### Lexicon exception - something has gone wrong in the internals of the
29
25
  ### lexicon.
@@ -38,7 +34,6 @@ module WordNet
38
34
  include WordNet::Constants
39
35
 
40
36
  ### Get the WordNet version.
41
- ### @return [String] the library's version
42
37
  def self::version_string( include_buildnum=false )
43
38
  vstring = "%s %s" % [ self.name, VERSION ]
44
39
  vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
@@ -47,15 +42,15 @@ module WordNet
47
42
 
48
43
 
49
44
  require 'wordnet/lexicon'
50
-
51
45
  require 'wordnet/model'
52
- require 'wordnet/sense'
53
- require 'wordnet/synset'
54
- require 'wordnet/semanticlink'
55
- require 'wordnet/lexicallink'
56
- require 'wordnet/word'
57
- require 'wordnet/morph'
58
- require 'wordnet/sumoterm'
46
+
47
+ WordNet::Model.register_model( 'wordnet/sense' )
48
+ WordNet::Model.register_model( 'wordnet/synset' )
49
+ WordNet::Model.register_model( 'wordnet/semanticlink' )
50
+ WordNet::Model.register_model( 'wordnet/lexicallink' )
51
+ WordNet::Model.register_model( 'wordnet/word' )
52
+ WordNet::Model.register_model( 'wordnet/morph' )
53
+ WordNet::Model.register_model( 'wordnet/sumoterm' )
59
54
 
60
55
  #
61
56
  # Backward-compatibility stuff
@@ -79,6 +74,5 @@ module WordNet
79
74
  Other = :s
80
75
 
81
76
 
82
-
83
77
  end # module WordNet
84
78
 
@@ -14,11 +14,11 @@ module WordNet::Constants
14
14
 
15
15
  # Synset syntactic-category names -> indicators
16
16
  SYNTACTIC_CATEGORIES = {
17
- :noun => "n",
18
- :verb => "v",
19
- :adjective => "a",
20
- :adverb => "r",
21
- :other => "s",
17
+ noun: "n",
18
+ verb: "v",
19
+ adjective: "a",
20
+ adverb: "r",
21
+ other: "s",
22
22
  }
23
23
  # Syntactic-category indicators -> names
24
24
  SYNTACTIC_SYMBOLS = SYNTACTIC_CATEGORIES.invert
@@ -34,29 +34,29 @@ module WordNet::Constants
34
34
 
35
35
  # Synset pointer typenames -> indicators
36
36
  POINTER_TYPES = {
37
- :antonym => '!',
38
- :hypernym => '@',
39
- :entailment => '*',
40
- :hyponym => '~',
41
- :meronym => '%',
42
- :holonym => '#',
43
- :cause => '>',
44
- :verb_group => '$',
45
- :similar_to => '&',
46
- :participle => '<',
47
- :pertainym => '\\',
48
- :attribute => '=',
49
- :derived_from => '\\',
50
- :see_also => '^',
51
- :derivation => '+',
52
- :domain => ';',
53
- :member => '-',
37
+ antonym: '!',
38
+ hypernym: '@',
39
+ entailment: '*',
40
+ hyponym: '~',
41
+ meronym: '%',
42
+ holonym: '#',
43
+ cause: '>',
44
+ verb_group: '$',
45
+ similar_to: '&',
46
+ participle: '<',
47
+ pertainym: '\\',
48
+ attribute: '=',
49
+ derived_from: '\\',
50
+ see_also: '^',
51
+ derivation: '+',
52
+ domain: ';',
53
+ member: '-',
54
54
  }
55
55
 
56
56
  # Synset pointer indicator -> typename
57
57
  POINTER_SYMBOLS = POINTER_TYPES.invert
58
58
 
59
- # Map the pointer types into their own symbols (eg., :verb_group => VerbGroup)
59
+ # Map the pointer types into their own symbols (eg., verb_group: VerbGroup)
60
60
  POINTER_TYPES.each do |sym,val|
61
61
  cname = sym.to_s.gsub( /(?:^|_)(.)/ ) { $1.upcase }
62
62
  const_set( cname, val )
@@ -65,7 +65,7 @@ module WordNet::Constants
65
65
  # Hypernym synset pointer types
66
66
  HYPERNYM_TYPES = {
67
67
  nil => '@', # Install non-subtype methods, too
68
- :instance => '@i',
68
+ instance: '@i',
69
69
  }
70
70
 
71
71
  # Hypernym indicator -> type map
@@ -74,7 +74,7 @@ module WordNet::Constants
74
74
  # Hyponym synset pointer types
75
75
  HYPONYM_TYPES = {
76
76
  nil => '~', # Install non-subtype methods, too
77
- :instance => '~i',
77
+ instance: '~i',
78
78
  }
79
79
 
80
80
  # Hyponym indicator -> type map
@@ -82,13 +82,13 @@ module WordNet::Constants
82
82
 
83
83
  # Meronym synset pointer types
84
84
  MERONYM_TYPES = {
85
- :member => '%m',
86
- :stuff => '%s',
87
- :portion => '%o',
88
- :component => '%p',
89
- :feature => '%f',
90
- :phase => '%a',
91
- :place => '%l',
85
+ member: '%m',
86
+ stuff: '%s',
87
+ portion: '%o',
88
+ component: '%p',
89
+ feature: '%f',
90
+ phase: '%a',
91
+ place: '%l',
92
92
  }
93
93
 
94
94
  # Meronym indicator -> type map
@@ -102,13 +102,13 @@ module WordNet::Constants
102
102
 
103
103
  # Holonym synset pointer types
104
104
  HOLONYM_TYPES = {
105
- :member => '#m',
106
- :stuff => '#s',
107
- :portion => '#o',
108
- :component => '#p',
109
- :feature => '#f',
110
- :phase => '#a',
111
- :place => '#l',
105
+ member: '#m',
106
+ stuff: '#s',
107
+ portion: '#o',
108
+ component: '#p',
109
+ feature: '#f',
110
+ phase: '#a',
111
+ place: '#l',
112
112
  }
113
113
 
114
114
  # Holonym indicator -> type map
@@ -122,9 +122,9 @@ module WordNet::Constants
122
122
 
123
123
  # Domain synset pointer types
124
124
  DOMAIN_TYPES = {
125
- :category => ';c',
126
- :region => ';r',
127
- :usage => ';u',
125
+ category: ';c',
126
+ region: ';r',
127
+ usage: ';u',
128
128
  }
129
129
 
130
130
  # Domain indicator -> type map
@@ -138,9 +138,9 @@ module WordNet::Constants
138
138
 
139
139
  # Member synset pointer types
140
140
  MEMBER_TYPES = {
141
- :category => '-c',
142
- :region => '-r',
143
- :usage => '-u',
141
+ category: '-c',
142
+ region: '-r',
143
+ usage: '-u',
144
144
  }
145
145
 
146
146
  # Member indicator -> type map
@@ -154,12 +154,12 @@ module WordNet::Constants
154
154
 
155
155
  # Map of primary types to maps of their subtypes
156
156
  POINTER_SUBTYPES = {
157
- :hyponym => HYPONYM_TYPES,
158
- :hypernym => HYPERNYM_TYPES,
159
- :meronym => MERONYM_TYPES,
160
- :holonym => HOLONYM_TYPES,
161
- :member => MEMBER_TYPES,
162
- :domain => DOMAIN_TYPES,
157
+ hyponym: HYPONYM_TYPES,
158
+ hypernym: HYPERNYM_TYPES,
159
+ meronym: MERONYM_TYPES,
160
+ holonym: HOLONYM_TYPES,
161
+ member: MEMBER_TYPES,
162
+ domain: DOMAIN_TYPES,
163
163
  }
164
164
 
165
165
 
@@ -14,16 +14,16 @@ class WordNet::LexicalLink < WordNet::Model( :lexlinks )
14
14
  ##
15
15
  # The WordNet::Sense the link is pointing *from*.
16
16
  many_to_one :origin,
17
- :class => :"WordNet::Sense",
18
- :key => :synset1id,
19
- :primary_key => :synsetid
17
+ class: 'WordNet::Sense',
18
+ key: :synset1id,
19
+ primary_key: :synsetid
20
20
 
21
21
  ##
22
22
  # The WordNet::Synset the link is pointing *to*.
23
23
  one_to_many :target,
24
- :class => :"WordNet::Synset",
25
- :key => :synsetid,
26
- :primary_key => :synset2id
24
+ class: 'WordNet::Synset',
25
+ key: :synsetid,
26
+ primary_key: :synset2id
27
27
 
28
28
 
29
29
  ######
@@ -7,8 +7,14 @@ require 'rubygems'
7
7
 
8
8
  require 'wordnet' unless defined?( WordNet )
9
9
  require 'wordnet/constants'
10
- require 'wordnet/synset'
11
- require 'wordnet/word'
10
+ require 'wordnet/model'
11
+
12
+ # Try to load the default database gem, ignoring it if it's not installed.
13
+ begin
14
+ require 'wordnet-defaultdb'
15
+ rescue LoadError
16
+ # No-op
17
+ end
12
18
 
13
19
 
14
20
  # WordNet lexicon class - provides access to the WordNet lexical
@@ -18,13 +24,13 @@ require 'wordnet/word'
18
24
  # == Creating a Lexicon
19
25
  #
20
26
  # To create a Lexicon, point it at a database using {Sequel database connection
21
- # criteria}[http://sequel.rubyforge.org/rdoc/files/doc/opening_databases_rdoc.html]:
27
+ # criteria}[http://sequel.jeremyevans.net/rdoc/files/doc/opening_databases_rdoc.html]:
22
28
  #
23
- # lex = WordNet::Lexicon.new( 'postgres://localhost/wordnet30' )
24
- # # => #<WordNet::Lexicon:0x7fd192a76668 postgres://localhost/wordnet30>
29
+ # lex = WordNet::Lexicon.new( 'postgres://localhost/wordnet31' )
30
+ # # => #<WordNet::Lexicon:0x7fd192a76668 postgres://localhost/wordnet31>
25
31
  #
26
32
  # # Another way of doing the same thing:
27
- # lex = WordNet::Lexicon.new( adapter: 'postgres', database: 'wordnet30', host: 'localhost' )
33
+ # lex = WordNet::Lexicon.new( adapter: 'postgres', database: 'wordnet31', host: 'localhost' )
28
34
  # # => #<WordNet::Lexicon:0x7fd192d374b0 postgres>
29
35
  #
30
36
  # Alternatively, if you have the 'wordnet-defaultdb' gem (which includes an
@@ -33,7 +39,7 @@ require 'wordnet/word'
33
39
  #
34
40
  # lex = WordNet::Lexicon.new
35
41
  # # => #<WordNet::Lexicon:0x7fdbfac1a358 sqlite:[...]/gems/wordnet-defaultdb-1.0.1
36
- # # /data/wordnet-defaultdb/wordnet30.sqlite>
42
+ # # /data/wordnet-defaultdb/wordnet31.sqlite>
37
43
  #
38
44
  # == Looking Up Synsets
39
45
  #
@@ -128,36 +134,10 @@ class WordNet::Lexicon
128
134
  log_to :wordnet
129
135
 
130
136
 
131
- # Add the logger device to the default options after it's been loaded
132
- WordNet::DEFAULT_DB_OPTIONS.merge!( :logger => [Loggability[WordNet]] )
133
-
134
-
135
137
  ### Get the Sequel URI of the default database, if it's installed.
136
138
  def self::default_db_uri
137
- self.log.debug "Fetching the default db URI"
138
-
139
- # Try to load the default database gem, ignoring it if it's not installed.
140
- begin
141
- gem 'wordnet-defaultdb'
142
- rescue Gem::LoadError
143
- end
144
-
145
- # Now try the gem datadir first, and fall back to a local installation of the
146
- # default db
147
- datadir = nil
148
- if Gem.datadir( 'wordnet-defaultdb' )
149
- datadir = Pathname( Gem.datadir('wordnet-defaultdb') )
150
- else
151
- self.log.warn " no defaultdb gem; looking for the development database"
152
- datadir = Pathname( __FILE__ ).dirname.parent.parent +
153
- 'wordnet-defaultdb/data/wordnet-defaultdb'
154
- end
155
-
156
- dbfile = datadir + 'wordnet30.sqlite'
157
- self.log.debug " dbfile is: %s" % [ dbfile ]
158
-
159
- if dbfile.exist?
160
- return "sqlite:#{dbfile}"
139
+ if defined?( WordNet::DefaultDB )
140
+ return WordNet::DefaultDB.uri
161
141
  else
162
142
  return nil
163
143
  end
@@ -181,6 +161,13 @@ class WordNet::Lexicon
181
161
 
182
162
  @db.sql_log_level = :debug
183
163
  WordNet::Model.db = @db
164
+ WordNet::Model.descendents.each do |subclass|
165
+ self.log.debug "Switching DB for %p to %p" % [ subclass, @db ]
166
+ subclass.dataset = @db[ subclass.table_name ]
167
+ end
168
+
169
+ # Add the logger device after it's been loaded
170
+ @db.logger = Loggability[ self.class ]
184
171
  end
185
172
 
186
173
 
@@ -189,7 +176,7 @@ class WordNet::Lexicon
189
176
  uri = WordNet::Lexicon.default_db_uri or raise WordNet::LexiconError,
190
177
  "No default WordNetSQL database! You can install it via the " +
191
178
  "wordnet-defaultdb gem, or download a version yourself from " +
192
- "http://sourceforge.net/projects/wnsql/"
179
+ "http://sqlunet.sourceforge.net/"
193
180
  @db = self.connect( uri, options )
194
181
  end
195
182
 
@@ -277,7 +264,7 @@ class WordNet::Lexicon
277
264
  ### definition using a LIKE query.
278
265
  ###
279
266
  def lookup_synsets( word, *args )
280
- dataset = WordNet::Synset.filter( :words => WordNet::Word.filter(lemma: word.to_s) )
267
+ dataset = WordNet::Synset.filter( words: WordNet::Word.filter(lemma: word.to_s) )
281
268
  self.log.debug "Looking up synsets for %p" % [ word.to_s ]
282
269
 
283
270
  # Add filters to the dataset for each argument
@@ -287,11 +274,11 @@ class WordNet::Lexicon
287
274
 
288
275
  when Integer
289
276
  self.log.debug " limiting to sense %d" % [ arg ]
290
- dataset = dataset.limit( 1, arg-1 )
277
+ dataset = dataset.order( :synsetid ).limit( 1, arg-1 )
291
278
 
292
279
  when Range
293
280
  self.log.debug " limiting to range of senses: %p" % [ arg ]
294
- dataset = dataset.limit( arg.entries.length, arg.begin - 1 )
281
+ dataset = dataset.order( :synsetid ).limit( arg.entries.length, arg.begin - 1 )
295
282
 
296
283
  when Regexp
297
284
  self.log.debug " filter: definition =~ %p" % [ arg ]