rwordnet 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. data/History.txt +10 -0
  2. data/lib/wordnet/index.rb +7 -1
  3. metadata +7 -11
data/History.txt CHANGED
@@ -1,2 +1,12 @@
1
+ # rWordNet 0.1.3
2
+ # Fixed a terrible bug that caused Indices to re-read the *entire* database on every failed lookup.
3
+
4
+ # rWordNet 0.1.2
5
+ * Added unique (integer) ids to lemmas [Wolfram Sieber]
6
+
7
+ # rWordNet 0.1.1
8
+ * Maintenance release, fixing some broken unit tests.
9
+ * Updated the interface for using Indices; where before you could instantiate an Index by calling, e.g., NounIndex.new, now you instantiate them as singleton instances (`NounIndex.instance`).
10
+
1
11
  # rWordNet 0.1.0
2
12
  * Initial release
data/lib/wordnet/index.rb CHANGED
@@ -8,6 +8,8 @@ class Index
8
8
  def initialize(pos)
9
9
  @pos = pos
10
10
  @db = {}
11
+
12
+ @finished_reading = false
11
13
  end
12
14
 
13
15
  # Find a lemma for a given word. Returns a Lemma which can then be used to access the synsets for the word.
@@ -15,7 +17,9 @@ class Index
15
17
  # Look for the lemma in the part of the DB already read...
16
18
  return @db[lemma_str] if @db.include?(lemma_str)
17
19
 
18
- # If we didn't find it, read in some more from the DB. Some optimisation is possible here. TODO.
20
+ return nil if @finished_reading
21
+
22
+ # If we didn't find it, read in some more from the DB.
19
23
  index = WordNetDB.open(File.join(WordNetDB.path,"dict","index.#{@pos}"))
20
24
 
21
25
  lemma_counter = 1
@@ -32,6 +36,8 @@ class Index
32
36
  index.close
33
37
  end
34
38
 
39
+ @finished_reading = true
40
+
35
41
  # If we *still* didn't find it, return nil. It must not be in the database...
36
42
  return nil
37
43
  end
metadata CHANGED
@@ -1,21 +1,21 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwordnet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 1
9
- - 2
10
- version: 0.1.2
8
+ - 3
9
+ version: 0.1.3
11
10
  platform: ruby
12
11
  authors:
13
12
  - Trevor Fountain
13
+ - Wolfram Sieber
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-03 00:00:00 +01:00
18
+ date: 2010-10-15 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -66,34 +66,30 @@ rdoc_options:
66
66
  require_paths:
67
67
  - lib
68
68
  required_ruby_version: !ruby/object:Gem::Requirement
69
- none: false
70
69
  requirements:
71
70
  - - ">="
72
71
  - !ruby/object:Gem::Version
73
- hash: 3
74
72
  segments:
75
73
  - 0
76
74
  version: "0"
77
75
  required_rubygems_version: !ruby/object:Gem::Requirement
78
- none: false
79
76
  requirements:
80
77
  - - ">="
81
78
  - !ruby/object:Gem::Version
82
- hash: 3
83
79
  segments:
84
80
  - 0
85
81
  version: "0"
86
82
  requirements: []
87
83
 
88
84
  rubyforge_project:
89
- rubygems_version: 1.3.7
85
+ rubygems_version: 1.3.6
90
86
  signing_key:
91
87
  specification_version: 3
92
88
  summary: A pure Ruby interface to the WordNet database
93
89
  test_files:
94
- - test/test_helper.rb
95
90
  - test/unit/index_test.rb
96
91
  - test/unit/synset_test.rb
97
92
  - test/unit/wordnetdb_test.rb
98
- - examples/dictionary.rb
93
+ - test/test_helper.rb
99
94
  - examples/full_hypernym.rb
95
+ - examples/dictionary.rb