-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfor_sad_conversations.py
More file actions
38 lines (37 loc) · 1.19 KB
/
for_sad_conversations.py
File metadata and controls
38 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# import random
# from transformers import pipeline
# import warnings
# import json
# # from sentiment_anal import sentence
#
# print("loading model")
# classifier = pipeline("zero-shot-classification", model="facebook/bart-large-mnli", device=0)
# print("at intents ")
# intents = [
# "self_doubt", "peace_restlessness", "bad_times", "dharma",
# "fear", "fear_of_rejection", "control_mind", "stop_negative_thoughts",
# "overthinking", "duty", "procrastination", "positive_thinking", "happiness", "anger"
# , "facing_difficult_times"
# ]
#
# print("getting predefined intents ")
#
#
# def get_intents(user_input, classifier, intents):
# results = classifier(user_input, candidate_labels=intents)
# return results['labels'][0]
#
#
#
# from sentiment_anal import sentence
# print(sentence)
# warnings.simplefilter("ignore")
# # user_input = input("enter here..")
# # from sentiment_anal import sentence
# detected_input = get_intents(sentence, classifier, intents)
# print("intents class....", detected_input)
# # a="self_doubt"
# with open("krishna_arjuna_conversations.json", "r") as file:
# data = json.load(file)
# print(type(data))
# print(data[detected_input][random.randint(0, 2)])