2024-04-19 12:36:57 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import argparse, sys
|
2024-04-19 21:26:11 +00:00
|
|
|
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
|
2024-04-19 12:36:57 +00:00
|
|
|
|
|
|
|
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()
|