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
ecb3e100
Commit
ecb3e100
authored
Aug 30, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
a8a84587
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
30 deletions
+24
-30
rerank_esmm.py
rerank_esmm.py
+24
-30
No files found.
rerank_esmm.py
View file @
ecb3e100
...
@@ -87,43 +87,37 @@ def tag_boost(cid_str, tag_list=[15,21,22,85,86]):
...
@@ -87,43 +87,37 @@ def tag_boost(cid_str, tag_list=[15,21,22,85,86]):
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
result
=
cursor
.
fetchall
()
if
len
(
result
)
>
0
:
if
len
(
result
)
>
0
:
t
mp_dict
=
{}
t
ag_cids
=
{}
left_cids
=
[]
left_cids
=
[]
for
i
in
result
:
for
i
in
result
:
tmp
=
i
[
1
]
.
split
(
","
)
tmp
=
i
[
1
]
.
split
(
","
)
t
mp_dict
[
i
[
0
]]
=
tmp
t
ag_cids
[
i
[
0
]]
=
tmp
left_cids
.
extend
(
tmp
)
left_cids
.
extend
(
tmp
)
tag_cids
=
{}
left_cids
=
list
(
set
(
left_cids
))
right_cids
=
[
i
for
i
in
cids
if
i
not
in
left_cids
]
tag_cids
[
"right"
]
=
right_cids
tag_list
.
append
(
"right"
)
sort_cids
=
[]
n
=
0
while
n
==
len
(
tag_cids
)
-
1
:
for
i
in
tag_list
:
for
i
in
tag_list
:
if
i
in
tmp_dict
.
keys
():
if
i
in
tag_cids
.
keys
():
tag_cids
[
i
]
=
tmp_dict
[
i
]
if
len
(
tag_cids
[
i
])
>
0
:
print
(
tag_list
)
sort_cids
.
append
(
tag_cids
[
i
][
0
])
value
=
tag_cids
[
i
]
value
.
pop
(
0
)
tag_cids
[
i
]
=
value
if
len
(
value
)
==
0
and
i
!=
"right"
:
n
=
n
+
1
if
len
(
tag_cids
[
"right"
])
>
0
:
sort_cids
.
extend
(
tag_cids
[
"right"
])
print
(
tag_cids
)
print
(
tag_cids
)
print
(
sort_cids
)
# left_cids = list(set(left_cids))
print
(
len
(
sort_cids
))
# right_cids = [i for i in cids if i not in left_cids]
print
(
len
(
cids
))
# tag_cids["right"] = right_cids
return
sort_cids
# tag_list.append("right")
# sort_cids = []
# while True:
# for i in tag_list:
# if i in tag_cids.keys():
# n = 0
# if len(tag_cids[i]) > 0:
# sort_cids.append(tag_cids[i][0])
# value = tag_cids[i]
# value.pop(0)
# tag_cids[i] = value
# if len(value) == 0 and i != "right":
# n = n + 1
# else:
# n = n +1
# if n == len(tag_cids)-1:
# if len(tag_cids["right"]) > 0:
# sort_cids.extend(tag_cids["right"])
# print(sort_cids)
# return sort_cids
else
:
else
:
...
...
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