Skip to content
This repository has been archived by the owner on Oct 21, 2024. It is now read-only.

FIX: Correct handling of unused 'subset' parameter in fasttext_filter (#54) #55

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dataverse/etl/quality/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ def load_fasttext(
return _FastText(model_path=str(fasttext_path))


def language_predict_fasttext(row, model, top_k: int = 1, score_rounding: int = 2):
text = row["text"].replace("\n", "")
def language_predict_fasttext(row, subset, model, top_k: int = 1, score_rounding: int = 2):
text = row[subset].replace("\n", "")
labels, scores = model.predict(text, k=top_k)
labels = [label.replace("__label__", "") for label in labels]

Expand Down Expand Up @@ -135,6 +135,7 @@ def quality___language___fasttext_filter(
data = data.mapPartitions(
functools.partial(
language_predict_fasttext_by_partition,
subset=subset,
top_k=top_k,
score_rounding=score_rounding,
)
Expand Down