forked from OpenBMB/ChatDev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvocabulary.py
23 lines (23 loc) · 914 Bytes
/
vocabulary.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
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 [], [], []