Skip to content

Commit 101bf1a

Browse files
author
xuming06
committed
del empty.
1 parent e56274c commit 101bf1a

16 files changed

Lines changed: 96 additions & 310929 deletions

tool/ad_count.txt

Lines changed: 0 additions & 310077 deletions
This file was deleted.

tool/add_user_info.py

Lines changed: 0 additions & 32 deletions
This file was deleted.

tool/argparse_demo.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
@author:XuMing([email protected])
4+
@description:
5+
"""
6+
import argparse
7+
import logging
8+
parser = argparse.ArgumentParser(description="starts the ask-question-robot")
9+
parser.add_argument("task",
10+
type=str,
11+
choices=["train_nlu", "train_dialogue", "run", "run_online"],
12+
help="what the bot should do - e.g. run or train?")
13+
parser.add_argument("risk",
14+
type=str,
15+
choices=["gamble", "lottery", "mahjong"],
16+
default="gamble",
17+
help="what risk domain")
18+
args = parser.parse_args()
19+
print(args)

tool/async_demo1.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
@author:XuMing([email protected])
4+
@description:
5+
"""
6+
import asyncio
7+
import time
8+
9+
10+
async def say_after(delay, what):
11+
await asyncio.sleep(delay)
12+
print(what)
13+
14+
15+
async def main():
16+
print(f"started at {time.strftime('%X')}")
17+
18+
await say_after(1, 'hello')
19+
await say_after(2, 'world')
20+
21+
print(f"finished at {time.strftime('%X')}")
22+
23+
24+
asyncio.run(main())

tool/check_rule.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
@author:XuMing([email protected])
4+
@description:
5+
"""
6+
7+
8+
def load_word_set(save_path):
9+
words = set()
10+
with open(save_path, 'r', encoding='utf-8') as f:
11+
for line in f:
12+
if line.startswith("#"):
13+
continue
14+
words.add(line.strip())
15+
return words
16+
17+
18+
def load_query_set(save_path):
19+
words = set()
20+
with open(save_path, 'r', encoding='utf-8') as f:
21+
for line in f:
22+
if line.startswith("#"):
23+
continue
24+
words.add(line.strip())
25+
return words
26+
27+
28+
class Risk(object):
29+
def __init__(self, risk_words_path=""):
30+
self.risk_words = load_word_set(risk_words_path)
31+
print("risk words size: %d" % len(self.risk_words))
32+
33+
def check(self, query):
34+
# query is empty , return None
35+
if not query.strip():
36+
return
37+
for w in self.risk_words:
38+
if w in query:
39+
return w
40+
return None
41+
42+
43+
if __name__ == "__main__":
44+
risk = Risk(risk_words_path="medical_tech.txt")
45+
input_queries = load_query_set("medical_tech_remark.txt")
46+
stat = []
47+
num = 0
48+
for i in input_queries:
49+
ret = risk.check(i)
50+
if ret:
51+
num += 1
52+
stat.append([ret, i[:10], num])
53+
print(stat)

tool/demo.py

Lines changed: 0 additions & 9 deletions
This file was deleted.

tool/draw.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)