Returns the primary lemma (first lemma in the synset).
Examples
iex> synset = %Synset{lemmas: ["dog", "domestic dog"]}
iex> Synset.primary_lemma(synset)
"dog"
Represents a WordNet synset (synonym set) - a group of words that share the same meaning.
A synset is the fundamental unit of WordNet, grouping together words (lemmas) that are synonymous and interchangeable in some context. Each synset has a unique ID, part of speech, definition, usage examples, and links to other synsets through semantic relations.
id - Unique synset identifier (e.g., "oewn-02084071-n")pos - Part of speech (:noun, :verb, :adj, :adv)definition - Textual definition/gloss of the synset meaningexamples - List of example sentences demonstrating usagelemmas - List of word forms (strings) in this synsetlanguage - ISO 639-1 language code (:en, :es, :ca, etc.)ili - Interlingual Index ID for cross-lingual linking (optional)%Synset{
id: "oewn-02084071-n",
pos: :noun,
definition: "a member of the genus Canis",
examples: ["the dog barked all night"],
lemmas: ["dog", "domestic dog", "Canis familiaris"],
language: :en,
ili: "i2084071"
}
Converts Universal Dependencies POS tag to WordNet POS tag.
Creates a new synset struct with validation.
Returns the primary lemma (first lemma in the synset).
Checks if a part-of-speech tag is valid.
Converts Universal Dependencies POS tag to WordNet POS tag.
iex> Synset.from_ud_pos(:propn)
:noun
iex> Synset.from_ud_pos(:aux)
:verb
@spec new(String.t(), pos_tag(), String.t(), language_code(), keyword()) :: {:ok, t()} | {:error, term()}
Creates a new synset struct with validation.
iex> Synset.new("oewn-02084071-n", :noun, "a member of the genus Canis", :en)
{:ok, %Synset{id: "oewn-02084071-n", pos: :noun, ...}}
iex> Synset.new("invalid", :invalid, "definition", :en)
{:error, :invalid_pos}
Returns the primary lemma (first lemma in the synset).
iex> synset = %Synset{lemmas: ["dog", "domestic dog"]}
iex> Synset.primary_lemma(synset)
"dog"
Checks if a part-of-speech tag is valid.