forked from amitKr85/project_student_allocation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_skill_set_2.py
63 lines (51 loc) · 1.7 KB
/
make_skill_set_2.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
from nltk.stem import WordNetLemmatizer
import pickle
lemmatizer = WordNetLemmatizer()
# def make_skill_dict():
# topics = open("test_files/finalDict.txt","r").read().split('\n\n')
#
# # print(len(lines))
# skill_dict = {}
#
# for topic in topics:
# par_skill = ''
# for i,line in enumerate(topic.split('\n')):
# if i == 0:
# par_skill = lemmatizer.lemmatize(line.strip().lower())
# # print("topic:",par_skill)
# else:
# line = lemmatizer.lemmatize(line.strip().lower())
# if line in skill_dict:
# skill_dict[line].add(par_skill)
# else:
# skill_dict[line] = {par_skill}
# # print("skill:",line)
# # print()
#
# print("printing dict.......")
# for key in skill_dict:
# print(str(key).ljust(40) + str(skill_dict[key]).rjust(40))
#
# pick_file = open("pickled_data/final_skill_dict_2.pickle","wb")
# pickle.dump(skill_dict,pick_file)
# pick_file.close()
#
# return skill_dict
def load_skill_set():
skill_dict = dict()
pick_file = open("pickled_data/final_skill_dict_2.pickle", "rb")
skill_dict = pickle.load(pick_file)
pick_file.close()
return skill_dict
def get_skill(skill_dic,topic):
topic = lemmatizer.lemmatize(topic.strip().lower())
if topic in skill_dic:
return skill_dic[topic]
else:
return None
# skill_dict = make_skill_dict()
skill_dict = load_skill_set()
print(get_skill(skill_dict,'Sales Strategy'))
# while True:
# inp = input("topic:")
# print(get_skill(skill_dict,inp))