Options
You could use
from sinophone import options as sinoptions
sinoptions.repr_lang = "wuu-Hant" # Wu Chinese in Traditional Sinographs
sinoptions.<option> = <value>
to set sinophone
package options.
To access objects in the submodule with the same name (which you would unlikely need to), use from sinophone.options import <object>
.
Interface for options
- sinophone.options = Options(color=True, _repr_lang='en-Latn', color_scheme={'Syllable': '\x1b[0;37;48m', 'Initial': '\x1b[0;31;48m', 'Final': '\x1b[0;33;48m', 'Medial': '\x1b[0;32;48m', 'Nucleus': '\x1b[0;36;48m', 'Coda': '\x1b[0;34;48m', 'Tone': '\x1b[0;35;48m', 'ExistentGrammatical': '\x1b[0;32;48m', 'NonexistentGrammatical': '\x1b[0;36;48m', 'ExistentUngrammatical': '\x1b[0;33;48m', 'NonexistentUngrammatical': '\x1b[0;31;48m', 'SinophoneWarning': '\x1b[0;33;48m'})
Options(color: bool = True, _repr_lang: str = ‘en-Latn’, color_scheme: Dict[str, str] = <factory>)
Abbreviation of
sinophone.options.options
.
Default values used in options
- class sinophone.options.AnsiColors
Bases:
object
ANSI colors and styles.
- class sinophone.options.LanguageCode
Bases:
object
Accepted languages codes with (partial) translations.
- class sinophone.options.Options(color: bool = True, _repr_lang: str = 'en-Latn', color_scheme: Dict[str, str] = <factory>)
Bases:
object
- Parameters
color (bool) –
_repr_lang (str) –
color_scheme (Dict[str, str]) –
- color: bool = True
Whether to use ANSI colors in the
__repr__
of supported classes.
- color_scheme: Dict[str, str]
Which color scheme to use in
__repr__
of supported classes.
- property repr_lang: str
Which language to use in
__repr__
of supported classes.
- sinophone.options.RAINBOW_COLOR_SCHEME: Dict[str, str] = {'Coda': '\x1b[0;34;48m', 'ExistentGrammatical': '\x1b[0;32;48m', 'ExistentUngrammatical': '\x1b[0;33;48m', 'Final': '\x1b[0;33;48m', 'Initial': '\x1b[0;31;48m', 'Medial': '\x1b[0;32;48m', 'NonexistentGrammatical': '\x1b[0;36;48m', 'NonexistentUngrammatical': '\x1b[0;31;48m', 'Nucleus': '\x1b[0;36;48m', 'SinophoneWarning': '\x1b[0;33;48m', 'Syllable': '\x1b[0;37;48m', 'Tone': '\x1b[0;35;48m'}
The default color scheme.