Nasty.Lexical.WordNet.Relation (Nasty v0.3.0)
View SourceRepresents a semantic relation between two WordNet synsets.
Relations define how synsets are connected semantically. Common relations include hypernymy (is-a), meronymy (part-of), antonymy (opposite), and many others.
Relation Types
Taxonomic Relations
:hypernym- More general concept (dog → canine):hyponym- More specific concept (canine → dog):instance_hypernym- Instance to class (Einstein → physicist):instance_hyponym- Class to instance (physicist → Einstein)
Part-Whole Relations
:meronym- Part-of (wheel → car):holonym- Whole-of (car → wheel):member_meronym- Member-of (player → team):member_holonym- Has-member (team → player):substance_meronym- Made-of (wood → tree):substance_holonym- Has-substance (tree → wood)
Similarity/Difference
:similar_to- Similar meaning (big → large):antonym- Opposite meaning (hot → cold):also_see- Related concept
Verb Relations
:entailment- Logical entailment (snore → sleep):cause- Causation (kill → die):verb_group- Semantically related verbs
Adjective Relations
:attribute- Noun attribute (heavy → weight):pertainym- Pertains to (atomic → atom)
Derivational Relations
:derivationally_related- Morphologically related words
Fields
type- Relation type (see above)source_id- Source synset IDtarget_id- Target synset ID
Example
%Relation{
type: :hypernym,
source_id: "oewn-02084071-n", # dog
target_id: "oewn-02083346-n" # canine
}
Summary
Functions
Returns the inverse relation type if it exists.
Creates a new relation.
Checks if this is a symmetric relation (same in both directions).
Checks if this is a taxonomic relation (hypernym/hyponym).
Checks if a relation type is valid.
Types
@type relation_type() ::
:hypernym
| :hyponym
| :instance_hypernym
| :instance_hyponym
| :meronym
| :holonym
| :member_meronym
| :member_holonym
| :substance_meronym
| :substance_holonym
| :similar_to
| :antonym
| :also_see
| :entailment
| :cause
| :verb_group
| :attribute
| :pertainym
| :derivationally_related
@type t() :: %Nasty.Lexical.WordNet.Relation{ source_id: String.t(), target_id: String.t(), type: relation_type() }
Functions
@spec inverse(relation_type()) :: {:ok, relation_type()} | {:error, :no_inverse}
Returns the inverse relation type if it exists.
Examples
iex> Relation.inverse(:hypernym)
{:ok, :hyponym}
iex> Relation.inverse(:antonym)
{:ok, :antonym}
iex> Relation.inverse(:also_see)
{:error, :no_inverse}
@spec new(relation_type(), String.t(), String.t()) :: {:ok, t()} | {:error, term()}
Creates a new relation.
Examples
iex> Relation.new(:hypernym, "oewn-02084071-n", "oewn-02083346-n")
{:ok, %Relation{type: :hypernym, ...}}
@spec symmetric?(relation_type()) :: boolean()
Checks if this is a symmetric relation (same in both directions).
Checks if this is a taxonomic relation (hypernym/hyponym).
Checks if a relation type is valid.