as1605 / WordlePy

Python utilities to query and get stats from the loaded wordlist for NYTime's Wordle game https://www.nytimes.com/games/wordle/index.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

WordlePy

Python utilities to query and get stats from the loaded wordlist for NYTime's Wordle game

Files

  • wordlist.csv is scraped from the wordle source code's minified main.js file
  • wordle.py contains functions to load, query and get stats for a list of words. Can also use alias l, q, s
  • 245.ipynb shows an example how this code can be used to solve wordle

Example

import wordle as wd

L = wd.load("wordlist.csv") 
# or wd.load() or even wd.l()

print(wd.stats(L)) 
# or wd.s(L)

L1 = wd.query(L, contains = ['A','R'], not_contains=['I'], positions={4:'E'}, not_positions={2:'A'})
# or wd.q(...) 

print(L1)

print(wd.stats(L1))
{'A': 975, 'C': 475, 'B': 280, 'E': 1230, 'D': 393, 'G': 310, 'F': 229, 'I': 670, 'H': 387, 'K': 210, 'J': 27, 'M': 316, 'L': 716, 'O': 753, 'N': 573, 'Q': 29, 'P': 365, 'S': 668, 'R': 897, 'U': 466, 'T': 729, 'W': 194, 'V': 152, 'Y': 424, 'X': 37, 'Z': 40}
['ADORE', 'AGREE', 'ARGUE', 'AROSE', 'AZURE', 'BARGE', 'CARVE', 'FARCE', 'LARGE', 'PARSE', 'RANGE']
{'A': 11, 'C': 2, 'B': 1, 'E': 12, 'D': 1, 'G': 5, 'F': 1, 'I': 0, 'H': 0, 'K': 0, 'J': 0, 'M': 0, 'L': 1, 'O': 2, 'N': 1, 'Q': 0, 'P': 1, 'S': 2, 'R': 11, 'U': 2, 'T': 0, 'W': 0, 'V': 1, 'Y': 0, 'X': 0, 'Z': 1}

Results

Wordle 245 4/6

β¬›β¬›β¬›πŸŸ¨β¬›

β¬›β¬›β¬›πŸŸ¨πŸŸ©

β¬›β¬›πŸŸ¨β¬›β¬›

🟩🟩🟩🟩🟩

Wordle 246 3/6

πŸŸ¨πŸŸ¨β¬›β¬›β¬›

πŸŸ¨β¬›β¬›β¬›πŸŸ©

🟩🟩🟩🟩🟩

Wordle 247 4/6

β¬›β¬›β¬›β¬›πŸŸ¨

β¬›β¬›πŸŸ¨πŸŸ¨πŸŸ¨

πŸŸ¨πŸŸ¨β¬›πŸŸ©πŸŸ©

🟩🟩🟩🟩🟩

Wordle 248 3/6

⬛⬛⬛⬛⬛

β¬›πŸŸ¨πŸŸ©πŸŸ¨β¬›

🟩🟩🟩🟩🟩

Wordle 249 5/6

β¬›β¬›β¬›β¬›πŸŸ©

β¬›β¬›πŸŸ¨πŸŸ¨πŸŸ¨

⬛⬛⬛⬛⬛

β¬›πŸŸ©πŸŸ©πŸŸ¨πŸŸ©

🟩🟩🟩🟩🟩

Wordle 251 4/6

⬛⬛⬛⬛⬛

πŸŸ¨β¬›β¬›β¬›β¬›

β¬›β¬›πŸŸ¨β¬›β¬›

🟩🟩🟩🟩🟩

Wordle 252 4/6

πŸŸ©β¬›β¬›πŸŸ©β¬›

β¬›β¬›πŸŸ©β¬›β¬›

πŸŸ©β¬›πŸŸ©β¬›πŸŸ¨

🟩🟩🟩🟩🟩

Wordle 253 3/6

β¬›πŸŸ¨πŸŸ©β¬›β¬›

πŸŸ¨β¬›β¬›πŸŸ¨πŸŸ¨

🟩🟩🟩🟩🟩

Wordle 254 3/6

β¬›πŸŸ¨β¬›β¬›πŸŸ©

β¬›πŸŸ©β¬›β¬›πŸŸ¨

🟩🟩🟩🟩🟩

Wordle 256 3/6

πŸŸ¨β¬›πŸŸ¨β¬›β¬›

β¬›β¬›πŸŸ¨πŸŸ©πŸŸ©

🟩🟩🟩🟩🟩

Wordle 257 3/6

⬛⬛⬛⬛⬛

β¬›πŸŸ¨β¬›πŸŸ©πŸŸ¨

🟩🟩🟩🟩🟩

Wordle 258 4/6

β¬›β¬›πŸŸ¨β¬›πŸŸ¨

⬛⬛⬛⬛⬛

β¬›πŸŸ¨πŸŸ¨β¬›πŸŸ¨

🟩🟩🟩🟩🟩

Wordle 261 3/6

β¬›β¬›πŸŸ©β¬›β¬›

β¬›πŸŸ¨β¬›β¬›πŸŸ©

🟩🟩🟩🟩🟩

About

Python utilities to query and get stats from the loaded wordlist for NYTime's Wordle game https://www.nytimes.com/games/wordle/index.html


Languages

Language:Jupyter Notebook 98.6%Language:Python 1.4%