File tree Expand file tree Collapse file tree 6 files changed +13
-12
lines changed
Expand file tree Collapse file tree 6 files changed +13
-12
lines changed Original file line number Diff line number Diff line change 66 steps :
77 - uses : actions/setup-python@v5
88 with :
9- python-version : ' 3.10 .x'
9+ python-version : ' 3.14 .x'
1010 - name : fetch tags
1111 run : git fetch --prune --unshallow --tags
1212 shell : bash
Original file line number Diff line number Diff line change 5959 - name : Set up Python
6060 uses : actions/setup-python@v5
6161 with :
62- python-version : ' >= 3.10 '
62+ python-version : ' >= 3.14 '
6363
6464 - name : Install document building dependencies
6565 run : |
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ English users please use the [Github Discussions page](https://github.com/PrepPi
5656
5757## 开发环境设置
5858
59- 目前运行本程序需要至少 Python 3.10 版本。需要开发的话请使用最低版本(3.10 .x),以免在其他使用最低版本的环境出错。
59+ 目前运行本程序需要至少 Python 3.14 版本。需要开发的话请使用最低版本(3.14 .x),以免在其他使用最低版本的环境出错。
6060
6161如果您想构建一个开发环境,您需要安装以下 Python 依赖项。推荐在一个 ` venv ` 中操作。
6262 * 构建需要 ` build twine `
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ include_package_data = True
2020package_dir =
2121 = src
2222packages = find_namespace:
23- python_requires = >=3.10
23+ python_requires = >=3.14
2424
2525install_requires =
2626 odfpy
@@ -29,12 +29,13 @@ install_requires =
2929 marko
3030 pyyaml
3131 pillow
32+ audioop-lts
3233 pydub
3334 numpy
3435 scipy
3536 matplotlib
3637 opencv-python
37- editdistance
38+ rapidfuzz
3839 bidict
3940 pypinyin
4041 graphviz
Original file line number Diff line number Diff line change @@ -691,7 +691,7 @@ def check_is_extend_data(annotation : typing.Any) -> list[type]:
691691 # (如果该命令可以接受多种延伸参数类型,我们想把所有可接受的延伸参数类型找到)
692692 if isinstance (annotation , types .UnionType ):
693693 # 这是 T1 | T2 | ...
694- return [ty for ty in annotation .__args__ if issubclass (ty , ExtendDataExprBase )]
694+ return [ty for ty in annotation .__args__ if isinstance ( ty , type ) and issubclass (ty , ExtendDataExprBase )]
695695 if isinstance (annotation , type ):
696696 if issubclass (annotation , ExtendDataExprBase ):
697697 return [annotation ]
Original file line number Diff line number Diff line change 11# SPDX-FileCopyrightText: 2022 PrepPipe's Contributors
22# SPDX-License-Identifier: Apache-2.0
33
4- import editdistance
4+ import rapidfuzz . distance
55import typing
66
77class TypoSuggestion :
88 _input : str # the input string that is likely wrong
99 _min_dist : typing .Any
1010 _best_candidates : typing .List [str ]
11-
11+
1212 def __init__ (self , input : str ) -> None :
1313 self ._input = input
1414 self ._min_dist = None
1515 self ._best_candidates = []
16-
16+
1717 def _test (self , candidate : str ) -> None :
18- dist = editdistance . eval (candidate , self ._input )
18+ dist = rapidfuzz . distance . Levenshtein (candidate , self ._input )
1919 if self ._min_dist is None or self ._min_dist > dist :
2020 self ._best_candidates = [candidate ]
2121 self ._min_dist = dist
2222 elif self ._min_dist == dist :
2323 if candidate not in self ._best_candidates :
2424 self ._best_candidates .append (candidate )
25-
25+
2626 def add_candidate (self , candidate ) -> None :
2727 if isinstance (candidate , str ):
2828 self ._test (candidate )
2929 else :
3030 for item in candidate :
3131 self .add_candidate (item )
32-
32+
3333 def get_result (self ) -> typing .List [str ]:
3434 return self ._best_candidates
You can’t perform that action at this time.
0 commit comments