Class: WordNet::Sense

Inherits:
Object
  • Object
show all
Includes:
Constants
Defined in:
lib/wordnet/sense.rb

Overview

WordNet sense model class

Constant Summary

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

Generate a method that will return Synsets related by the given lexical pointer type.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/wordnet/sense.rb', line 24

def self::lexical_link( type, typekey=nil )
	typekey ||= type.to_s.chomp( 's' ).to_sym

	self.log.debug "Generating a %p method for %p links" % [ type, typekey ]

	method_body = Proc.new do
		linkinfo = WordNet::Synset.linktype_names[ typekey ] or
			raise ScriptError, "no such link type %p" % [ typekey ]
		ssids = self.lexlinks_dataset.filter( :linkid => linkinfo[:id] ).select( :synset2id )
		self.class.filter( :synsetid => ssids )
	end
	self.log.debug "  method body is: %p" % [ method_body ]

	define_method( type, &method_body )
end