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
18fd035c
Commit
18fd035c
authored
Aug 29, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test file
parent
881c37b1
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
6 deletions
+61
-6
content.py
content.py
+0
-0
read_filter.py
read_filter.py
+43
-5
rerank_esmm.py
rerank_esmm.py
+18
-1
No files found.
content.py
0 → 100644
View file @
18fd035c
This diff is collapsed.
Click to expand it.
read_filter.py
View file @
18fd035c
...
...
@@ -23,7 +23,7 @@ def filter_history(device_id,cid_list):
r
.
sadd
(
all_key
,
*
r
.
smembers
(
today_key
))
def
get_da
ta
():
def
get_da
iry
():
device_id
=
"868080041007173"
r
=
redis
.
StrictRedis
.
from_url
(
"redis://redis.paas-test.env:6379/0"
)
...
...
@@ -35,7 +35,7 @@ def get_data():
user_portrait_diary_key
=
'user_portrait_recommend_diary_queue:device_id:
%
s:
%
s'
%
\
(
device_id
,
datetime
.
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d'
))
user_cids
=
list
(
range
(
2
,
20
))
user_cids
=
list
(
range
(
2
,
6
))
user_cids
=
[
str
(
i
)
for
i
in
user_cids
]
r
.
hset
(
user_portrait_diary_key
,
'diary_queue'
,
json
.
dumps
(
user_cids
))
r
.
hset
(
user_portrait_diary_key
,
'cursor'
,
"0"
)
...
...
@@ -44,7 +44,7 @@ def get_data():
print
(
r
.
hgetall
(
user_portrait_diary_key
))
search_diary_recommend_key
=
"TS:search_recommend_diary_queue:device_id:"
+
str
(
device_id
)
serach_cids
=
list
(
range
(
20
,
39
))
serach_cids
=
list
(
range
(
20
,
26
))
serach_cids
=
[
str
(
i
)
for
i
in
serach_cids
]
r
.
hset
(
search_diary_recommend_key
,
'diary_queue'
,
json
.
dumps
(
serach_cids
))
print
(
"search"
)
...
...
@@ -52,7 +52,7 @@ def get_data():
diary_recommend_key
=
"TS:recommend_diary_queue:device_id:"
+
str
(
device_id
)
ts_cids
=
list
(
range
(
40
,
60
))
ts_cids
=
list
(
range
(
40
,
46
))
ts_cids
=
[
str
(
i
)
for
i
in
ts_cids
]
r
.
hset
(
diary_recommend_key
,
'diary_queue'
,
json
.
dumps
(
ts_cids
))
print
(
"ts"
)
...
...
@@ -72,6 +72,42 @@ def get_data():
print
(
r
.
hgetall
(
personal_key
))
def
get_qa
():
device_id
=
"868080041007173"
r
=
redis
.
StrictRedis
.
from_url
(
"redis://redis.paas-test.env:6379/0"
)
dislike_key
=
str
(
device_id
)
+
"_dislike_qa"
dislike_cids
=
[
529401
,
529412
,
529403
]
r
.
sadd
(
dislike_key
,
*
dislike_cids
)
print
(
"不喜欢"
)
print
(
r
.
smembers
(
dislike_key
))
search_qa_recommend_key
=
"TS:search_recommend_answer_queue:device_id:"
+
str
(
device_id
)
r
.
hset
(
search_qa_recommend_key
,
'answer_queue'
,
json
.
dumps
(
list
(
range
(
529401
,
529408
))))
print
(
r
.
hgetall
(
search_qa_recommend_key
))
def
get_topic
():
device_id
=
"868080041007173"
r
=
redis
.
StrictRedis
.
from_url
(
"redis://redis.paas-test.env:6379/0"
)
dislike_key
=
str
(
device_id
)
+
"_dislike_tractate"
dislike_cids
=
[
2
,
37
]
r
.
sadd
(
dislike_key
,
*
dislike_cids
)
print
(
"不喜欢"
)
print
(
r
.
smembers
(
dislike_key
))
search_topic_recommend_key
=
"TS:search_recommend_tractate_queue:device_id:"
+
str
(
device_id
)
r
.
hset
(
search_topic_recommend_key
,
'tractate_queue'
,
json
.
dumps
(
list
(
range
(
1
,
4
))))
print
(
r
.
hgetall
(
search_topic_recommend_key
))
def
yanzheng
():
device_id
=
"E417C286-40A4-42F6-BDA9-AEEBD8FEC3B6"
r
=
redis
.
Redis
(
host
=
"172.16.40.135"
,
port
=
5379
,
db
=
2
,
socket_timeout
=
2000
)
...
...
@@ -84,7 +120,9 @@ def get_data():
if
__name__
==
"__main__"
:
# cid = [16,18,20]
# filter_history("hello",cid)
get_data
()
get_topic
()
...
...
rerank_esmm.py
View file @
18fd035c
...
...
@@ -14,6 +14,7 @@ def get_esmm_users():
"where stat_date = '{}'"
.
format
(
stat_date
)
cursor
.
execute
(
sql
)
result
=
list
(
cursor
.
fetchall
())
db
.
close
()
return
result
...
...
@@ -37,7 +38,23 @@ def get_user_profile():
return
tags
def
get_searchworlds_to_tagid
():
try
:
sql
=
'select id, name from api_tag where is_online = 1 and tag_type < 4'
db
=
pymysql
.
connect
(
host
=
'172.16.30.141'
,
port
=
3306
,
user
=
'work'
,
passwd
=
'BJQaT9VzDcuPBqkd'
,
db
=
'zhengxing'
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
tag_id
=
cursor
.
fetchall
()
db
.
close
()
searchworlds_to_tagid
=
{}
for
i
in
tag_id
:
searchworlds_to_tagid
[
i
[
1
]]
=
i
[
0
]
print
(
searchworlds_to_tagid
)
return
searchworlds_to_tagid
except
Exception
as
e
:
print
(
e
)
...
...
@@ -80,7 +97,7 @@ if __name__ == "__main__":
#
# total_samples.todf
# to_data_base(df)
get_
user_profile
()
get_
searchworlds_to_tagid
()
...
...
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