# File lib/wordnet/lexicon.rb, line 157 def lookupSynsets( word, partOfSpeech, sense=nil ) wordkey = self.makeWordKey( word, partOfSpeech ) pos = self.makePos( partOfSpeech ) synsets = [] # Look up the index entry, trying first the word as given, and if # that fails, trying morphological conversion. entry = @indexDb[ wordkey ] if entry.nil? && (word = self.morph( word, partOfSpeech )) entry = @indexDb[ wordkey ] end # If the lookup failed both ways, just abort return nil unless entry # Make synset keys from the entry, narrowing it to just the sense # requested if one was specified. synkeys = entry.split( SubDelimRe ).collect {|off| "#{off}%#{pos}" } if sense return lookupSynsetsByKey( synkeys[sense - 1] ) else return [ lookupSynsetsByKey(*synkeys) ].flatten end end