PinInPy 1.0.4__tar.gz → 1.0.6__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.4 → pininpy-1.0.6}/PKG-INFO +1 -1
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/CMakeLists.txt +1 -1
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/Keyboard.h +3 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/Keyboard.cpp +23 -14
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/PinInCAPI.cpp +1 -1
- {pininpy-1.0.4 → pininpy-1.0.6}/pyproject.toml +1 -1
- {pininpy-1.0.4 → pininpy-1.0.6}/.editorconfig +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/.github/workflows/python-publish.yml +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/.gitignore +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/.gitmodules +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/CMakeLists.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/LICENSE +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/.editorconfig +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/.gitattributes +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/.gitignore +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/CMakeSettings.json +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/FFIExample/PinInLua.lua +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/LICENSE +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/README.md +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/cmake/PinIn4CppConfig.cmake.in +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/example/PinyinTest.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/ParallelSearch.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/PinIn.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/PinInCAPI.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/PinyinFormat.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/TreeSearcher.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/Accelerator.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/AdaptiveContainers.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/BinUtils.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/IndexSet.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/ObjectPool.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/StringPool.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/include/PinIn4Cpp/detail/StringUtils.h +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/licenses/PinIn.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/licenses/pinyin-data.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/PinIn.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/PinyinFormat.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/TreeSearcher.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/utils/Accelerator.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/utils/BinUtils.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/utils/IndexSet.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/utils/StringPool.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/src/utils/StringUtils.cpp +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/test_data/large.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/test_data/pinyin.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/PinIn4Cpp/test_data/small.txt +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/README.md +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/build_cffi.py +0 -0
- {pininpy-1.0.4 → pininpy-1.0.6}/package/__init__.py +0 -0
|
@@ -100,6 +100,9 @@ namespace PinInCpp {
|
|
|
100
100
|
public: //作为字符串视图的数据源,他不需要终止符
|
|
101
101
|
StrPool() = default;
|
|
102
102
|
StrPool(const StrPool&) = default;
|
|
103
|
+
StrPool& operator=(const StrPool& src) = default;
|
|
104
|
+
StrPool(StrPool&&) noexcept = default;
|
|
105
|
+
StrPool& operator=(StrPool&&) noexcept = default;
|
|
103
106
|
size_t put(std::string_view str) {
|
|
104
107
|
size_t result = strs.size();
|
|
105
108
|
strs.insert(strs.end(), str.begin(), str.end());
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#include "PinIn4Cpp/Keyboard.h"
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
namespace PinInCpp {
|
|
4
4
|
namespace detail {
|
|
5
5
|
bool hasInitial(std::string_view s) {//判断是否有声母
|
|
@@ -93,10 +93,10 @@ namespace PinInCpp {
|
|
|
93
93
|
char* poolptr = pool.data();
|
|
94
94
|
const char* srcpoolptr = srcPool.data();
|
|
95
95
|
for (const auto& [key, value] : srcMap) {
|
|
96
|
-
|
|
96
|
+
size_t KeyOffset = key.data() - srcpoolptr;
|
|
97
97
|
size_t keySize = key.size();
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
size_t valueOffset = value.data() - srcpoolptr;
|
|
100
100
|
size_t valueSize = value.size();
|
|
101
101
|
Target.insert_or_assign(std::string_view(poolptr + KeyOffset, keySize), std::string_view(poolptr + valueOffset, valueSize));
|
|
102
102
|
}
|
|
@@ -146,7 +146,6 @@ namespace PinInCpp {
|
|
|
146
146
|
duo = src.duo;
|
|
147
147
|
sequence = src.sequence;
|
|
148
148
|
cutter = src.cutter;
|
|
149
|
-
|
|
150
149
|
copy(src);
|
|
151
150
|
return *this;
|
|
152
151
|
}
|
|
@@ -161,23 +160,33 @@ namespace PinInCpp {
|
|
|
161
160
|
auto& Target = MapLocalFuzzy.value();
|
|
162
161
|
|
|
163
162
|
for (const auto& [key, vec] : src.MapLocalFuzzy.value()) {
|
|
164
|
-
|
|
163
|
+
size_t offset = key.data() - srcpoolptr;
|
|
165
164
|
|
|
166
165
|
std::string_view keyView(poolptr + offset, key.size());//构造键
|
|
167
166
|
for (const auto& v : vec) {
|
|
168
|
-
|
|
167
|
+
size_t offset = v.data() - srcpoolptr;
|
|
169
168
|
Target[keyView].emplace_back(std::string_view(poolptr + offset, v.size()));
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
171
|
}
|
|
172
|
+
else {//防止多重赋值的问题,下面也是
|
|
173
|
+
MapLocalFuzzy = std::nullopt;
|
|
174
|
+
}
|
|
175
|
+
|
|
173
176
|
if (src.MapKeys.has_value()) {
|
|
174
177
|
MapKeys = std::map<std::string_view, std::string_view>();
|
|
175
178
|
ViewDeepCopy(src.pool, src.MapKeys.value(), MapKeys.value());
|
|
176
179
|
}
|
|
180
|
+
else {
|
|
181
|
+
MapKeys = std::nullopt;
|
|
182
|
+
}
|
|
177
183
|
if (src.MapLocal.has_value()) {
|
|
178
184
|
MapLocal = std::map<std::string_view, std::string_view>();
|
|
179
185
|
ViewDeepCopy(src.pool, src.MapLocal.value(), MapLocal.value());
|
|
180
186
|
}
|
|
187
|
+
else {
|
|
188
|
+
MapLocal = std::nullopt;
|
|
189
|
+
}
|
|
181
190
|
}
|
|
182
191
|
|
|
183
192
|
std::string_view Keyboard::keys(std::string_view s)const noexcept {
|
|
@@ -379,12 +388,12 @@ namespace PinInCpp {
|
|
|
379
388
|
|
|
380
389
|
const Keyboard Keyboard::QUANPIN = Keyboard(std::nullopt, std::nullopt, Keyboard::Standard, false, true);
|
|
381
390
|
const Keyboard Keyboard::DAQIAN = Keyboard(PHONETIC_LOCAL, DAQIAN_KEYS, Keyboard::Standard, false, false);
|
|
382
|
-
const Keyboard Keyboard::XIAOHE = Keyboard(std::nullopt, XIAOHE_KEYS, Keyboard::Zero,
|
|
383
|
-
const Keyboard Keyboard::ZIRANMA = Keyboard(std::nullopt, ZIRANMA_KEYS, Keyboard::Zero,
|
|
384
|
-
const Keyboard Keyboard::SOUGOU = Keyboard(std::nullopt, SOUGOU_KEYS, Keyboard::ZeroOInitial,
|
|
385
|
-
const Keyboard Keyboard::ZHINENG_ABC = Keyboard(std::nullopt, ZHINENG_ABC_KEYS, Keyboard::ZeroOInitial,
|
|
386
|
-
const Keyboard Keyboard::GUOBIAO = Keyboard(std::nullopt, GUOBIAO_KEYS, Keyboard::ZeroAInitial,
|
|
387
|
-
const Keyboard Keyboard::MICROSOFT = Keyboard(std::nullopt, MICROSOFT_KEYS, Keyboard::ZeroOInitial,
|
|
388
|
-
const Keyboard Keyboard::PINYINPP = Keyboard(std::nullopt, PINYINPP_KEYS, Keyboard::Zero,
|
|
389
|
-
const Keyboard Keyboard::ZIGUANG = Keyboard(std::nullopt, ZIGUANG_KEYS, Keyboard::ZeroOInitial,
|
|
391
|
+
const Keyboard Keyboard::XIAOHE = Keyboard(std::nullopt, XIAOHE_KEYS, Keyboard::Zero, false, false);
|
|
392
|
+
const Keyboard Keyboard::ZIRANMA = Keyboard(std::nullopt, ZIRANMA_KEYS, Keyboard::Zero, false, false);
|
|
393
|
+
const Keyboard Keyboard::SOUGOU = Keyboard(std::nullopt, SOUGOU_KEYS, Keyboard::ZeroOInitial, false, false);
|
|
394
|
+
const Keyboard Keyboard::ZHINENG_ABC = Keyboard(std::nullopt, ZHINENG_ABC_KEYS, Keyboard::ZeroOInitial, false, false);
|
|
395
|
+
const Keyboard Keyboard::GUOBIAO = Keyboard(std::nullopt, GUOBIAO_KEYS, Keyboard::ZeroAInitial, false, false);
|
|
396
|
+
const Keyboard Keyboard::MICROSOFT = Keyboard(std::nullopt, MICROSOFT_KEYS, Keyboard::ZeroOInitial, false, false);
|
|
397
|
+
const Keyboard Keyboard::PINYINPP = Keyboard(std::nullopt, PINYINPP_KEYS, Keyboard::Zero, false, false);
|
|
398
|
+
const Keyboard Keyboard::ZIGUANG = Keyboard(std::nullopt, ZIGUANG_KEYS, Keyboard::ZeroOInitial, false, false);
|
|
390
399
|
}
|
|
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
|