| 13 | |
| 14 | |
| 15 | def read_scores(path: Path, auto_column: str, human_column: str) -> List[Tuple[float, float]]: |
| 16 | rows: List[Tuple[float, float]] = [] |
| 17 | with path.open("r", encoding="utf-8-sig", newline="") as handle: |
| 18 | reader = csv.DictReader(handle) |
| 19 | for item in reader: |
| 20 | auto_raw = str(item.get(auto_column, "")).strip() |
| 21 | human_raw = str(item.get(human_column, "")).strip() |
| 22 | if not auto_raw or not human_raw: |
| 23 | continue |
| 24 | rows.append((float(auto_raw), float(human_raw))) |
| 25 | return rows |
| 26 | |
| 27 | |
| 28 | def pearson(pairs: Iterable[Tuple[float, float]]) -> float: |