-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e8e96be
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
chat_list = [ | ||
{"question": "It’s time to get up", "answer": "Get up soon"}, | ||
{"question": "I usually sleep late on Saturdays", "answer": "Hurry up"}, | ||
{"question": "It’s still early", "answer": "Did the alarm go off"} | ||
] | ||
# to do continue | ||
|
||
def generate_dict(corpus): | ||
dictionary = None | ||
dictSet = set() | ||
for dict in corpus: | ||
questionArr = dict['question'].split() | ||
answerArr = dict['answer'].split() | ||
for word in questionArr: | ||
dictSet.add(word) | ||
for word in answerArr: | ||
dictSet.add(word) | ||
dictionary = list(dictSet) | ||
return dictionary | ||
|
||
STOP_WORDS = { | ||
"PAD": "<PAD>", | ||
"SOS": "<SOS>", | ||
"EOS": "<EOS>" | ||
} | ||
if __name__ == "__main__": | ||
dict = generate_dict(chat_list) | ||
for key in STOP_WORDS: | ||
dict.append(STOP_WORDS[key]) |