From 73db792f7b1d6221c16725234211458f4a5d822b Mon Sep 17 00:00:00 2001 From: Bridget Nichols Date: Wed, 27 Mar 2019 14:38:20 -0700 Subject: [PATCH 1/2] Minor inconsistency fix --- PyDictionary/core.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index e63d8dc..cc66f00 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -94,8 +94,8 @@ def getAntonyms(self, formatted=True): return [self.antonym(term, formatted) for term in self.args] @staticmethod - def antonym(word, formatted=False): - if len(word.split()) > 1: + def antonym(term, formatted=False): + if len(term.split()) > 1: print("Error: A Term must be only a single word") else: try: @@ -110,7 +110,7 @@ def antonym(word, formatted=False): return {word: li} return li except: - print("{0} has no Antonyms in the API".format(word)) + print("{0} has no Antonyms in the API".format(term)) @staticmethod def meaning(term, disable_errors=False): From c14740b2edb7cbd06baf3711337860a861c8e4df Mon Sep 17 00:00:00 2001 From: Bridget Nichols Date: Wed, 27 Mar 2019 14:53:08 -0700 Subject: [PATCH 2/2] Minor inconsistency fix --- PyDictionary/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyDictionary/core.py b/PyDictionary/core.py index cc66f00..b19a1d2 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -99,7 +99,7 @@ def antonym(term, formatted=False): print("Error: A Term must be only a single word") else: try: - data = _get_soup_object("http://www.thesaurus.com/browse/{0}".format(word)) + data = _get_soup_object("http://www.thesaurus.com/browse/{0}".format(term)) terms = data.select("section.antonyms")[0].findAll("li") if len(terms) > 5: terms = terms[:5:] @@ -107,7 +107,7 @@ def antonym(term, formatted=False): for t in terms: li.append(t.select("span.text")[0].getText()) if formatted: - return {word: li} + return {term: li} return li except: print("{0} has no Antonyms in the API".format(term))