get_synonyms method
Leave feedback
On this page
Gets the synonyms for the specified word.
The case of the letters of the word is not taken into account.
def get_synonyms(self, word):
...
| Parameter | Type | Description |
|---|---|---|
| word | str |
The word to suggest the synonyms. |
Returns: list[str]: The synonyms for the specified word or an empty list if the SynonymDictionary object does not contain the specified word.
| Raises | Description |
|---|---|
ValueError |
When word is None. |
words = synonyms.get_synonyms("Make")
print("Synonyms for 'make':")
for w in words:
print(w)
These names call get_synonyms too, limited to the overloads listed.
| Alias | Accepts |
|---|---|
get_synonyms_file |
get_synonyms_file(word) |
get_synonyms_string |
get_synonyms_string(word) |
- class
SynonymDictionary
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.