Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ydl_ai_recommender
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
闫发泽
ydl_ai_recommender
Commits
1f87ec70
Commit
1f87ec70
authored
Mar 01, 2023
by
柴鹏飞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
补充专家画像特征emb
parent
20d378e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
counselor_profile.py
src/core/counselor_profile.py
+39
-0
__init__.py
src/utils/__init__.py
+6
-0
No files found.
src/core/counselor_profile.py
View file @
1f87ec70
...
@@ -182,6 +182,43 @@ class TagGoodAtDirectionProfile(BaseProfile):
...
@@ -182,6 +182,43 @@ class TagGoodAtDirectionProfile(BaseProfile):
return
ret
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
):
class
TagGoodAtSubclassProfile
(
BaseProfile
):
"""
"""
tag_good_at_** 咨询师擅长标签,包括:
tag_good_at_** 咨询师擅长标签,包括:
...
@@ -221,6 +258,7 @@ class TagGoodAtSubclassProfile(BaseProfile):
...
@@ -221,6 +258,7 @@ class TagGoodAtSubclassProfile(BaseProfile):
return
ret
return
ret
good_at_group_tag_list
=
[
good_at_group_tag_list
=
[
'青少年'
,
'职场人'
,
'家庭关系'
,
'大学生'
,
'伴侣'
,
'夫妻'
,
'中学生'
,
'公务员'
,
'留学生'
,
'青少年'
,
'职场人'
,
'家庭关系'
,
'大学生'
,
'伴侣'
,
'夫妻'
,
'中学生'
,
'公务员'
,
'留学生'
,
'精神康复者'
,
'小学生'
,
'孕产妇'
,
'老年人'
,
'成年人'
,
'中年人'
,
'精神康复者'
,
'小学生'
,
'孕产妇'
,
'老年人'
,
'成年人'
,
'中年人'
,
...
@@ -259,6 +297,7 @@ profile_converters = [
...
@@ -259,6 +297,7 @@ profile_converters = [
[
'tag_good_at_service'
,
TagGoodAtSubclassProfile
(
good_at_service_tag_list
)],
[
'tag_good_at_service'
,
TagGoodAtSubclassProfile
(
good_at_service_tag_list
)],
[
'tag_good_at_language'
,
TagGoodAtSubclassProfile
(
good_at_language_tag_list
)],
[
'tag_good_at_language'
,
TagGoodAtSubclassProfile
(
good_at_language_tag_list
)],
[
'tag_good_at_school'
,
TagGoodAtSubclassProfile
(
good_at_school_tag_list
)],
[
'tag_good_at_school'
,
TagGoodAtSubclassProfile
(
good_at_school_tag_list
)],
[
'cate_good_at'
,
CateGoodAtProfile
()],
]
]
def
encode_counselor_profile
(
profile
):
def
encode_counselor_profile
(
profile
):
...
...
src/utils/__init__.py
View file @
1f87ec70
...
@@ -17,3 +17,8 @@ def get_data_path():
...
@@ -17,3 +17,8 @@ def get_data_path():
def
get_conf_path
():
def
get_conf_path
():
project_path
=
get_project_path
()
project_path
=
get_project_path
()
return
os
.
path
.
join
(
project_path
,
'conf/private.conf'
)
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment