vibe.linguistics.languages.de

German language rules for linguistic transformations.

GermanRules

German grammar rules implementation.

get_gender_hint

get_gender_hint(word: str) -> GrammaticalGender | None

Attempt to determine grammatical gender from word form.

pluralize

pluralize(word: str, context: Linguistic | None = None, overrides: str | None = None) -> str

Convert a German word to its plural form.

Parameters:
  • word (str) –

    The word to pluralize

  • context (Linguistic | None, default: None ) –

    Optional Linguistic context

  • overrides (str | None, default: None ) –

    Optional override string for ad-hoc irregular forms. Format: "singular->plural,singular2->plural2" Example: "Virus->Viren,Atlas->Atlanten"

make_definite

make_definite(word: str, number: str = 'singular', gender: GrammaticalGender | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str

Add German definite article.

Parameters:
  • word (str) –

    The noun

  • number (str, default: 'singular' ) –

    "singular" or "plural"

  • gender (GrammaticalGender | None, default: None ) –

    Optional gender override (m/f/n)

  • context (Linguistic | None, default: None ) –

    Optional linguistic context for article selection

  • overrides (str | None, default: None ) –

    Optional article override

make_possessive

make_possessive(word: str, subject: str | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str

Convert to German genitive form.

German genitive: - Masculine/neuter nouns: des + noun + (e)s - Feminine nouns: der + noun (no ending change) - Plural: der + noun

Note: The subject parameter is handled by the transforms layer.

make_indefinite

make_indefinite(word: str, gender: GrammaticalGender | None = None, context: Linguistic | None = None, overrides: str | None = None) -> str

Add German indefinite article (ein/eine/ein) to a word.

German indefinite articles depend on grammatical gender: - MASCULINE: "ein" - FEMININE: "eine" - NEUTER: "ein"

number_to_cardinal

number_to_cardinal(num: int) -> str

Convert number to German words.

number_to_ordinal

number_to_ordinal(num: int) -> str

Convert number to German ordinal words.

format_conjunction

format_conjunction(conjunction_type: str) -> str

Return German conjunction word.

uses_oxford_comma

uses_oxford_comma() -> bool

German does not use the Oxford comma.