ainconv package#

Submodules#

Module contents#

class ainconv.Script(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

An enumeration of the possible script types for the Ainu language.

Cyrl = 'Cyrl'#

The Latin script.

Kana = 'Kana'#

The Cyrillic script.

Latn = 'Latn'#

A mixed script.

Mixed = 'Mixed'#

An unknown script.

Unknown = 'Unknown'#
ainconv.cyrl2kana(cyrl: str, **kwargs) str#

Converts Cyrillic script to Katakana script.

See also

latn2kana for kwargs.

ainconv.cyrl2latn(text: str) str#

Converts Cyrillic script to Latin script.

ainconv.detect(text: str) Script#

Detects the script type of a given Ainu language string.

This function categorizes the script into one of several types based on the characters present in the string.

It supports Latin, Cyrillic, Katakana scripts, and can also identify mixed or unknown scripts.

Parameters:

text (str) – The text string to be analyzed for script type.

Returns:

The detected script type:

Kana for Katakana Cyrl for Cyrillic Latn for Latin Mixed if multiple scripts are detected Unknown if no script is detected

Return type:

Script

ainconv.kana2cyrl(kana: str) str#

Converts Katakana script to Cyrillic script.

ainconv.kana2latn(kana: str) str#

Converts Katakana script to Latin script.

ainconv.latn2cyrl(text: str) str#

Converts Latin script to Cyrillic script.

ainconv.latn2kana(text: str, use_wi: bool = False, use_we: bool = False, use_wo: bool = False, use_small_i: bool = False, use_small_u: bool = False, use_small_n: bool = False) str#

Converts Latin script to Katakana script.

Parameters:
  • text (str) – The Latin script to be converted.

  • use_wi (bool) – Whether to use “ヰ” (wi) instead of “ウィ” (wi), e.g. “wiki” -> “ヰキ” instead of “ウィキ”.

  • use_we (bool) – Whether to use “ヱ” (we) instead of “ウェ” (we), e.g. “weni” -> “ヱニ” instead of “ウェニ”.

  • use_wo (bool) – Whether to use “ヲ” (wo) instead of “ウォ” (wo). e.g. “wóse” -> “ヲセ” instead of “ウォセ”.

  • use_small_i (bool) – Whether to use “ィ” (y) instead of “イ” for -y, e.g. “kay” -> “カィ” instead of “カイ”.

  • use_small_u (bool) – Whether to use “ゥ” (w) instead of “ウ” for -w, e.g. “kew” -> “ケゥ” instead of “ケウ”.

  • use_small_n (bool) – Whether to use “ン” (n) instead of “ㇴ” for -n, e.g. “mun” -> “ムン” instead of “ムㇴ”.

Returns:

The converted Katakana script.

Return type:

str

ainconv.separate(text: str) list[str]#

Separate a romanized Ainu word into syllables.

Parameters:

text (str) – A string that holds the romanized Ainu word.

Returns:

A list of syllables.

Return type:

str