diff --git a/PyDictionary/core.py b/PyDictionary/core.py index e63d8dc..b19a1d2 100644 --- a/PyDictionary/core.py +++ b/PyDictionary/core.py @@ -94,12 +94,12 @@ 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: - 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,10 +107,10 @@ def antonym(word, 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(word)) + print("{0} has no Antonyms in the API".format(term)) @staticmethod def meaning(term, disable_errors=False):