|
16 | 16 | #include <vector> |
17 | 17 | #include <fcitx-utils/log.h> |
18 | 18 | #include <fcitx-utils/stringutils.h> |
| 19 | +#include "pinyindata_p.h" |
19 | 20 | #include "pinyinencoder.h" |
20 | 21 |
|
21 | 22 | namespace libime { |
@@ -152,6 +153,39 @@ getInnerSegment() { |
152 | 153 | return innerSegment; |
153 | 154 | } |
154 | 155 |
|
| 156 | +const InnerSegmentMap &getInnerSegmentV2() { |
| 157 | + static const InnerSegmentMap innerSegment = []() { |
| 158 | + InnerSegmentMap innerSegmentV2; |
| 159 | + for (const auto &[key, value] : getInnerSegment()) { |
| 160 | + innerSegmentV2[key].push_back(value); |
| 161 | + } |
| 162 | + |
| 163 | + for (const auto &newItem : std::vector< |
| 164 | + std::pair<std::string, std::pair<std::string, std::string>>>{ |
| 165 | + {"qiao", {"qia", "o"}}, |
| 166 | + {"niao", {"nia", "o"}}, |
| 167 | + {"liao", {"lia", "o"}}, |
| 168 | + {"zhuo", {"zhu", "o"}}, |
| 169 | + {"diao", {"dia", "o"}}, |
| 170 | + {"shao", {"sha", "o"}}, |
| 171 | + {"xiao", {"xia", "o"}}, |
| 172 | + {"zhua", {"zhu", "a"}}, |
| 173 | + {"shuo", {"shu", "o"}}, |
| 174 | + {"shua", {"shu", "a"}}, |
| 175 | + {"zhao", {"zha", "o"}}, |
| 176 | + {"jiao", {"jia", "o"}}, |
| 177 | + {"chuo", {"chu", "o"}}, |
| 178 | + {"chua", {"chu", "a"}}, |
| 179 | + {"chao", {"cha", "o"}}, |
| 180 | + }) { |
| 181 | + innerSegmentV2[newItem.first].push_back(newItem.second); |
| 182 | + } |
| 183 | + return innerSegmentV2; |
| 184 | + }(); |
| 185 | + |
| 186 | + return innerSegment; |
| 187 | +} |
| 188 | + |
155 | 189 | inline bool operator==(const PinyinEntry &a, const PinyinEntry &b) { |
156 | 190 | return a.pinyin() == b.pinyin() && a.initial() == b.initial() && |
157 | 191 | a.final() == b.final() && a.flags() == b.flags(); |
|
0 commit comments