naming

Name utilities.

class deltona.naming.Mode(*values)

Bases: IntEnum

Mode to operate in.

Arabic

Arabic mode.

Chinese

Chinese mode.

English

English mode.

Japanese

Japanese mode.

deltona.naming.adjust_title(words: str, modes: Iterable[Mode] = (Mode.English,), names: dict[str, str] = ..., *, disable_names: bool = False, ampersands: bool = False) str

Adjust a string that represents a title.

Primarily for English to lowercase stop words, but also works for other languages. Some name rules are built-in but can also be passed in the names parameter.

It is far from perfect.

Parameters:
words : str

The string to adjust.

modes : Iterable[Mode]

The modes to operate in. Default is English.

names : Mapping[str, str]

A mapping of names to fix. The key is the name to fix, and the value is the fixed name. Default is a set of common names.

disable_names : bool

If True, do not fix names. Default is False.

ampersands : bool

If True, replace ' and ' with ' & '. Default is False.

Returns:

The adjusted string.

Return type:

str