File size: 1,654 Bytes
5219e89
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dfaec1c
 
 
 
 
 
5219e89
dfaec1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
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](https://word.tips/todays-nyt-connections-answers/):

```python
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")
```