Pronunciation Dictionary

class PronunciationDictionary(dictionary_data: dict, linked_user: User)

Represents a pronunciation dictionary. Can be created manually from stored IDs by using pronunciation_dictionary_from_ids.

download_dictionary(version_id: str | None = None) str

This function returns a PLS file for the specified version_id (or the latest).

Parameters:

version_id (str, Optional) – The specific dictionary version to download. Defaults to the latest.

Returns:

The PLS file as a string.

Return type:

str

get_rules(version_id: str | None = None) List[PronunciationRule]

This function returns the list of rules the specified version_id (or the latest).

Parameters:

version_id (str, Optional) – The specific dictionary version. Defaults to the latest.

Returns:

A list containing the rules.

Return type:

List[PronunciationRule]

add_rules(new_rules: PronunciationRule | List[PronunciationRule])

Adds new rules to the dictionary. :param new_rules: The rules to add. :type new_rules: PronunciationRule|List[PronunciationRule]

Returns:

The new versionID of the dictionary.

Return type:

str

remove_rules(rules_to_remove: PronunciationRule | List[PronunciationRule] | str | List[str])

Removes rules from the dictionary. :param rules_to_remove: The rules to remove, either as objects or by their string_to_replace. :type rules_to_remove: PronunciationRule|List[PronunciationRule]|str|List[str]

Returns:

The new versionID of the dictionary.

Return type:

str