Files
lab_compression/text_codecs/mycodec.py
2026-04-02 12:16:24 -04:00

18 lines
393 B
Python

from register import register_codec
def encode(text):
text = text.lower()
result = ""
for char in text:
if char.isalpha() or char == " ":
if char not in "aeiou":
result += char
return result.encode("utf8")
def decode(data):
text = bytes(data).decode("utf8")
return text
register_codec(encode, decode, "mycodec")