This commit is contained in:
2025-12-23 15:42:55 +08:00
parent 2a65f6f639
commit e75bf4d5f4
4 changed files with 11 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
[metadata] [metadata]
# replace with your username: # replace with your username:
name = guan name = guan
version = 0.1.194 version = 0.1.195
author = guanjihuan author = guanjihuan
author_email = guanjihuan@163.com author_email = guanjihuan@163.com
description = An open source python package description = An open source python package

View File

@@ -1,6 +1,6 @@
Metadata-Version: 2.4 Metadata-Version: 2.4
Name: guan Name: guan
Version: 0.1.194 Version: 0.1.195
Summary: An open source python package Summary: An open source python package
Home-page: https://py.guanjihuan.com Home-page: https://py.guanjihuan.com
Author: guanjihuan Author: guanjihuan

View File

@@ -337,6 +337,14 @@ def run_programs_sequentially(program_files=['./a.py', './b.py'], execute='pytho
end = time.time() end = time.time()
print('Total running time = '+str((end-start)/60)+' min') print('Total running time = '+str((end-start)/60)+' min')
# 根据 “.” 和 “。” 符号进行分句
def split_text_into_sentences(text):
import re
pattern = r'(?<=[。])|(?<=\.)(?=\s|$)'
sentences = re.split(pattern, text)
sentence_array = [s.strip() for s in sentences if s.strip()]
return sentence_array
# 根据一定的字符长度来分割文本 # 根据一定的字符长度来分割文本
def split_text(text, width=100): def split_text(text, width=100):
split_text_list = [text[i:i+width] for i in range(0, len(text), width)] split_text_list = [text[i:i+width] for i in range(0, len(text), width)]

View File

@@ -770,7 +770,7 @@ def creat_qrcode(data="https://www.guanjihuan.com", filename='a', file_format='.
img = qrcode.make(data) img = qrcode.make(data)
img.save(filename+file_format) img.save(filename+file_format)
# 通过Sci-Hub网站下载文献 # 通过Sci-Hub网站下载文献(该方法可能失效)
def download_with_scihub(address=None, num=1): def download_with_scihub(address=None, num=1):
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
import re import re