Declension of Czech Names into Vocative Case
The `vokativ` Python library, currently at version 1.2.1, provides functionality for declining Czech proper names into the vocative case. It takes a first-case singular name as input and returns its vocative form as a lowercase unicode string. The library is considered stable (Production/Stable) and was last updated in March 2020.
Common errors
-
AttributeError: module 'vokativ' has no attribute 'vokativ'
cause Attempting to call `vokativ.vokativ()` after `import vokativ` instead of `from vokativ import vokativ`.fixUse `from vokativ import vokativ` to directly import the function, or if importing the module, call it as `vokativ.vokativ('Name')` (though the former is idiomatic). -
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128)
cause Occurs when attempting to pass a byte string (e.g., from Python 2, or improperly read file in Python 3) containing non-ASCII characters to the `vokativ` function, which expects a unicode string.fixEnsure that the input name is a proper unicode string (Python 2 `unicode` or Python 3 `str`). For bytes, decode them explicitly, e.g., `name_bytes.decode('utf-8')`.
Warnings
- gotcha The library may not function correctly for names of foreign origin. It is primarily designed for standard Czech names.
- gotcha The library's last release was in March 2020, and the associated GitHub repository (as linked on PyPI) appears to be largely inactive since 2014, with only an initial commit. While marked as 'Production/Stable', this indicates a lack of ongoing development and potential for unaddressed issues or lack of updates for newer Python versions or linguistic changes.
- gotcha Examples on PyPI use Python 2 unicode literals (e.g., `u'Novák'`). While these work as regular strings in Python 3, users should ensure they are passing actual `str` (which are unicode in Python 3) objects to avoid `UnicodeDecodeError` in mixed encoding environments, especially if processing input from external sources.
Install
-
pip install vokativ
Imports
- vokativ
from vokativ import vokativ
Quickstart
from vokativ import vokativ
# Decline a male name
male_name = 'Petr'
vocative_male = vokativ(male_name)
print(f"'{male_name}' in vocative is '{vocative_male}'")
# Decline a female name
female_name = 'Adriana'
vocative_female = vokativ(female_name)
print(f"'{female_name}' in vocative is '{vocative_female}'")
# Decline a surname
surname = 'Novák'
vocative_surname = vokativ(surname)
print(f"'{surname}' in vocative is '{vocative_surname}'")