Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
f12bc797
Commit
f12bc797
authored
Apr 24, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try get city_id
parent
aceffb8f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
10 deletions
+23
-10
new_tag3_cold_start.py
eda/smart_rank/new_tag3_cold_start.py
+23
-10
No files found.
eda/smart_rank/new_tag3_cold_start.py
View file @
f12bc797
...
...
@@ -2,7 +2,9 @@ import json
from
itertools
import
chain
,
zip_longest
import
redis
from
es_tool
import
es_query
from
tool
import
get_data_by_mysql
def
merge_lists
(
*
lol
):
...
...
@@ -35,6 +37,14 @@ keywords = [
]
def
get_all_city_id
():
sql
=
"select distinct tag_id from api_city"
mysql_results
=
get_data_by_mysql
(
"172.16.30.141"
,
3306
,
"work"
,
"BJQaT9VzDcuPBqkd"
,
"zhengxing"
,
sql
)
city_tag_ids
=
[
i
[
"tag_id"
]
for
i
in
mysql_results
]
city_tag_ids
.
append
(
-
1
)
# 没有城市的情况
return
city_tag_ids
def
get_es_diary
(
keywords
,
city_tag_id
=-
1
,
version
=
False
):
q
=
{}
sort_list
=
[{
...
...
@@ -289,14 +299,17 @@ if __name__ == "__main__":
# print("tractate: " + str(get_es_tractate(keywords)[:10]) + "\n")
# print("answer: " + str(get_es_answer(keywords)[:10]) + "\n")
diary_list
=
get_es_diary
(
keywords
)
tractate_list
=
get_es_tractate
(
keywords
)
answer_list
=
get_es_answer
(
keywords
)
redis_client
=
redis
.
StrictRedis
.
from_url
(
"redis://:ReDis!GmTx*0aN9@172.16.40.173:6379"
)
redis_client
.
rpush
(
"doris:tag_v3:coldstart:diary"
,
*
diary_list
)
redis_client
.
rpush
(
"doris:tag_v3:coldstart:tractate"
,
*
tractate_list
)
redis_client
.
rpush
(
"doris:tag_v3:coldstart:answer"
,
*
answer_list
)
all_city_tag_id
=
get_all_city_id
()
print
(
all_city_tag_id
)
# diary_list = get_es_diary(keywords)
# tractate_list = get_es_tractate(keywords)
# answer_list = get_es_answer(keywords)
# redis_client = redis.StrictRedis.from_url("redis://:ReDis!GmTx*0aN9@172.16.40.173:6379")
# redis_client.rpush("doris:tag_v3:coldstart:diary", *diary_list)
# redis_client.rpush("doris:tag_v3:coldstart:tractate", *tractate_list)
# redis_client.rpush("doris:tag_v3:coldstart:answer", *answer_list)
print
(
"diary: "
+
str
(
len
(
diary_list
)))
print
(
"tractate: "
+
str
(
len
(
tractate_list
)))
print
(
"answer: "
+
str
(
len
(
answer_list
)))
#
print("diary: " + str(len(diary_list)))
#
print("tractate: " + str(len(tractate_list)))
#
print("answer: " + str(len(answer_list)))
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