17 lines
No EOL
514 B
Python
17 lines
No EOL
514 B
Python
from encoder import text_to_signal
|
|
from decoder import signal_to_text
|
|
from channel import channel
|
|
|
|
def test_local():
|
|
message = "This is the end of the PDC course. Good "
|
|
x, codebook = text_to_signal(message, r=9, Eb=5)
|
|
y = channel(x)
|
|
decoded = signal_to_text(y, codebook, r=9)
|
|
|
|
print(f"Original: {message}")
|
|
print(f"Decoded : {decoded}")
|
|
errors = sum(1 for a, b in zip(message, decoded) if a != b)
|
|
print(f"Character errors: {errors}/40")
|
|
|
|
if __name__ == "__main__":
|
|
test_local() |