Method: Words::Homographs#initialize

Defined in:
lib/homographs.rb

#initialize(raw_homographs, wordnet_connection) ⇒ Homographs

Returns a new instance of Homographs.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/homographs.rb', line 13

def initialize(raw_homographs, wordnet_connection)

  @wordnet_connection = wordnet_connection
  @raw_homographs = raw_homographs

  # construct some conveniance menthods for relation type access
  SYMBOL_TO_POS.keys.each do |pos|
    self.class.send(:define_method, "#{pos}s?") do
      size(pos) > 0
    end
    self.class.send(:define_method, "#{pos}s") do
      synsets(pos)
    end
    self.class.send(:define_method, "#{pos}_count") do
      size(pos)
    end
    self.class.send(:define_method, "#{pos}_ids") do
      synset_ids(pos)
    end
  end
  
end