connections / README.md
T145's picture
Update README.md
dfaec1c verified
metadata
dataset_info:
  features:
    - name: level
      dtype: int64
    - name: level_id
      dtype: string
    - name: category
      dtype: string
    - name: words
      sequence: string
  splits:
    - name: train
      num_bytes: 55055
      num_examples: 711
  download_size: 32798
  dataset_size: 55055
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
license: mit
language:
  - en
pretty_name: NYT Connections Answers
size_categories:
  - n<1K

Made with the following script using a local copy of this website:

import re

from bs4 import BeautifulSoup
from datasets import Dataset

with open("Today’s NYT Connections Answers Jan 5, #574 - Daily Updates & Hints - Word Tips.htm", encoding="utf-8") as f:
    html = f.read()

soup = BeautifulSoup(html, "html.parser")
texts = re.findall(r'"([^"]*)"', "".join(soup.find_all("script")[9]))
texts = [" ".join(text.split()).replace(" ,", ", ") for text in texts if ":" in text and (text.startswith("🟡") or text.startswith("🟢") or text.startswith("🔵") or text.startswith("🟣"))]
levels = {
    "🟡": 1,
    "🟢": 2,
    "🔵": 3,
    "🟣": 4
}

def gen():
    for group in texts:
        level_id = group[:1]
        group = group[2:]
        category, group = group.split(":")
        entry = {
            "level": levels[level_id],
            "level_id": level_id,
            "category": category,
            "words": [word.strip() for word in group.split(",")]
        }
        #pprint(entry)
        yield entry

dataset = Dataset.from_generator(gen)
dataset.push_to_hub("T145/connections")