mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2024-09-20 22:59:10 +03:00
23 lines
914 B
Python
23 lines
914 B
Python
'''
|
|
This file contains the Vocabulary class.
|
|
'''
|
|
class Vocabulary:
|
|
def __init__(self):
|
|
self.words = {
|
|
"happy": {
|
|
"synonyms": ["joyful", "delighted", "content"],
|
|
"antonyms": ["sad", "unhappy", "miserable"],
|
|
"examples": ["I am happy to see you.", "She is always happy."]
|
|
},
|
|
"beautiful": {
|
|
"synonyms": ["gorgeous", "stunning", "lovely"],
|
|
"antonyms": ["ugly", "hideous", "unattractive"],
|
|
"examples": ["The sunset looks beautiful.", "She is a beautiful person."]
|
|
},
|
|
# Add more words and their synonyms, antonyms, and examples here
|
|
}
|
|
def search(self, word):
|
|
if word in self.words:
|
|
return self.words[word]["synonyms"], self.words[word]["antonyms"], self.words[word]["examples"]
|
|
else:
|
|
return [], [], [] |