Spaces:
Sleeping
Sleeping
KAI MAURIN-JONES
commited on
Commit
•
5d7f498
1
Parent(s):
f69e23e
reverting to working version
Browse files- wordle_functions.py +4 -6
wordle_functions.py
CHANGED
@@ -7,20 +7,18 @@ import pandas as pd
|
|
7 |
|
8 |
english_alphabet = "abcdefghijklmnopqrstuvwxyz"
|
9 |
|
10 |
-
def get_letter_counts(
|
11 |
"""
|
12 |
Given a passed str of letters and a list of words, produces a frequency distribution of all letters
|
13 |
|
14 |
Parameters:
|
15 |
------
|
16 |
-
`word_list`: list
|
17 |
-
list of words (str) from which word frequencies will be counted
|
18 |
`letters`: str
|
19 |
a string of letters to be counted. String must only be desired letters, with no spaces. Default is local variable containing all letters of the English alphabet
|
|
|
|
|
20 |
`sort`: str
|
21 |
-
if either "descending" or "ascending" are passed, returned list of tuples will be sorted
|
22 |
-
`unique`: bool
|
23 |
-
if True, only unique letters in a word are counted. That means that words with more unique letters are rated more highly than any words with duplicate letters
|
24 |
|
25 |
Returns:
|
26 |
------
|
|
|
7 |
|
8 |
english_alphabet = "abcdefghijklmnopqrstuvwxyz"
|
9 |
|
10 |
+
def get_letter_counts(letters: str, word_list: list, sort: str = "descending"):
|
11 |
"""
|
12 |
Given a passed str of letters and a list of words, produces a frequency distribution of all letters
|
13 |
|
14 |
Parameters:
|
15 |
------
|
|
|
|
|
16 |
`letters`: str
|
17 |
a string of letters to be counted. String must only be desired letters, with no spaces. Default is local variable containing all letters of the English alphabet
|
18 |
+
`word_list`: list
|
19 |
+
list of words (str) from which word frequencies will be counted
|
20 |
`sort`: str
|
21 |
+
if either "descending" or "ascending" are passed, returned list of tuples will be sorted accoringly, else returned dictionary will be unsorted
|
|
|
|
|
22 |
|
23 |
Returns:
|
24 |
------
|