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

Instance Method Summary collapse

Class Method Details

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



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/wordnet/sense.rb', line 75

def self::lexical_link( type, typekey=nil ) # :nodoc:
	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.linktypes[ 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

	define_method( type, &method_body )
end

Instance Method Details

#also_seeObject

Return the synsets that are lexically linked to this sense via an “also see” link.



93
# File 'lib/wordnet/sense.rb', line 93

lexical_link :also_see, :also

#antonymObject

Return the synsets that are lexically linked to this sense via an “antonym” link.



97
# File 'lib/wordnet/sense.rb', line 97

lexical_link :antonym

#derivationObject

Return the synsets that are lexically linked to this sense via a “derivation” link.



101
# File 'lib/wordnet/sense.rb', line 101

lexical_link :derivation

#domain_categoriesObject

Return the synsets that are lexically linked to this sense via a “domain category” link.



105
# File 'lib/wordnet/sense.rb', line 105

lexical_link :domain_categories, :domain_category

#domain_member_categoriesObject

Return the synsets that are lexically linked to this sense via a “domain member category” link.



110
# File 'lib/wordnet/sense.rb', line 110

lexical_link :domain_member_categories, :domain_member_category

#domain_member_regionObject

Return the synsets that are lexically linked to this sense via a “domain member region” link.



114
# File 'lib/wordnet/sense.rb', line 114

lexical_link :domain_member_region

#domain_member_usageObject

Return the synsets that are lexically linked to this sense via a “domain member usage” link.



118
# File 'lib/wordnet/sense.rb', line 118

lexical_link :domain_member_usage

#domain_regionObject

Return the synsets that are lexically linked to this sense via a “domain region” link.



122
# File 'lib/wordnet/sense.rb', line 122

lexical_link :domain_region

#domain_usageObject

Return the synsets that are lexically linked to this sense via a “domain usage” link.



126
# File 'lib/wordnet/sense.rb', line 126

lexical_link :domain_usage

The lexical links between this sense and its related Synsets. Sense -> [ LexicalLinks ] -> [ Synsets ]



67
68
69
70
# File 'lib/wordnet/sense.rb', line 67

one_to_many :lexlinks,
class: 'WordNet::LexicalLink',
key: [ :synset1id, :word1id ],
primary_key: [ :synsetid, :wordid ]

#participleObject

Return the synsets that are lexically linked to this sense via a “participle” link.



130
# File 'lib/wordnet/sense.rb', line 130

lexical_link :participle

#pertainymObject

Return the synsets that are lexically linked to this sense via a “pertainym” link.



134
# File 'lib/wordnet/sense.rb', line 134

lexical_link :pertainym

#synsetObject

The Synset this is a Sense for



58
# File 'lib/wordnet/sense.rb', line 58

many_to_one :synset, key: :synsetid

#verb_groupObject

Return the synsets that are lexically linked to this sense via a “verb group” link.



138
# File 'lib/wordnet/sense.rb', line 138

lexical_link :verb_group

#wordObject

The Word this is a Sense for



62
# File 'lib/wordnet/sense.rb', line 62

many_to_one :word, key: :wordid