Ver código fonte

2024-0628
取消敏感词策略

罗俊辉 10 meses atrás
pai
commit
d0924e5187

+ 3 - 3
applications/functions/common.py

@@ -136,9 +136,9 @@ def sensitive_flag(s_words, ori_title):
     :param ori_title:
     :param ori_title:
     :return:
     :return:
     """
     """
-    for word in s_words:
-        if str(word) in ori_title:
-            return False
+    # for word in s_words:
+    #     if str(word) in ori_title:
+    #         return False
     return True
     return True
 
 
 
 

+ 1 - 1
applications/schedule/search_schedule.py

@@ -185,7 +185,7 @@ class SearchMethod(object):
     """
     """
     搜索召回模式
     搜索召回模式
     """
     """
-    s_words = select_sensitive_words()
+    s_words = []
 
 
     @classmethod
     @classmethod
     async def search_v1(cls, text, trace_id):
     async def search_v1(cls, text, trace_id):

+ 0 - 85
task2.py

@@ -1,85 +0,0 @@
-"""
-@author: luojunhui
-"""
-import time
-import datetime
-import asyncio
-
-import aiomysql
-
-from applications.deal.process_deal_2 import ProcessDeal2
-
-
-class TaskMySQLClient(object):
-    """
-    Async MySQL
-    """
-
-    def __init__(self):
-        self.mysql_pool = None
-
-    async def init_pool(self):
-        """
-        初始化连接
-        :return:
-        """
-        self.mysql_pool = await aiomysql.create_pool(
-            host='rm-bp1159bu17li9hi94.mysql.rds.aliyuncs.com',
-            port=3306,
-            user='crawler',
-            password='crawler123456@',
-            db='piaoquan-crawler',
-            charset='utf8mb4',
-            connect_timeout=120,
-        )
-        print("mysql init successfully")
-
-    async def close_pool(self):
-        """
-        关闭 mysql 连接
-        :return:
-        """
-        self.mysql_pool.close()
-        await self.mysql_pool.wait_closed()
-
-    async def async_select(self, sql):
-        """
-        select method
-        :param sql:
-        :return:
-        """
-        async with self.mysql_pool.acquire() as conn:
-            async with conn.cursor() as cursor:
-                await cursor.execute(sql)
-                result = await cursor.fetchall()
-                return result
-
-    async def async_insert(self, sql):
-        """
-        insert and update method
-        :param sql:
-        :return:
-        """
-        async with self.mysql_pool.acquire() as coon:
-            async with coon.cursor() as cursor:
-                await cursor.execute(sql)
-                await coon.commit()
-
-
-async def main():
-    """
-    main job
-    :return:
-    """
-    TMC = TaskMySQLClient()
-    await TMC.init_pool()
-    PD = ProcessDeal2(TMC)
-    await PD.deal()
-
-
-if __name__ == '__main__':
-    while True:
-        asyncio.run(main())
-        now_str = datetime.datetime.now().__str__()
-        print("{}    请求执行完成, 等待120s".format(now_str))
-        time.sleep(120)