Method: Words::Synset#initialize
- Defined in:
- lib/synset.rb
#initialize(synset_id, wordnet_connection, homographs) ⇒ Synset
Returns a new instance of Synset.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/synset.rb', line 59 def initialize(synset_id, wordnet_connection, homographs) @wordnet_connection = wordnet_connection @synset_hash = wordnet_connection.synset(synset_id) @homographs = homographs # construct some conveniance menthods for relation type access Relation::SYMBOL_TO_RELATION.keys.each do |relation_type| self.class.send(:define_method, "#{relation_type}s?") do relations(relation_type).size > 0 end self.class.send(:define_method, "#{relation_type}s") do relations(relation_type) end end end |