europarl-scandinavian / src /filter_alignment.py
kardosdrur's picture
Added source files
9c5a8e0
raw
history blame
543 Bytes
"""Filters the alignment by removing all ids that occur multiple times."""
import polars as pl
alignment = pl.read_parquet("alignment.parquet")
# Selecting entries without hash collisions
good_da_ids = (
alignment["da_id"].value_counts().filter(pl.col("counts") == 1)["da_id"]
)
good_sv_ids = (
alignment["sv_id"].value_counts().filter(pl.col("counts") == 1)["sv_id"]
)
alignment = alignment.filter(
pl.col("da_id").is_in(good_da_ids), pl.col("sv_id").is_in(good_sv_ids)
)
alignment.write_parquet("filtered_alignment.parquet")