# -*- coding: utf-8 -*- import argparse, sys from re import compile, sub replacements = [ (compile(r"(?:r|l)"), "w"), (compile(r"(?:R|L)"), "W"), (compile(r"n([aeiou])"), "ny\\1"), (compile(r"N([aeiou])"), "Ny\\1"), (compile(r"N([AEIOU])"), "NY\\1"), (compile(r"ove"), "uv"), ] def owo(text: str) -> str: for r in replacements: text = sub(r[0], r[1], text) return text def main(): parser = argparse.ArgumentParser("owo") parser.add_argument("-p", "--pipe", help="pipe text to owoify", action="store_true") parser.add_argument("text", help="owoify any text", type=str, nargs="?") args = parser.parse_args() if args.pipe: for line in sys.stdin: print(owo(line), end="") elif args.text: print(owo(args.text)) else: print(owo("No text provided")) parser.print_help() if __name__ == "__main__": main()