Class: WordNet::DB

Inherits:
Object
  • Object
show all
Defined in:
lib/rwordnet/db.rb

Overview

Represents the WordNet database, and provides some basic interaction.

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cachedObject

Returns the value of attribute cached.



7
8
9
# File 'lib/rwordnet/db.rb', line 7

def cached
  @cached
end

.pathObject

To use your own WordNet installation (rather than the one bundled with rwordnet: Returns the path to the WordNet installation currently in use. Defaults to the bundled version of WordNet.



13
14
15
# File 'lib/rwordnet/db.rb', line 13

def path
  @path
end

Class Method Details

.open(path, &block) ⇒ Object

Open a wordnet database. You shouldn’t have to call this directly; it’s handled by the autocaching implemented in lemma.rb.

‘path` should be a string containing the absolute path to the root of a WordNet installation.



20
21
22
# File 'lib/rwordnet/db.rb', line 20

def open(path, &block)
  File.open(File.join(self.path, path), "r", &block)
end