File size: 2,600 Bytes
72192dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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):,}")

    # Convert to pandas for easier analysis
    df = dataset.to_pandas()

    # Count presentation types
    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}%)")

    # Count venues
    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}%)")

    # Count primary research areas
    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__":
    # Load the dataset
    dataset = load_dataset("vivianchen98/LearningPaper24", data_files="metadata/catalog.jsonl", split="train")
    print(f"Successfully loaded LearningPaper24 dataset with {len(dataset)} entries.")

    # Display statistics
    display_dataset_statistics(dataset)

    # Display sample entries
    display_sample_entries(dataset)