rwordnet 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/wordnet/index.rb CHANGED
@@ -17,11 +17,13 @@ class Index
17
17
 
18
18
  # If we didn't find it, read in some more from the DB. Some optimisation is possible here. TODO.
19
19
  index = WordNetDB.open(File.join(WordNetDB.path,"dict","index.#{@pos}"))
20
+
21
+ lemma_counter = 1
20
22
  if not index.closed?
21
23
  loop do
22
24
  break if index.eof?
23
25
  line = index.readline
24
- lemma = Lemma.new(line)
26
+ lemma = Lemma.new(line, lemma_counter); lemma_counter += 1
25
27
  @db[lemma.word] = lemma
26
28
  if line =~ /^#{lemma_str} /
27
29
  return lemma
data/lib/wordnet/lemma.rb CHANGED
@@ -2,11 +2,12 @@ module WordNet
2
2
 
3
3
  # Represents a single word in the WordNet lexicon, which can be used to look up a set of synsets.
4
4
  class Lemma
5
- attr_accessor :lemma, :pos, :synset_cnt, :p_cnt, :ptr_symbol, :tagsense_cnt, :synset_offset
6
-
5
+ attr_accessor :lemma, :pos, :synset_cnt, :p_cnt, :ptr_symbol, :tagsense_cnt, :synset_offset, :id
6
+
7
7
  # Create a lemma from a line in an index file. You should be creating Lemmas by hand; instead,
8
8
  # use the WordNet#find and Index#find methods to find the Lemma for a word.
9
- def initialize(index_line)
9
+ def initialize(index_line, id = 0)
10
+ @id = (id > 0) ? id : nil
10
11
  line = index_line.split(" ")
11
12
 
12
13
  @lemma = line.shift
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rwordnet
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Trevor Fountain