<jupyter_start><jupyter_text>Preparation to class 4: Examine datasets<jupyter_code>from datasets import load_dataset

# load the sst2 dataset
dataset = load_dataset("glue", "sst2")

# select the train split
train = dataset["train"]
print("Examining train set:")
print(train)
print(train.features)
print("Information about the dataset:")
print(train.info.description)
print("Homepage")
print(train.info.homepage)
print("Examining sentence")
print(type(train["sentence"]))
print(type(train["sentence"][0]))
print("Examining label")
print(type(train["label"]))
print(type(train["label"][0]))
# set takes all the unique values
print(set(train["label"]))
print("A few samples:")
for t in range(10):
    sent = train["sentence"][t]
    lab = train["label"][t]
    print(sent, "-",  lab)<jupyter_output>A few samples:
hide new secretions from the parental units  - 0
contains no wit , only labored gags  - 0
that loves its characters and communicates something rather beautiful about human nature  - 1
remains utterly satisfied to remain the same throughout  - 0
on the worst revenge-of-the-nerds clichés the filmmakers could dredge up  - 0
that 's far too tragic to merit such superficial treatment  - 0
demonstrates that the director of such hollywood blockbusters as patriot games can still turn out a small , personal film with an emotional wallop .  - 1
of saucy  - 1
a depressed fifteen-year-old 's suicidal poetry  - 0
are more deeply thought through than in most ` right-thinking ' films  - 1
{'fraction_non_alphanumeric': 0.10515740120562625, 'fraction_numerical': 0.011386470194239785, 'mean_word_length': 5.2510460251046025, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '651757', 'license': 'MIT', 'n_tokens_mistral': 470, 'n_tokens_neox': 437, 'n_words': 168, 'path': 'syllabus/classes/class4/examine_datasets.ipynb', 'repo_name': 'saraoe/NLP-E21', 'size': '1493'}