Commit 5acbb892 authored by 赵威's avatar 赵威

re save

parent d9f4efe2
...@@ -80,7 +80,8 @@ def save_tractate_vector_to_redis(all_keywords_set, model): ...@@ -80,7 +80,8 @@ def save_tractate_vector_to_redis(all_keywords_set, model):
vec = get_tractate_vector(sentences, all_keywords_set, model) vec = get_tractate_vector(sentences, all_keywords_set, model)
redis_key = "rims:tractate:sentense:vector:" + str(id) redis_key = "rims:tractate:sentense:vector:" + str(id)
if vec: if vec:
print(count, len(vec)) vec = vec[:15]
print(count, id, len(vec))
redis_client5.set(redis_key, json.dumps(vec)) redis_client5.set(redis_key, json.dumps(vec))
# TODO remove # TODO remove
redis_client5.expire(redis_key, 60 * 60 * 24 * 3) redis_client5.expire(redis_key, 60 * 60 * 24 * 3)
...@@ -91,7 +92,7 @@ def save_tag_vector_to_redis(all_tags_lst, model): ...@@ -91,7 +92,7 @@ def save_tag_vector_to_redis(all_tags_lst, model):
for name in all_tags_lst: for name in all_tags_lst:
try: try:
vec = model.wv.get_vector(name).tolist() vec = model.wv.get_vector(name).tolist()
res[name] = vec res[name] = json.dumps(vec)
except Exception as e: except Exception as e:
pass pass
redis_key = "rims:tractate:tags:vector" redis_key = "rims:tractate:tags:vector"
......
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