Method: WordNet::Sense.lexical_link
- Defined in:
- lib/wordnet/sense.rb
.lexical_link(type, typekey = nil) ⇒ Object
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 |