added docstrings

This commit is contained in:
2026-01-31 12:21:50 -05:00
parent b3d0210d1a
commit ce8e65e626

View File

@@ -1,4 +1,7 @@
def parseWords(filename: str) -> Dict[str, List[int]]: def parseWords(filename: str) -> Dict[str, List[int]]:
"""
Primary function that reads the file and lists words
"""
words_dict: Dict[str, List[int]] = {} words_dict: Dict[str, List[int]] = {}
with open(filename, "r") as input_file: with open(filename, "r") as input_file:
@@ -24,6 +27,9 @@ def parseWords(filename: str) -> Dict[str, List[int]]:
return word_dict return word_dict
def histCaseSensitive(word_dict: Dict[str, List[int]]) -> None: def histCaseSensitive(word_dict: Dict[str, List[int]]) -> None:
"""
bar histogram for each word, not ignoring capitalization
"""
keys = list(word_dict.keys()) keys = list(word_dict.keys())
uppers = [word_dict[word][0] for word in keys] uppers = [word_dict[word][0] for word in keys]
@@ -34,6 +40,10 @@ def histCaseSensitive(word_dict: Dict[str, List[int]]) -> None:
def histCaseInsensitive(word_dict: Dict[str, List[int]]) -> None: def histCaseInsensitive(word_dict: Dict[str, List[int]]) -> None:
"""
bar histogram for each word, ignoring capitalization
"""
keys = list(word_dict.keys()) keys = list(word_dict.keys())
totals = [sum(word_dict[word]) for word in keys] totals = [sum(word_dict[word]) for word in keys]