Bases: ABC
Class for retrieving information regarding word frequency and lexicon
membership. Concrete implementations might also serve as interfaces for
language-specific lexical resources such as word groups and affixes.
Lexicons require instantiation because resources for them are loaded lazily
but remain in memory because it is likely that the same kind of lookup will
be performed multiple times over the lifetime of a Lexicon instance.
Source code in src/limes/analyzers/interfaces.py
| class Lexicon(ABC):
"""
Class for retrieving information regarding word frequency and lexicon
membership. Concrete implementations might also serve as interfaces for
language-specific lexical resources such as word groups and affixes.
Lexicons require instantiation because resources for them are loaded lazily
but remain in memory because it is likely that the same kind of lookup will
be performed multiple times over the lifetime of a Lexicon instance.
"""
@abstractmethod
def contains(self, word: str) -> bool:
"""Check whether the given word is contained in the lexicon."""
...
@abstractmethod
def get_frequency(self, word: str) -> int | None:
"""
Identify how frequent a given word is in the given Lexicon. Please note
that frequency is described in relative terms, normalized to [0.0, 1.0].
"""
...
|
contains(word)
abstractmethod
Check whether the given word is contained in the lexicon.
Source code in src/limes/analyzers/interfaces.py
| @abstractmethod
def contains(self, word: str) -> bool:
"""Check whether the given word is contained in the lexicon."""
...
|
get_frequency(word)
abstractmethod
Identify how frequent a given word is in the given Lexicon. Please note
that frequency is described in relative terms, normalized to [0.0, 1.0].
Source code in src/limes/analyzers/interfaces.py
| @abstractmethod
def get_frequency(self, word: str) -> int | None:
"""
Identify how frequent a given word is in the given Lexicon. Please note
that frequency is described in relative terms, normalized to [0.0, 1.0].
"""
...
|