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
6eefb8cb
Commit
6eefb8cb
authored
Aug 30, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
eb4988d4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
9 deletions
+26
-9
rerank_esmm.py
rerank_esmm.py
+26
-9
No files found.
rerank_esmm.py
View file @
6eefb8cb
...
...
@@ -73,17 +73,34 @@ def get_queues(device_id,city_id):
else
:
return
[]
def
tag_boost
(
cid_str
,
tag_
score
=
"1
"
):
def
tag_boost
(
cid_str
,
tag_
list
=
"a
"
):
if
cid_str
is
not
None
or
cid_str
!=
""
:
cids
=
cid_str
.
split
(
","
)
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'eagle'
)
sql
=
"select diary_id,group_concat(id) from "
\
"(select a.diary_id,b.id from src_mimas_prod_api_diary_tags a left join src_zhengxing_api_tag b "
\
"on a.tag_id = b.id where b.tag_type < '4' and a.diary_id in {}) tmp group by diary_id"
.
format
(
tuple
(
cids
))
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
print
(
result
)
if
len
(
cids
)
>
6
and
len
(
tag_list
)
>
0
:
db
=
pymysql
.
connect
(
host
=
'172.16.40.158'
,
port
=
4000
,
user
=
'root'
,
passwd
=
'3SYz54LS9#^9sBvC'
,
db
=
'eagle'
)
sql
=
"select id,group_concat(diary_id) from "
\
"(select a.diary_id,b.id from src_mimas_prod_api_diary_tags a left join src_zhengxing_api_tag b "
\
"on a.tag_id = b.id where b.tag_type < '4' and a.diary_id in {}) tmp "
\
"group by id"
.
format
(
tuple
(
cids
))
# sql = "select id,group_concat(diary_id) from " \
# "(select a.diary_id,b.id from src_mimas_prod_api_diary_tags a left join src_zhengxing_api_tag b " \
# "on a.tag_id = b.id where b.tag_type < '4' and a.diary_id in {}) tmp " \
# "where id in {} group by id".format(tuple(cids), tuple(tag_list))
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
print
(
result
)
# if len(result) > 0:
# cid_tag = {}
# for i in result:
# cid_tag[i[0]] = i[1]
# if
#
# else:
# return cid_str
else
:
return
cid_str
else
:
return
cid_str
...
...
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