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.



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/wordnet/sense.rb', line 32

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.



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

lexical_link :also_see, :also

#antonymObject

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



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

lexical_link :antonym

#derivationObject

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



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

lexical_link :derivation

#domain_categoriesObject

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



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

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.



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

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.



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

lexical_link :domain_member_region

#domain_member_usageObject

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



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

lexical_link :domain_member_usage

#domain_regionObject

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



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

lexical_link :domain_region

#domain_usageObject

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



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

lexical_link :domain_usage

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



24
25
26
27
# File 'lib/wordnet/sense.rb', line 24

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.



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

lexical_link :participle

#pertainymObject

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



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

lexical_link :pertainym

#synsetObject

The Synset this is a Sense for



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

many_to_one :synset, key: :synsetid

#verb_groupObject

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



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

lexical_link :verb_group

#wordObject

The Word this is a Sense for



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

many_to_one :word, key: :wordid