Method: WordNet::Synset#expanded_first_hypernyms
- Defined in:
- lib/rwordnet/synset.rb
#expanded_first_hypernyms ⇒ Object
Get the entire hypernym tree (from this synset all the way up to entity) as an array.
213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
# File 'lib/rwordnet/synset.rb', line 213 def parent = hypernym list = [] return list unless parent while parent break if list.include? parent.pos_offset list.push parent.pos_offset parent = parent.hypernym end list.flatten! list.map! { |offset| Synset.new(@pos, offset)} end |