gomyck-tools 1.4.8__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ctools/util/jb_cut.py CHANGED
@@ -4,6 +4,7 @@ __author__ = 'haoyang'
4
4
  __date__ = '2025/7/15 13:08'
5
5
 
6
6
  import sys
7
+ from collections import Counter
7
8
 
8
9
  import jieba
9
10
  from jieba import posseg as pseg
@@ -49,6 +50,9 @@ def get_declare_type_word(word: str, word_flag=(), use_paddle=False, exclude_fla
49
50
  # if platform.system() == 'Linux': jieba.enable_parallel(4)
50
51
  ret = []
51
52
  for w, flag in pseg.cut(word, use_paddle=use_paddle):
52
- if (flag in word_flag or len(word_flag) == 0) and flag not in exclude_flag and w not in exclude_word:
53
+ if (not word_flag or flag in word_flag) and flag not in exclude_flag and w not in exclude_word:
53
54
  ret.append((w, flag))
54
- return ret
55
+ # 按 (w, flag) 统计出现次数
56
+ counter = Counter(ret)
57
+ # 输出结果 [(w, flag, count), ...]
58
+ return [(w, flag, cnt) for (w, flag), cnt in counter.items()]
@@ -19,7 +19,6 @@ app_cache = {}
19
19
  class GlobalState:
20
20
  lock = threading.Lock()
21
21
  withOutLoginURI = {
22
- '/',
23
22
  '/index',
24
23
  '/login',
25
24
  '/favicon.ico',
@@ -59,6 +58,7 @@ def init_app(context_path="/", main_app=False):
59
58
  def init_main_app():
60
59
  @app.hook('before_request')
61
60
  def before_request():
61
+ if request.path == '/': return
62
62
  for v in GlobalState.withOutLoginURI:
63
63
  if v.endswith('/'):
64
64
  if request.path.startswith(v): return
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gomyck-tools
3
- Version: 1.4.8
3
+ Version: 1.5.0
4
4
  Summary: A tools collection for python development by hao474798383
5
5
  Author-email: gomyck <hao474798383@163.com>
6
6
  License-Expression: Apache-2.0
@@ -69,20 +69,20 @@ ctools/util/env_config.py,sha256=L98G9LPdpD7Yl5XbA_-KfkcA4mDunQoKiYtK5w7QR-s,179
69
69
  ctools/util/html_soup.py,sha256=rnr8M3gn3gQGo-wNaNFXDjdzp8AAkv9o4yqfIIfO-zw,1567
70
70
  ctools/util/http_util.py,sha256=cx0FRnPLFdJ0mF9UYphl40SZj68fqG30Q0udku9hZIE,769
71
71
  ctools/util/image_process.py,sha256=nqJOi2p8wLe8wRsfkH99MyEYSjE9i4fthxBJwrrZVB8,835
72
- ctools/util/jb_cut.py,sha256=h8Ey-LbpHtbAHskITn5GXEO7-DHJ_ZLODmE8Lc_dgSc,1664
72
+ ctools/util/jb_cut.py,sha256=2vs054_lM-0sxh70cUv7nHhLkWW1ioM3MQ5LF25sBl8,1844
73
73
  ctools/util/snow_id.py,sha256=KCuQ0zOTlmus8gZetmRA5y0jBSd8J0KXcJ33EzgCKjE,2225
74
74
  ctools/web/__init__.py,sha256=koSNYeKF5Z_xbp4Q2qbZ4ZP-3--1phbOYN9e4SJy_gk,98
75
75
  ctools/web/aio_web_server.py,sha256=p46BOU3_m4Jb57yAACeedKjhlFc1YC0QJSUe2selBgA,5693
76
76
  ctools/web/api_result.py,sha256=i1MjTnnlgkWl_q07xr-TLQeLYlXEh4DEclUFE414nSk,1568
77
- ctools/web/bottle_web_base.py,sha256=ddBs5RsZmAogM1QxGcnOMAqD0N8vugREVbAewC3_0aw,8735
77
+ ctools/web/bottle_web_base.py,sha256=iQZJtRQH3HJ-P-48Gspvp1VEd6boAlZfiat3H8E5bBU,8763
78
78
  ctools/web/bottle_webserver.py,sha256=0xHLnuGIShxrEHc2mLnyx43NDVkCqM5QnlkY-Ndzrk4,6650
79
79
  ctools/web/bottle_websocket.py,sha256=xsu9fAtTuR5DsSsQjiBfaYxLjOWFyfr1sYM6cktTovI,1957
80
80
  ctools/web/ctoken.py,sha256=WaB29kqGlKAh21aUw5avl2h8AgLD1aESw8KCpqaN5nM,2539
81
81
  ctools/web/download_util.py,sha256=v0JTXiED1bvoWFfwfd-LD5s7_aoRQ0lCkaGwSnSp7WI,1954
82
82
  ctools/web/params_util.py,sha256=eJDV3PSq-ZHb8UZf6xqs8kOhbyZzits1H9yPoUBIDXg,828
83
83
  ctools/web/upload_util.py,sha256=z1QQCi4SFx08jrAQH5-Y_ShiM4MghuD_5Qz6V9KK_4U,1076
84
- gomyck_tools-1.4.8.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
85
- gomyck_tools-1.4.8.dist-info/METADATA,sha256=F5CFbFfhZQJ8hJjctpn6VZcpshmGb1h8V9mQIk8wAEY,1826
86
- gomyck_tools-1.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
87
- gomyck_tools-1.4.8.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
88
- gomyck_tools-1.4.8.dist-info/RECORD,,
84
+ gomyck_tools-1.5.0.dist-info/licenses/LICENSE,sha256=X25ypfH9E6VTht2hcO8k7LCSdHUcoG_ALQt80jdYZfY,547
85
+ gomyck_tools-1.5.0.dist-info/METADATA,sha256=OIiamqSTvrOLoKzBXX2JpMh_uwWazVR094XmsK1a2Mc,1826
86
+ gomyck_tools-1.5.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
87
+ gomyck_tools-1.5.0.dist-info/top_level.txt,sha256=-MiIH9FYRVKp1i5_SVRkaI-71WmF1sZSRrNWFU9ls3s,7
88
+ gomyck_tools-1.5.0.dist-info/RECORD,,