コード例 #1
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_o_to_owo(input: Word) -> Word:
    replacement: str
    if random.randint(0, 2) > 0:
        replacement = 'owo'
    else:
        replacement = 'o'
    return input.replace(O_TO_OWO, replacement)
コード例 #2
0
ファイル: owoify.py プロジェクト: deadshot465/owoify-py
def owoify(source: str, level: str = 'owo') -> str:
    """
    The main entry point of owoify. Pass the source string and the desired level of owoness to owoify it.
    :exception RuntimeError: When the inputted owoness level is incorrect.
    :param source: The source string to owoify.
    :param level: The owoness to apply to the string. Available options are: `owo`, `uwu`, `uvu` (from low to high).
    :return: The owoified string.
    """
    word_matches = WORD_REGEX.findall(source)
    space_matches = SPACE_REGEX.findall(source)

    words = [Word(s) for s in word_matches]
    spaces = [Word(s) for s in space_matches]

    words = list(map(lambda w: map_owoify_levels(w, level), words))

    result = interleave_arrays(words, spaces)
    result_strings = list(map(lambda w: str(w), result))
    return ''.join(result_strings)
コード例 #3
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_vowel_or_r_except_o_l_to_wl(input: Word) -> Word:
    return input.replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_LOWER, 'wl') \
        .replace(VOWEL_OR_R_EXCEPT_O_L_TO_WL_UPPER, 'W\\1')
コード例 #4
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_hey_to_hay(input: Word) -> Word:
    return input.replace(HEY_TO_HAY, '\\1ay')
コード例 #5
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_over_to_owor(input: Word) -> Word:
    return input.replace(OVER_TO_OWOR, '\\1wor')
コード例 #6
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_you_to_u(input: Word) -> Word:
    return input.replace(YOU_TO_U_UPPER, 'U') \
        .replace(YOU_TO_U_LOWER, 'u')
コード例 #7
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_haha_to_hehe_xd(input: Word) -> Word:
    return input.replace(HAHA_TO_HEHE_XD, 'hehe xD')
コード例 #8
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_n_vowel_to_ny(input: Word) -> Word:
    return input.replace(N_VOWEL_TO_NY_FIRST, 'ny\\1') \
        .replace(N_VOWEL_TO_NY_SECOND, 'Ny\\1') \
        .replace(N_VOWEL_TO_NY_THIRD, 'NY\\1')
コード例 #9
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ver_to_wer(input: Word) -> Word:
    return input.replace(VER_TO_WER, 'wer')
コード例 #10
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_fi_to_fwi(input: Word) -> Word:
    return input.replace(FI_TO_FWI_LOWER, '\\1wi') \
        .replace(FI_TO_FWI_UPPER, 'FWI')
コード例 #11
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_v_or_w_le_to_wal(input: Word) -> Word:
    return input.replace(VORW_LE_TO_WAL, 'wal')
コード例 #12
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_specific_consonants_o_to_letter_and_wo(input: Word) -> Word:
    return input.replace(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_LOWER, '\\1wo') \
        .replace_with_func_multiple(SPECIFIC_CONSONANTS_O_TO_LETTER_AND_WO_UPPER, mapping_function_1)
コード例 #13
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_l_or_r_o_to_wo(input: Word) -> Word:
    return input.replace(LORR_O_TO_WO_LOWER, 'wo') \
        .replace(LORR_O_TO_WO_UPPER, 'W\\1')
コード例 #14
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ol_to_owl(input: Word) -> Word:
    return input.replace(OL_TO_OWL_LOWER, '\\1wl') \
        .replace(OL_TO_OWL_UPPER, 'OWL')
コード例 #15
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_old_to_owld(input: Word) -> Word:
    return input.replace(OLD_TO_OWLD_LOWER, '\\1wld') \
        .replace(OLD_TO_OWLD_UPPER, 'OWLD')
コード例 #16
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_mom_to_mwom(input: Word) -> Word:
    return input.replace(MOM_TO_MWOM, '\\1wom')
コード例 #17
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_me_to_mwe(input: Word) -> Word:
    return input.replace(ME_TO_MWE, '\\1we')
コード例 #18
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_poi_to_pwoi(input: Word) -> Word:
    return input.replace(POI_TO_PWOI, '\\1woi')
コード例 #19
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ove_to_uv(input: Word) -> Word:
    return input.replace(OVE_TO_UV_LOWER, 'uv') \
        .replace(OVE_TO_UV_UPPER, 'UV')
コード例 #20
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_specific_consonants_le_to_letter_and_wal(input: Word) -> Word:
    return input.replace(SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL, '\\1wal')
コード例 #21
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_the_to_teh(input: Word) -> Word:
    return input.replace(THE_TO_TEH, '\\1eh')
コード例 #22
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_consonant_r_to_consonant_w(input: Word) -> Word:
    return input.replace(CONSONANT_R_TO_CONSONANT_W, '\\1w')
コード例 #23
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_time_to_tim(input: Word) -> Word:
    return input.replace(TIME_TO_TIM, '\\1im')
コード例 #24
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ly_to_wy(input: Word) -> Word:
    return input.replace(LY_TO_WY_LOWER, 'wy') \
        .replace(LY_TO_WY_UPPER, 'Wy')
コード例 #25
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_worse_to_wose(input: Word) -> Word:
    return input.replace(WORSE_TO_WOSE, '\\1ose')
コード例 #26
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ple_to_pwe(input: Word) -> Word:
    return input.replace(PLE_TO_PWE, '\\1we')
コード例 #27
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_ew_to_uwu(input: Word) -> Word:
    return input.replace(EW_TO_UWU, 'uwu')
コード例 #28
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_nr_to_nw(input: Word) -> Word:
    return input.replace(NR_TO_NW_LOWER, 'nw') \
        .replace(NR_TO_NW_UPPER, 'NW')
コード例 #29
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_dead_to_ded(input: Word) -> Word:
    return input.replace(DEAD_TO_DED_UPPER, 'Ded') \
        .replace(DEAD_TO_DED_LOWER, 'ded')
コード例 #30
0
ファイル: mapping.py プロジェクト: deadshot465/owoify-py
def map_fuc_to_fwuc(input: Word) -> Word:
    return input.replace(FUC_TO_FWUC, '\\1wuc')