PinInPy 1.0.3__tar.gz → 1.0.4__tar.gz
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.
- {pininpy-1.0.3 → pininpy-1.0.4}/PKG-INFO +1 -2
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/Keyboard.h +1 -1
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/Keyboard.cpp +16 -14
- {pininpy-1.0.3 → pininpy-1.0.4}/pyproject.toml +1 -2
- {pininpy-1.0.3 → pininpy-1.0.4}/.editorconfig +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/.github/workflows/python-publish.yml +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/.gitignore +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/.gitmodules +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/CMakeLists.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/LICENSE +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/.editorconfig +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/.gitattributes +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/.gitignore +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/CMakeLists.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/CMakeSettings.json +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/FFIExample/PinInLua.lua +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/LICENSE +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/README.md +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/cmake/PinIn4CppConfig.cmake.in +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/example/PinyinTest.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/ParallelSearch.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/PinIn.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/PinInCAPI.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/PinyinFormat.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/TreeSearcher.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/Accelerator.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/AdaptiveContainers.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/BinUtils.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/IndexSet.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/ObjectPool.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/StringPool.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/include/PinIn4Cpp/detail/StringUtils.h +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/licenses/PinIn.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/licenses/pinyin-data.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/PinIn.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/PinInCAPI.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/PinyinFormat.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/TreeSearcher.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/utils/Accelerator.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/utils/BinUtils.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/utils/IndexSet.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/utils/StringPool.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/src/utils/StringUtils.cpp +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/test_data/large.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/test_data/pinyin.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/PinIn4Cpp/test_data/small.txt +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/README.md +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/build_cffi.py +0 -0
- {pininpy-1.0.3 → pininpy-1.0.4}/package/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: PinInPy
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.4
|
|
4
4
|
Summary: Python library for Pinyin searching
|
|
5
5
|
Keywords: PinIn,pinyin match,pinyin,cffi
|
|
6
6
|
Author-Email: SajoYukimi <kagiyamahino@gmail.com>
|
|
@@ -12,7 +12,6 @@ Classifier: Operating System :: MacOS :: MacOS X
|
|
|
12
12
|
Classifier: Operating System :: Microsoft :: Windows
|
|
13
13
|
Classifier: Operating System :: POSIX :: Linux
|
|
14
14
|
Classifier: Programming Language :: Python :: 3
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -93,7 +93,7 @@ namespace PinInCpp {
|
|
|
93
93
|
void CreateViewOnMap(std::map<std::string_view, std::string_view>& Target, const std::vector<InsertStrData>& data);
|
|
94
94
|
void copy(const Keyboard& src);
|
|
95
95
|
class StrPool;
|
|
96
|
-
void ViewDeepCopy(const std::map<std::string_view, std::string_view>& srcMap, std::map<std::string_view, std::string_view>& Target);
|
|
96
|
+
void ViewDeepCopy(const StrPool& srcPool, const std::map<std::string_view, std::string_view>& srcMap, std::map<std::string_view, std::string_view>& Target);
|
|
97
97
|
|
|
98
98
|
//不是StringPoolBase的派生类,是用于Keyboard持有字符串生命周期的内存池
|
|
99
99
|
class StrPool {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#include "PinIn4Cpp/Keyboard.h"
|
|
2
|
-
|
|
2
|
+
#include <iostream>
|
|
3
3
|
namespace PinInCpp {
|
|
4
4
|
namespace detail {
|
|
5
5
|
bool hasInitial(std::string_view s) {//判断是否有声母
|
|
@@ -89,15 +89,16 @@ namespace PinInCpp {
|
|
|
89
89
|
Target.insert_or_assign(key, value);
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
|
-
void Keyboard::ViewDeepCopy(const std::map<std::string_view, std::string_view>& srcMap, std::map<std::string_view, std::string_view>& Target) {
|
|
92
|
+
void Keyboard::ViewDeepCopy(const StrPool& srcPool, const std::map<std::string_view, std::string_view>& srcMap, std::map<std::string_view, std::string_view>& Target) {
|
|
93
93
|
char* poolptr = pool.data();
|
|
94
|
+
const char* srcpoolptr = srcPool.data();
|
|
94
95
|
for (const auto& [key, value] : srcMap) {
|
|
96
|
+
int KeyOffset = key.data() - srcpoolptr;
|
|
95
97
|
size_t keySize = key.size();
|
|
96
|
-
size_t keyStart = pool.put(key);
|
|
97
98
|
|
|
99
|
+
int valueOffset = value.data() - srcpoolptr;
|
|
98
100
|
size_t valueSize = value.size();
|
|
99
|
-
|
|
100
|
-
Target.insert_or_assign(std::string_view(poolptr + keyStart, keySize), std::string_view(poolptr + valueStart, valueSize));
|
|
101
|
+
Target.insert_or_assign(std::string_view(poolptr + KeyOffset, keySize), std::string_view(poolptr + valueOffset, valueSize));
|
|
101
102
|
}
|
|
102
103
|
}
|
|
103
104
|
Keyboard::Keyboard(const OptionalStrMap& MapLocalArg, const OptionalStrMap& MapKeysArg, CutterFn cutter, bool duo, bool sequence)
|
|
@@ -151,30 +152,31 @@ namespace PinInCpp {
|
|
|
151
152
|
}
|
|
152
153
|
|
|
153
154
|
void Keyboard::copy(const Keyboard& src) {
|
|
154
|
-
pool
|
|
155
|
+
pool = src.pool;
|
|
155
156
|
//重建视图
|
|
156
157
|
if (src.MapLocalFuzzy.has_value()) {
|
|
157
158
|
MapLocalFuzzy = std::map<std::string_view, std::vector<std::string_view>>();
|
|
158
159
|
char* poolptr = pool.data();
|
|
160
|
+
const char* srcpoolptr = src.pool.data();
|
|
159
161
|
auto& Target = MapLocalFuzzy.value();
|
|
160
162
|
|
|
161
163
|
for (const auto& [key, vec] : src.MapLocalFuzzy.value()) {
|
|
162
|
-
|
|
164
|
+
int offset = key.data() - srcpoolptr;
|
|
163
165
|
|
|
164
|
-
std::string_view keyView(poolptr +
|
|
166
|
+
std::string_view keyView(poolptr + offset, key.size());//构造键
|
|
165
167
|
for (const auto& v : vec) {
|
|
166
|
-
|
|
167
|
-
Target[keyView].emplace_back(std::string_view(poolptr +
|
|
168
|
+
int offset = v.data() - srcpoolptr;
|
|
169
|
+
Target[keyView].emplace_back(std::string_view(poolptr + offset, v.size()));
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
}
|
|
171
173
|
if (src.MapKeys.has_value()) {
|
|
172
174
|
MapKeys = std::map<std::string_view, std::string_view>();
|
|
173
|
-
ViewDeepCopy(src.MapKeys.value(), MapKeys.value());
|
|
175
|
+
ViewDeepCopy(src.pool, src.MapKeys.value(), MapKeys.value());
|
|
174
176
|
}
|
|
175
177
|
if (src.MapLocal.has_value()) {
|
|
176
178
|
MapLocal = std::map<std::string_view, std::string_view>();
|
|
177
|
-
ViewDeepCopy(src.MapLocal.value(), MapLocal.value());
|
|
179
|
+
ViewDeepCopy(src.pool, src.MapLocal.value(), MapLocal.value());
|
|
178
180
|
}
|
|
179
181
|
}
|
|
180
182
|
|
|
@@ -309,8 +311,8 @@ namespace PinInCpp {
|
|
|
309
311
|
});
|
|
310
312
|
|
|
311
313
|
const static std::map<std::string, std::string> PHONETIC_LOCAL = std::map<std::string, std::string>({
|
|
312
|
-
{"yi", "i"}, {"you", "iu"}, {"yin", "in"}, {"ye", "ie"}, {"ying", "ing"},
|
|
313
|
-
{"wu", "u"}, {"wen", "un"}, {"yu", "v"}, {"yue", "ve"}, {"yuan", "van"},
|
|
314
|
+
{"yi", "i"}, {"you", "iu"}, {"yin", "in"}, {"ye", "ie"}, {"ying", "ing"}, {"yong", "iong"},
|
|
315
|
+
{"wu", "u" }, {"wen", "un"}, {"yu", "v"}, {"yue", "ve"}, {"yuan", "van"},
|
|
314
316
|
{"yun", "vn"}, {"ju", "jv"}, {"jue", "jve"}, {"juan", "jvan"}, {"jun", "jvn"},
|
|
315
317
|
{"qu", "qv"}, {"que", "qve"}, {"quan", "qvan"}, {"qun", "qvn"}, {"xu", "xv"},
|
|
316
318
|
{"xue", "xve"}, {"xuan", "xvan"}, {"xun", "xvn"}, {"shi", "sh"}, {"si", "s"},
|
|
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "PinInPy"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.4"
|
|
8
8
|
dependencies = ["cffi"]
|
|
9
9
|
requires-python = ">=3.10"
|
|
10
10
|
authors = [
|
|
@@ -26,7 +26,6 @@ classifiers = [
|
|
|
26
26
|
"Operating System :: Microsoft :: Windows",
|
|
27
27
|
"Operating System :: POSIX :: Linux",
|
|
28
28
|
"Programming Language :: Python :: 3",
|
|
29
|
-
"Programming Language :: Python :: 3.9",
|
|
30
29
|
"Programming Language :: Python :: 3.10",
|
|
31
30
|
"Programming Language :: Python :: 3.11",
|
|
32
31
|
"Programming Language :: Python :: 3.12",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|