Exemple #1
0
 def __init__(self, debug=True):
     """
     爬取腾讯新闻平台的实时疫情数据
     :param debug:
     """
     self.req = requests.Session()
     self.log = LogSupport()
     self.re = connect_redis()
     self.debug = debug
     self.sqlc = SQLiteConnect(BASE_DIR + "sqlite.db")
Exemple #2
0
 def __init__(self, debug=True):
     """
     爬取腾讯新闻平台的实时疫情数据
     :param debug:
     """
     self.req = requests.Session()
     self.log = LogSupport()
     if USE_REDIS:
         self.re = connect_redis()
     else:
         self.re = None
     self.debug = debug
     self.sqlc = SQLiteConnect(os.path.join(BASE_DIR, "sqlite.db"))
     self.check_dirs()
Exemple #3
0
Copyright © 2018 Wang Han. SCU. All Rights Reserved.
"""
import os
import sys

# from cnocr import CnOcr

#from PIL import Image
# from snownlp import SnowNLP
from src.util.log import LogSupport
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
BASE_PATH = os.path.split(rootPath)[0]
sys.path.append(BASE_PATH)
# ocr = CnOcr()
ls = LogSupport()


class Image2Title:
    def __init__(self, topK=5):
        self.topK = topK

    def __preprocessing(self, text):
        # 去除空格
        text = text.replace(" ", "")
        # 去除换行符
        text = text.replace("\n", "")
        # 去除引号
        text = text.replace("\"", "").replace("\'",
                                              "").replace("“",
                                                          "").replace("”", "")
 def __init__(self, debug=True):
     self.req = requests.Session()
     self.log = LogSupport()
     self.re = connect_redis()
     self.debug = debug