Nasty.Lexical.WordNet.Lemma (Nasty v0.3.0)
View SourceRepresents a WordNet lemma - a word form with a specific sense in a synset.
A lemma is a specific word form that belongs to a synset. The same word can have multiple lemmas if it appears in different synsets (different senses). Lemmas connect the lexical level (words) to the semantic level (synsets/meanings).
Fields
word- The word form/text (e.g., "dog", "run")pos- Part of speech tagsynset_id- ID of the synset this lemma belongs tosense_key- Unique identifier for this word-sense pairfrequency- Usage frequency (higher = more common), optionallanguage- Language code
Example
%Lemma{
word: "dog",
pos: :noun,
synset_id: "oewn-02084071-n",
sense_key: "dog%1:05:00::",
frequency: 10,
language: :en
}
Summary
Functions
Checks if lemma matches a word and optional POS.
Creates a new lemma struct.
Returns a normalized version of the word for matching.
Checks if two lemmas are for the same word (case-insensitive).
Types
@type t() :: %Nasty.Lexical.WordNet.Lemma{ frequency: integer() | nil, language: Nasty.Lexical.WordNet.Synset.language_code(), pos: Nasty.Lexical.WordNet.Synset.pos_tag(), sense_key: String.t(), synset_id: String.t(), word: String.t() }
Functions
@spec matches?(t(), String.t(), Nasty.Lexical.WordNet.Synset.pos_tag() | nil) :: boolean()
Checks if lemma matches a word and optional POS.
@spec new( String.t(), Nasty.Lexical.WordNet.Synset.pos_tag(), String.t(), String.t(), Nasty.Lexical.WordNet.Synset.language_code(), keyword() ) :: {:ok, t()} | {:error, term()}
Creates a new lemma struct.
Examples
iex> Lemma.new("dog", :noun, "oewn-02084071-n", "dog%1:05:00::", :en)
{:ok, %Lemma{word: "dog", pos: :noun, ...}}
Returns a normalized version of the word for matching.
Converts to lowercase and removes diacritics/special characters.
Checks if two lemmas are for the same word (case-insensitive).