#!/usr/bin/env python3 import argparse from pathlib import Path import pandas as pd import csv from Levenshtein import distance as levendist argparser = argparse.ArgumentParser( description="Distance evaluation" ) argparser.add_argument( "vp_dir", help="Directory containing merged.csv" ) args = argparser.parse_args() vp_path = Path(args.vp_dir) df = pd.read_csv(vp_path / "merged.csv") df["levenshtein-distance"] = df.apply( lambda row: levendist(str(row.url), str(row.log_url)), axis=1 ) df.to_csv(vp_path / "metrics.csv", quoting=csv.QUOTE_NONNUMERIC)