Module: WORD

Defined in:
lib/meiou/word.rb

Constant Summary collapse

@@WORD =
Hash.new { |h,k| if !h.has_key?(k); w = WORD.term(k); if w != false; h[k] = w; end; end }

Class Method Summary collapse

Class Method Details

.[](word) ⇒ Object

word



28
29
30
# File 'lib/meiou/word.rb', line 28

def self.[] word
  @@WORD[word]
end

.keysObject

words



33
34
35
# File 'lib/meiou/word.rb', line 33

def self.keys
  @@WORD.keys
end

.term(word) ⇒ Object

find word.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/meiou/word.rb', line 6

def self.term word
  ds, df = [], []
  WordNet::Lemma.find_all(word).each { |e|
    ds << e.pos;
    e.synsets.each  { |ee|
      ee.expanded_hypernyms.each { |eee|
        ee.gloss.gsub('"', "").gsub("--", " ").split("; ").each { |eeee|
          df << eeee
          df.uniq!
        }
      }
    }
  }
  #if ds.include?('n') && !ds.include?('v')                                                                                                                                                                                    
  if ds.length > 0
    return  { word: word, pos: ds, def: df }
  else
    return false
  end
end