Commit 1f87ec70 by 柴鹏飞

补充专家画像特征emb

parent 20d378e5
......@@ -182,6 +182,43 @@ class TagGoodAtDirectionProfile(BaseProfile):
return ret
class CateGoodAtProfile(BaseProfile):
"""
cate_good_at 擅长标签
"""
def __init__(self) -> None:
super().__init__()
self.dim = 8
self.cate_list = ['婚姻家庭', '人际关系', '个人成长', '情绪压力', '恋爱情感', '亲子教育', '心理健康', '职场发展']
def convert(self, value):
ret = [0] * self.dim
try:
value = json.loads(value)
except Exception:
return ret
for item in value:
try:
i = self.cate_list.index(item['cate_name'])
ret[i] = min(item['sort_score'], 60) / 60
except:
pass
return ret
def inconvert(self, embedding):
ret = []
for idx, val in enumerate(embedding):
ret.append({
'cate_name': self.cate_list[idx],
'sort_score': val,
})
return ret
class TagGoodAtSubclassProfile(BaseProfile):
"""
tag_good_at_** 咨询师擅长标签,包括:
......@@ -221,6 +258,7 @@ class TagGoodAtSubclassProfile(BaseProfile):
return ret
good_at_group_tag_list = [
'青少年', '职场人', '家庭关系', '大学生', '伴侣', '夫妻', '中学生', '公务员', '留学生',
'精神康复者', '小学生', '孕产妇', '老年人', '成年人', '中年人',
......@@ -259,6 +297,7 @@ profile_converters = [
['tag_good_at_service', TagGoodAtSubclassProfile(good_at_service_tag_list)],
['tag_good_at_language', TagGoodAtSubclassProfile(good_at_language_tag_list)],
['tag_good_at_school', TagGoodAtSubclassProfile(good_at_school_tag_list)],
['cate_good_at', CateGoodAtProfile()],
]
def encode_counselor_profile(profile):
......
......@@ -17,3 +17,8 @@ def get_data_path():
def get_conf_path():
project_path = get_project_path()
return os.path.join(project_path, 'conf/private.conf')
def get_model_path():
project_path = get_project_path()
return os.path.join(project_path, 'model')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment