Example #1
0
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)
Example #2
0
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)
Example #3
0
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')
Example #4
0
def map_hey_to_hay(input: Word) -> Word:
    return input.replace(HEY_TO_HAY, '\\1ay')
Example #5
0
def map_over_to_owor(input: Word) -> Word:
    return input.replace(OVER_TO_OWOR, '\\1wor')
Example #6
0
def map_you_to_u(input: Word) -> Word:
    return input.replace(YOU_TO_U_UPPER, 'U') \
        .replace(YOU_TO_U_LOWER, 'u')
Example #7
0
def map_haha_to_hehe_xd(input: Word) -> Word:
    return input.replace(HAHA_TO_HEHE_XD, 'hehe xD')
Example #8
0
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')
Example #9
0
def map_ver_to_wer(input: Word) -> Word:
    return input.replace(VER_TO_WER, 'wer')
Example #10
0
def map_fi_to_fwi(input: Word) -> Word:
    return input.replace(FI_TO_FWI_LOWER, '\\1wi') \
        .replace(FI_TO_FWI_UPPER, 'FWI')
Example #11
0
def map_v_or_w_le_to_wal(input: Word) -> Word:
    return input.replace(VORW_LE_TO_WAL, 'wal')
Example #12
0
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)
Example #13
0
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')
Example #14
0
def map_ol_to_owl(input: Word) -> Word:
    return input.replace(OL_TO_OWL_LOWER, '\\1wl') \
        .replace(OL_TO_OWL_UPPER, 'OWL')
Example #15
0
def map_old_to_owld(input: Word) -> Word:
    return input.replace(OLD_TO_OWLD_LOWER, '\\1wld') \
        .replace(OLD_TO_OWLD_UPPER, 'OWLD')
Example #16
0
def map_mom_to_mwom(input: Word) -> Word:
    return input.replace(MOM_TO_MWOM, '\\1wom')
Example #17
0
def map_me_to_mwe(input: Word) -> Word:
    return input.replace(ME_TO_MWE, '\\1we')
Example #18
0
def map_poi_to_pwoi(input: Word) -> Word:
    return input.replace(POI_TO_PWOI, '\\1woi')
Example #19
0
def map_ove_to_uv(input: Word) -> Word:
    return input.replace(OVE_TO_UV_LOWER, 'uv') \
        .replace(OVE_TO_UV_UPPER, 'UV')
Example #20
0
def map_specific_consonants_le_to_letter_and_wal(input: Word) -> Word:
    return input.replace(SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL, '\\1wal')
Example #21
0
def map_the_to_teh(input: Word) -> Word:
    return input.replace(THE_TO_TEH, '\\1eh')
Example #22
0
def map_consonant_r_to_consonant_w(input: Word) -> Word:
    return input.replace(CONSONANT_R_TO_CONSONANT_W, '\\1w')
Example #23
0
def map_time_to_tim(input: Word) -> Word:
    return input.replace(TIME_TO_TIM, '\\1im')
Example #24
0
def map_ly_to_wy(input: Word) -> Word:
    return input.replace(LY_TO_WY_LOWER, 'wy') \
        .replace(LY_TO_WY_UPPER, 'Wy')
Example #25
0
def map_worse_to_wose(input: Word) -> Word:
    return input.replace(WORSE_TO_WOSE, '\\1ose')
Example #26
0
def map_ple_to_pwe(input: Word) -> Word:
    return input.replace(PLE_TO_PWE, '\\1we')
Example #27
0
def map_ew_to_uwu(input: Word) -> Word:
    return input.replace(EW_TO_UWU, 'uwu')
Example #28
0
def map_nr_to_nw(input: Word) -> Word:
    return input.replace(NR_TO_NW_LOWER, 'nw') \
        .replace(NR_TO_NW_UPPER, 'NW')
Example #29
0
def map_dead_to_ded(input: Word) -> Word:
    return input.replace(DEAD_TO_DED_UPPER, 'Ded') \
        .replace(DEAD_TO_DED_LOWER, 'ded')
Example #30
0
def map_fuc_to_fwuc(input: Word) -> Word:
    return input.replace(FUC_TO_FWUC, '\\1wuc')