Module: WordNet

Extended by:
Loggability
Includes:
Constants
Defined in:
lib/wordnet.rb,
lib/wordnet/model.rb

Overview

This is a Ruby interface to the WordNet® lexical database. It uses the WordNet-SQL project’s databases instead of reading from the canonical flatfiles for speed and easy modification.

Defined Under Namespace

Modules: Constants Classes: LexicalLink, Lexicon, LexiconError, LookupError, Model, Morph, SemanticLink, Sense, SumoTerm, Synset, Word

Constant Summary collapse

VERSION =

Release version

'1.0.0'
REVISION =

VCS revision

%q$Revision: $
Noun =

Backward-compatibility constant

:n
Verb =

Backward-compatibility constant

:v
Adjective =

Backward-compatibility constant

:a
Adverb =

Backward-compatibility constant

:r
Other =

Backward-compatibility constant

:s

Constants included from Constants

Constants::DEFAULT_DB_OPTIONS, Constants::DELIM, Constants::DELIM_RE, Constants::DOMAIN_TYPES, Constants::DomainSymbols, Constants::HOLONYM_SYMBOLS, Constants::HOLONYM_TYPES, Constants::HYPERNYM_SYMBOLS, Constants::HYPERNYM_TYPES, Constants::HYPONYM_SYMBOLS, Constants::HYPONYM_TYPES, Constants::LEXFILES, Constants::MEMBER_SYMBOLS, Constants::MEMBER_TYPES, Constants::MERONYM_SYMBOLS, Constants::MERONYM_TYPES, Constants::POINTER_SUBTYPES, Constants::POINTER_SYMBOLS, Constants::POINTER_TYPES, Constants::SUB_DELIM, Constants::SUB_DELIM_RE, Constants::SYNTACTIC_CATEGORIES, Constants::SYNTACTIC_SYMBOLS, Constants::VERB_SENTS

Class Method Summary collapse

Class Method Details

.Model(source) ⇒ Object

Overridden version of Sequel.Model() that creates subclasses of WordNet::Model instead of Sequel::Model.

See Also:

  • Sequel.Model()


60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/wordnet/model.rb', line 60

def self::Model( source )
	unless Sequel::Model::ANONYMOUS_MODEL_CLASSES.key?( source )
		anonclass = nil
		WordNet::Model.without_sql_logging do
			if source.is_a?( Sequel::Database )
				anonclass = Class.new( WordNet::Model )
				anonclass.db = source
			else
				anonclass = Class.new( WordNet::Model ).set_dataset( source )
			end
		end

		Sequel::Model::ANONYMOUS_MODEL_CLASSES[ source ] = anonclass
	end

	return Sequel::Model::ANONYMOUS_MODEL_CLASSES[ source ]
end

.version_string(include_buildnum = false) ⇒ String

Get the WordNet version.

Returns:

  • (String)

    the library’s version



42
43
44
45
46
# File 'lib/wordnet.rb', line 42

def self::version_string( include_buildnum=false )
	vstring = "%s %s" % [ self.name, VERSION ]
	vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
	return vstring
end