morphkit.decode_tag
- morphkit.decode_tag(tag_input: str, debug: bool = False) Dict[str, Any] [source]
Decode a morphological tag into a set of human-readable features.
This function takes a morphological tag (e.g. “V-PAI-3S”) and returns a dictionary of interpreted grammatical properties, such as Part of Speech, case, number, gender, tense, voice, mood, person, and any suffix details.
Args:
- tag_input (str):
The raw morphological tag string. Usually includes prefixes like “N-”, “V-”, “A-”, etc., followed by coded letters/numbers.
- debug (bool):
Optional argument. Defaults to False. If set to True the function print some debug information.
Returns:
- Dict[str, Any]:
A mapping from feature names to their full descriptions.
- Possible keys include:
“Part of Speech”
“Case”, “Number”, “Gender”
“Tense”, “Voice”, “Mood”
“Verb Extra” or “Suffix”
“Warning”, warning related to feature elements
“Error” (e.g., if input is empty)
If the part of speech can not be determined, it returns {“Part of Speech”: “Unknown or Unsupported”}.
If tag_input is empty or whitespace, it returns {“Error”: “Please enter a parsing tag.”}.
Example:
morphkit.decode_tag("N-NSM") { "Part of Speech": "Noun", "Case": "Nominative", "Number": "Singular", "Gender": "Masculine", ... }
Note:
This function is an addapted version of the tool available at https://github.com/tonyjurg/Sandborg-Petersen-decoder.