Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
strategy_embedding
Project
Project
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
rank
strategy_embedding
Commits
df5ddaaf
Commit
df5ddaaf
authored
Jan 14, 2021
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
write data to redis
parent
b2efe798
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
9 deletions
+4
-9
tractate_sentence_similary.py
tractate_sentence_similary.py
+4
-9
No files found.
tractate_sentence_similary.py
View file @
df5ddaaf
...
...
@@ -73,21 +73,17 @@ def get_tractate_vector(sentence_lst, all_keywords_set, model):
def
save_tractate_vector_to_redis
(
all_keywords_set
,
model
):
es_result
=
get_new_user_tractate_info
()
count
=
0
res
=
{}
redis_key
=
"rims:tractate:sentense:vector:new_user"
for
i
in
es_result
:
count
+=
1
source
=
i
[
"_source"
]
sentences
=
source
[
"keynote_sentence"
]
id
=
source
[
"id"
]
vec
=
get_tractate_vector
(
sentences
,
all_keywords_set
,
model
)
redis_key
=
"rims:tractate:sentense:vector:"
+
str
(
id
)
if
vec
:
print
(
count
,
id
,
len
(
vec
))
res
[
id
]
=
vec
if
res
:
redis_client5
.
set
(
redis_key
,
json
.
dumps
(
res
))
# TODO remove
redis_client5
.
expire
(
redis_key
,
60
*
60
*
24
*
3
)
redis_client5
.
set
(
redis_key
,
json
.
dumps
(
vec
))
# redis_client5.expire(redis_key, 60 * 60 * 24 * 3)
def
save_tag_vector_to_redis
(
all_tags_lst
,
model
):
...
...
@@ -101,8 +97,7 @@ def save_tag_vector_to_redis(all_tags_lst, model):
redis_key
=
"rims:tractate:tags:vector"
if
res
:
redis_client5
.
set
(
redis_key
,
json
.
dumps
(
res
))
# TODO remove
redis_client5
.
expire
(
redis_key
,
60
*
60
*
24
*
3
)
# redis_client5.expire(redis_key, 60 * 60 * 24 * 3)
print
(
"tags vector redis: "
+
str
(
len
(
res
)))
...
...
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