-
Notifications
You must be signed in to change notification settings - Fork 2
/
main2.py
99 lines (77 loc) · 2.92 KB
/
main2.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# Fields for our DF
indeed_spec = ['Company', 'job', 'link', 'Salary', 'Job_Posted_Date']
data = pd.read_csv('Work Styles(csv).csv', encoding='latin-1')
# To display the DataFrame before dropping the specified columns
# Drop the specified columns using iloc
data = data.drop(data.columns[[0, 2, 4, 5] + list(range(7, 14))], axis=1)
# To display the DataFrame after dropping the specified columns
print("DataFrame after dropping the specified columns:")
print(data)
introvert_extrovert_tags= {"Independent":"Introvert",
"Cooperative": "Extrovert",
"Social Orientation": "Extrovert"}
routine_spontaneous_tags= {"Persistence": "Routine",
"Stress Tolerance": "Spontaneous",
"Adaptability/Flexibility": "Spontaneous"}
leader_follower_tags= {"Initiative": "Leader",
"Leadership": "Leader",
"Self-Control": "Follower"}
creative_analytical_tag={"Innovation":"Creative",
"Analytical Thinking":"Analytical"}
purpose_money_tags= {"Concern for Others":"Purpose",
"Dependability":"Purpose",
"Attention to Detail":"Money",
"Achievement/Effort": "Money"}
list_of_
words_to_test = {"Independent", "Cooperative", "Social-Orientation", "Persistence", "Stress", "Tolerance", "Adaptability" ,"Flexibility", "Initiative", "Leadership", "Self-Control", "Innovation", "Analytical Thinking", "Concern for Others", "Dependability", "Attention to Detail","Achievement","Effort" }
print(len(words_to_test))
#finding the synonyms:
def synonym_antonym_extractor(phrase):
synonyms = []
antonyms = []
for word in nltk.word_tokenize(phrase):
for syn in wordnet.synsets(word):
for l in syn.lemmas():
synonyms.append(l.name())
if l.antonyms():
antonyms.append(l.antonyms()[0].name())
return set(synonyms)
# print(set(synonyms))
# print(set(antonyms))
words_and_their_synonyms = {}
for word in words_to_test:
words_and_their_synonyms[word] = synonym_antonym_extractor(word)
#
#
# print(words_and_their_synonyms)
#
#
# #Feature Engineering
#
#
# #Model Selection
#
#
# #Training the Model
#
# #Evaluation and Validation
#
#
# #Iterative Improvement
#
#
# #Deployment and Integration
#
#
# #create a dictionary with keys and a list of values from above "indeed_posts"
#
#
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Who won the world series in 2020?"},
{"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
{"role": "user", "content": "Where was it played?"}
]
)