class

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

new(pos, offset : Int32)

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.

Source

Class methods

_apply_rules(forms, pos)
Source
_filter_forms(forms, pos)
Source
find(word, pos)

Similar to the method Lemma#find, but returns a list of Synsets instead of a Lemma

Source
find_all(word)

Similar to the method Lemma#find_all, but returns Synsets instead of Lemmas

Source
load_exception_map
Source
morphy(form, pos)

Get the root of a form by pos

Source
morphy(form)

Get all roots of a form regardless of part of speech

Source

Instance methods

antonyms

Get the Synsets of this sense's antonym

Source
expanded_first_hypernyms

Get the entire hypernym tree (from this synset all the way up to entity) as an array.

Source
expanded_hypernyms

Get the entire hypernym tree (from this synset all the way up to entity) as an array.

Source
expanded_hypernyms_depth
Source
gloss

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"

Source
hypernym

Get the parent synset (higher-level category, i.e. fruit -> reproductive_structure).

Source
hypernyms

Get the parent synset (higher-level category, i.e. fruit -> reproductive_structure) as an array.

Source
hyponyms

Get the child synset(s) (i.e., lower-level categories, i.e. fruit -> edible_fruit)

Source
lex_filenum

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.

Source
pos

Get a shorthand representation of the part of speech this synset represents, e.g. "v" for verbs.

Source
pos_offset

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.

Source
relation(pointer_symbol)

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

Source
synonyms

Get the synonyms (hypernyms and hyponyms) for this Synset

Source
synset_offset

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.

Source
synset_type

Get the part of speech type of this synset. One of 'n' (noun), 'v' (verb), 'a' (adjective), or 'r' (adverb)

Source
to_s(io)

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."

Source
word_count

How many words does this Synset include?

Source
word_counts

Get the list of words (and their frequencies within the WordNet graph) contained in this Synset.

Source
words

Get a list of words included in this Synset

Source