|
from datasets import load_dataset |
|
|
|
|
|
def display_dataset_statistics(dataset): |
|
""" |
|
Display overall statistics about the dataset. |
|
|
|
Args: |
|
dataset: A HuggingFace Dataset object. |
|
""" |
|
print("\n" + "=" * 50) |
|
print(f"{'DATASET STATISTICS':^50}") |
|
print("=" * 50) |
|
|
|
print(f"\n📊 Number of entries: {len(dataset):,}") |
|
|
|
|
|
df = dataset.to_pandas() |
|
|
|
|
|
if "status" in df.columns: |
|
print("\n" + "-" * 30) |
|
print("📝 PRESENTATION TYPES") |
|
print("-" * 30) |
|
status_counts = df["status"].value_counts() |
|
for status, count in status_counts.items(): |
|
print(f" • {status}: {count:,} ({count / len(df) * 100:.1f}%)") |
|
|
|
|
|
if "venue" in df.columns: |
|
print("\n" + "-" * 30) |
|
print("🏢 VENUES") |
|
print("-" * 30) |
|
venue_counts = df["venue"].value_counts() |
|
for venue, count in venue_counts.items(): |
|
print(f" • {venue}: {count:,} ({count / len(df) * 100:.1f}%)") |
|
|
|
|
|
if "primary_area" in df.columns: |
|
print("\n" + "-" * 30) |
|
print("🔬 TOP 10 PRIMARY RESEARCH AREAS") |
|
print("-" * 30) |
|
area_counts = df["primary_area"].value_counts().head(10) |
|
for area, count in area_counts.items(): |
|
print(f" • {area}: {count:,} ({count / len(df) * 100:.1f}%)") |
|
|
|
|
|
def display_sample_entries(dataset, n=3): |
|
""" |
|
Display sample entries from the dataset. |
|
|
|
Args: |
|
dataset: A HuggingFace Dataset object. |
|
n: Number of samples to display. |
|
""" |
|
print("\n" + "=" * 50) |
|
print(f"{'SAMPLE ENTRIES':^50}") |
|
print("=" * 50) |
|
|
|
for i in range(min(n, len(dataset))): |
|
print(f"\n📄 SAMPLE {i + 1}") |
|
print("-" * 30) |
|
print(f"🎬 Video file: video/{dataset[i].get('video_file', 'N/A')}") |
|
print(f"📝 Title: {dataset[i].get('title', 'N/A')}") |
|
print(f"💡 TL;DR: {dataset[i].get('tldr', 'N/A')}") |
|
print(f"🔬 Primary area: {dataset[i].get('primary_area', 'N/A')}") |
|
print(f"🏷️ Keywords: {dataset[i].get('keywords', 'N/A')}") |
|
print("=" * 50) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
|
dataset = load_dataset("vivianchen98/LearningPaper24", data_files="metadata/catalog.jsonl", split="train") |
|
print(f"Successfully loaded LearningPaper24 dataset with {len(dataset)} entries.") |
|
|
|
|
|
display_dataset_statistics(dataset) |
|
|
|
|
|
display_sample_entries(dataset) |
|
|