Cadmium::WordNet::Synset
Inherits Reference / Object
Represents a synset (or group of synonymous words) in WordNet. Synsets are related to each other by various (and numerous!) relationships, including Hypernym (x is a hypernym of y <=> x is a parent of y) and Hyponym (x is a child of y)
Constructors
Create a new synset by reading from the data file specified by pos, at offset bytes into the file. This is how the WordNet database is organized. You shouldn't be creating Synsets directly; instead, use Lemma#synsets.
Class methods
Similar to the method Lemma#find, but returns a list of Synsets instead of a Lemma
Instance methods
Get the entire hypernym tree (from this synset all the way up to entity) as an array.
Get the entire hypernym tree (from this synset all the way up to entity) as an array.
Get a string representation of this synset's gloss. "Gloss" is a human-readable description of this concept, often with example usage, e.g:
move upward; "The fog lifted"; "The smoke arose from the forest fire"; "The mist uprose from the meadows"
for the second sense of the verb "fall"
Get the parent synset (higher-level category, i.e. fruit -> reproductive_structure) as an array.
A two digit decimal integer representing the name of the lexicographer file containing the synset for the sense. Probably only of interest if you're using a wordnet database marked up with custom attributes, and you want to ensure that you're using your own additions.
Get a shorthand representation of the part of speech this synset represents, e.g. "v" for verbs.
Get the offset, in bytes, at which this synset's POS information is stored in WordNet's internal DB. You almost certainly don't care about this.
Get an array of Synsets with the relation pointer_symbol relative to this
Synset. Mostly, this is an internal method used by convience methods (e.g. Synset#antonym), but
it can take any valid valid pointer_symbol defined in pointers.cr.
Example (get the gloss of an antonym for 'fall'):
lemma = Cadmium::WordNet.lookup("fall", :verb)
puts lemma.synsets[1].relation("!")[0].gloss unless lemma.nil?
NOTE: Valid pointer symbols are contained in the constants NOUN_POINTERS,
VERB_POINTERS, ADJECTIVE_POINTERS, and ADVERB_POINTERS
Get the offset, in bytes, at which this synset's information is stored in WordNet's internal DB. You almost certainly don't care about this.
Get the part of speech type of this synset. One of 'n' (noun), 'v' (verb), 'a' (adjective), or 'r' (adverb)
Returns a compact, human-readable form of this synset, e.g.
(v) fall (descend in free fall under the influence of gravity; "The branch fell from the tree"; "The unfortunate hiker fell into a crevasse")
for the second meaning of the verb "fall."
Get the list of words (and their frequencies within the WordNet graph) contained in this Synset.