added docstrings
This commit is contained in:
@@ -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]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user