import ast
from math import log2
import os
from statistics import mean, pstdev
import sys

import click
import numpy as np
from scipy.special import kl_div

from matplotlib import pyplot as plt


def reader(path):
    with open(path) as h:
        for line in h:
            line = line.strip()
            yield line.split()


@click.command()
@click.argument("original")
@click.argument("compressed")
def main(original, compressed):
    ratio = 0
    total = 0
    for o, c in zip(reader(original), reader(compressed)):
        ratio += len(c)/len(o)
        total += 1
    print(f"cr: {ratio/total:.4f}")


if __name__ == "__main__":
    main()
