Class: WordNet::SemanticLink

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

Overview

WordNet semantic link (pointer) 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

Instance Method Summary collapse

Instance Method Details

#originObject

The “origin” WordNet::Synset associated with this SemanticLink



20
21
22
23
# File 'lib/wordnet/semanticlink.rb', line 20

many_to_one :origin,
class: 'WordNet::Synset',
key: :synset1id,
primary_key: :synsetid

#targetObject

The “target” WordNet::Synset associated with this SemanticLink



27
28
29
30
31
# File 'lib/wordnet/semanticlink.rb', line 27

one_to_one :target,
class: 'WordNet::Synset',
key: :synsetid,
primary_key: :synset2id,
eager: :words

#to_sObject

Return a stringified version of the SemanticLink.



39
40
41
42
43
44
45
# File 'lib/wordnet/semanticlink.rb', line 39

def to_s
  return "%s: %s (%s)" % [
    self.type,
    self.target.words.map( &:to_s ).join( ', ' ),
    self.target.pos,
  ]
end

#typeObject

Return the type of link as a Symbol.



49
50
51
# File 'lib/wordnet/semanticlink.rb', line 49

def type
  return WordNet::Synset.linktype_table[ self.linkid ][ :type ]
end

#typenameObject

Return the name of the link type as a String.



55
56
57
# File 'lib/wordnet/semanticlink.rb', line 55

def typename
  return WordNet::Synset.linktype_table[ self.linkid ][ :typename ]
end