Class WordNet::Lexicon

In: | lib/wordnet/lexicon.rb
Parent: | Object

WordNet lexicon class - abstracts access to the WordNet lexical databases, and provides factory methods for looking up and creating new WordNet::Synset objects.

Methods

archlogs checkpoint cleanLogs createSynset familiarity grep lookupSynsets lookupSynsetsByKey morph new removeSynset reverseMorph storeSynset

Attributes

dataDb | [R] | The handle to the synset data table
env | [R] | The BDB::Env object which contains the wordnet lexicon’s databases.
indexDb | [R] | The handle to the index table
morphDb | [R] | The handle to the morph table

Included modules

WordNet::Constants CrossCase

Public Class methods

new()

Create a new WordNet::Lexicon object.

Public Instance methods

checkpoint( bytes=0, minutes=0 )

Checkpoint the database. (BerkeleyDB-specific)

archlogs()

Return a list of archival logfiles that can be removed safely. (BerkeleyDB-specific).

cleanLogs()

Remove any archival logfiles for the lexicon’s database environment. (BerkeleyDB-specific).

familiarity( word, partOfSpeech, polyCount=nil )

Returns an integer of the familiarity/polysemy count for `word` as a `partOfSpeech`. Note that polysemy can be identified for a given word by counting the synsets returned by lookupSynsets.

lookupSynsets( word, partOfSpeech, sense=nil )

Look up sysets (Wordnet::Synset objects) matching `text` as a `partOfSpeech`, where `partOfSpeech` is one of +WordNet::Noun+, +WordNet::Verb+, +WordNet::Adjective+, or +WordNet::Adverb+. Without `sense`, lookupSynsets will return all matches that are a `partOfSpeech`. If `sense` is specified, only the synset object that matches that particular `partOfSpeech` and `sense` is returned.

lookupSynsetsByKey( *keys )

Returns the WordNet::Synset objects corresponding to the `keys` specified. The `keys` are made up of the target synset’s "offset" and syntactic category catenated together with a ’%’ character.

morph( word, partOfSpeech )

Returns a form of `word` as a part of speech `partOfSpeech`, as found in the WordNet morph files. The lookupSynsets method perfoms morphological conversion automatically, so a call to morph is not required.

reverseMorph( word )

Returns the result of looking up `word` in the inverse of the WordNet morph files. _(This is undocumented in Lingua::Wordnet)_

grep( text )

Returns an array of compound words matching `text`.

createSynset( word, partOfSpeech )

Factory method: Creates and returns a new WordNet::Synset object in this lexicon for the specified `word` and `partOfSpeech`.

storeSynset( synset )

Store the specified `synset` (a WordNet::Synset object) in the lexicon. Returns the key of the stored synset.

removeSynset( synset )

Remove the specified `synset` (a WordNet::Synset object) in the lexicon. Returns the offset of the stored synset.