Download data/load_huffpost.py from AliAch/smart-feed: direct link, hf CLI and curl.
- Browser
- Download file 536 Bytes
-
https://huggingface.co/datasets/AliAch/smart-feed/resolve/main/data/load_huffpost.py
- Command line
-
hf download hf://datasets/AliAch/smart-feed/data/load_huffpost.py
-
curl -L -o load_huffpost.py https://huggingface.co/datasets/AliAch/smart-feed/resolve/main/data/load_huffpost.py
536 Bytes
| from datasets import load_dataset | |
| import pandas as pd | |
| # Load the test split specifically | |
| ds = load_dataset("khalidalt/HuffPost", split="test", trust_remote_code=True) | |
| df = ds.to_pandas() | |
| # Garder seulement les colonnes utiles | |
| df = df[["headline","short_description","category","date"]].dropna() | |
| df["text"] = df["headline"] + " " + df["short_description"] | |
| print(f"Loaded: {len(df)} articles, {df['category'].nunique()} categories") | |
| print(df["category"].value_counts().head(10)) | |
| df.to_parquet("data/raw/huffpost.parquet", index=False) |