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)
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)
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')
def map_hey_to_hay(input: Word) -> Word: return input.replace(HEY_TO_HAY, '\\1ay')
def map_over_to_owor(input: Word) -> Word: return input.replace(OVER_TO_OWOR, '\\1wor')
def map_you_to_u(input: Word) -> Word: return input.replace(YOU_TO_U_UPPER, 'U') \ .replace(YOU_TO_U_LOWER, 'u')
def map_haha_to_hehe_xd(input: Word) -> Word: return input.replace(HAHA_TO_HEHE_XD, 'hehe xD')
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')
def map_ver_to_wer(input: Word) -> Word: return input.replace(VER_TO_WER, 'wer')
def map_fi_to_fwi(input: Word) -> Word: return input.replace(FI_TO_FWI_LOWER, '\\1wi') \ .replace(FI_TO_FWI_UPPER, 'FWI')
def map_v_or_w_le_to_wal(input: Word) -> Word: return input.replace(VORW_LE_TO_WAL, 'wal')
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)
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')
def map_ol_to_owl(input: Word) -> Word: return input.replace(OL_TO_OWL_LOWER, '\\1wl') \ .replace(OL_TO_OWL_UPPER, 'OWL')
def map_old_to_owld(input: Word) -> Word: return input.replace(OLD_TO_OWLD_LOWER, '\\1wld') \ .replace(OLD_TO_OWLD_UPPER, 'OWLD')
def map_mom_to_mwom(input: Word) -> Word: return input.replace(MOM_TO_MWOM, '\\1wom')
def map_me_to_mwe(input: Word) -> Word: return input.replace(ME_TO_MWE, '\\1we')
def map_poi_to_pwoi(input: Word) -> Word: return input.replace(POI_TO_PWOI, '\\1woi')
def map_ove_to_uv(input: Word) -> Word: return input.replace(OVE_TO_UV_LOWER, 'uv') \ .replace(OVE_TO_UV_UPPER, 'UV')
def map_specific_consonants_le_to_letter_and_wal(input: Word) -> Word: return input.replace(SPECIFIC_CONSONANTS_LE_TO_LETTER_AND_WAL, '\\1wal')
def map_the_to_teh(input: Word) -> Word: return input.replace(THE_TO_TEH, '\\1eh')
def map_consonant_r_to_consonant_w(input: Word) -> Word: return input.replace(CONSONANT_R_TO_CONSONANT_W, '\\1w')
def map_time_to_tim(input: Word) -> Word: return input.replace(TIME_TO_TIM, '\\1im')
def map_ly_to_wy(input: Word) -> Word: return input.replace(LY_TO_WY_LOWER, 'wy') \ .replace(LY_TO_WY_UPPER, 'Wy')
def map_worse_to_wose(input: Word) -> Word: return input.replace(WORSE_TO_WOSE, '\\1ose')
def map_ple_to_pwe(input: Word) -> Word: return input.replace(PLE_TO_PWE, '\\1we')
def map_ew_to_uwu(input: Word) -> Word: return input.replace(EW_TO_UWU, 'uwu')
def map_nr_to_nw(input: Word) -> Word: return input.replace(NR_TO_NW_LOWER, 'nw') \ .replace(NR_TO_NW_UPPER, 'NW')
def map_dead_to_ded(input: Word) -> Word: return input.replace(DEAD_TO_DED_UPPER, 'Ded') \ .replace(DEAD_TO_DED_LOWER, 'ded')
def map_fuc_to_fwuc(input: Word) -> Word: return input.replace(FUC_TO_FWUC, '\\1wuc')