vibe.linguistics.base¶
Abstract base class for language-specific grammar rules.
LanguageRules ¶
Abstract base class for language-specific grammar rules.
Each supported language implements this class to provide: - Grammar transformation rules (pluralize, definite, possessive) - Number-to-word conversion (cardinal, ordinal) - Filter aliases for templates in that language - Tag aliases for the enumerate extension
pluralize ¶
pluralize(word: str, context: Linguistic | None = None, overrides: str | None = None) -> str
Convert a word to its plural form.
| Parameters: |
|
|---|
make_definite ¶
make_definite(word: str, number: str = 'singular', gender: GrammaticalGender | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str
Convert a word to its definite form.
| Parameters: |
|
|---|
make_possessive ¶
make_possessive(word: str, subject: str | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str
Convert a word to its possessive/genitive form.
| Parameters: |
|
|---|
make_indefinite ¶
make_indefinite(word: str, gender: GrammaticalGender | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str
Add indefinite article to a word.
| Parameters: |
|
|---|
| Returns: |
|
|---|
number_to_cardinal ¶
number_to_cardinal(num: int) -> str
Convert a number to its cardinal word form (e.g., 3 -> 'three').
number_to_ordinal ¶
number_to_ordinal(num: int) -> str
Convert a number to its ordinal word form (e.g., 3 -> 'third').
format_doublet ¶
format_doublet(num: int, unit: str | None = None) -> str
Format a number as a legal doublet: word (digits) [unit].
Default implementation uses cardinal form. Override for locale-specific formatting.
format_conjunction ¶
format_conjunction(conjunction_type: str) -> str
Return the localized conjunction word.
| Parameters: |
|
|---|
| Returns: |
|
|---|
uses_oxford_comma ¶
uses_oxford_comma() -> bool
Whether this language uses the Oxford comma in lists.
get_gender_hint ¶
get_gender_hint(word: str) -> GrammaticalGender | None
Attempt to determine grammatical gender from word form.
Override in subclasses that support gender. Returns None if unknown.