react-native-executorch 0.10.6 → 0.10.7

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.
Files changed (237) hide show
  1. package/lib/module/fetcher/telemetry.js +1 -1
  2. package/package.json +1 -1
  3. package/react-native-executorch.podspec +2 -0
  4. package/src/fetcher/telemetry.ts +1 -1
  5. package/third-party/common/phonemis/CMakeLists.txt +70 -14
  6. package/third-party/common/phonemis/README.md +183 -33
  7. package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
  8. package/third-party/common/phonemis/knowledge/code_style.md +642 -0
  9. package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
  10. package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
  11. package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
  12. package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
  13. package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
  14. package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
  15. package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
  16. package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
  17. package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
  18. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
  19. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
  20. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
  21. package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
  22. package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
  23. package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
  24. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
  25. package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
  26. package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
  27. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
  28. package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
  29. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
  30. package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
  31. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
  32. package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
  33. package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
  34. package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
  35. package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
  36. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
  37. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
  38. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
  39. package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
  40. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
  41. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
  42. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
  43. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
  44. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
  45. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
  46. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
  47. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
  48. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
  49. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
  50. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
  51. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
  52. package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
  53. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
  54. package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
  55. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
  56. package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
  57. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
  58. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
  59. package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
  60. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
  61. package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
  62. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
  63. package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
  64. package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
  65. package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
  66. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
  67. package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
  68. package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
  69. package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
  70. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
  71. package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
  72. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
  73. package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
  74. package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
  75. package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
  76. package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
  77. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
  78. package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
  79. package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
  80. package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
  81. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
  82. package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
  83. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
  84. package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
  85. package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
  86. package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
  87. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
  88. package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
  89. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
  90. package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
  91. package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
  92. package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
  93. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
  94. package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
  95. package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
  96. package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
  97. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
  98. package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
  99. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
  100. package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
  101. package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
  102. package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
  103. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
  104. package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
  105. package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
  106. package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
  107. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
  108. package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
  109. package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
  110. package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
  111. package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
  112. package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
  113. package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
  114. package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
  115. package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
  116. package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
  117. package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
  118. package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
  119. package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
  120. package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
  121. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
  122. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
  123. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
  124. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
  125. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
  126. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
  127. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
  128. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
  129. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
  130. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
  131. package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
  132. package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
  133. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
  134. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
  135. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
  136. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
  137. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
  138. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
  139. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
  140. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
  141. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
  142. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
  143. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
  144. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
  145. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
  146. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
  147. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
  148. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
  149. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
  150. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
  151. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
  152. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
  153. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
  154. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
  155. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
  156. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
  157. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
  158. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
  159. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
  160. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
  161. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
  162. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
  163. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
  164. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
  165. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
  166. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
  167. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
  168. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
  169. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
  170. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
  171. package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
  172. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
  173. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
  174. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
  175. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
  176. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
  177. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
  178. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
  179. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
  180. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
  181. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
  182. package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
  183. package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
  184. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
  185. package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
  186. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
  187. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
  188. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
  189. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
  190. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
  191. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
  192. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
  193. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
  194. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
  195. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
  196. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
  197. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
  198. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
  199. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
  200. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
  201. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
  202. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
  203. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
  204. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
  205. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
  206. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
  207. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
  208. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
  209. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
  210. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
  211. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
  212. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
  213. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
  214. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
  215. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
  216. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
  217. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
  218. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
  219. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
  220. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
  221. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
  222. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
  223. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
  224. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
  225. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
  226. package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
  227. package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
  228. package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
  229. package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
  230. package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
  231. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
  232. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
  233. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
  234. package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
  235. package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
  236. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
  237. package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
@@ -1,29 +1,54 @@
1
1
  #pragma once
2
2
 
3
- #include <phonemis/base/processor/num2word/layer.h>
3
+ #include <phonemis/base/processor/layers/num2word/layer.h>
4
+
4
5
  #include <string>
5
- #include <variant>
6
6
 
7
7
  namespace phonemis::de {
8
8
 
9
- class Num2Word : public processor::num2word::Num2WordLayer {
9
+ using processor::num2word::Case;
10
+ using processor::num2word::Gender;
11
+
12
+ // How the ending of an ordinal follows the word before it: am dritten (weak), ein zweiter (mixed), dritter (strong)
13
+ enum class Declension { WEAK = 0, MIXED, STRONG };
14
+
15
+ // How a German number is read, from the words around it.
16
+ struct NumberReading {
17
+ Case grammatical_case = Case::NOMINATIVE; // Given by the word before: mit einer Stimme, am dritten
18
+ Gender gender = Gender::MASCULINE; // Of the noun after: eine Stunde, der dritte Platz
19
+ Declension declension = Declension::STRONG;
20
+ bool article = false; // "1" before a noun is said like an article: eine Stunde
21
+ bool year = true; // A 4-digit number reads as a year (1998 Abi), unless it counts a noun (1945 Einwohner)
22
+ bool capitalized = true; // A decade is a noun (die Neunziger), but an adjective before Jahre (neunziger Jahre)
23
+ };
24
+
25
+ class Num2Word : public processor::num2word::Num2WordLayer<NumberReading> {
10
26
  public:
11
- using Num2WordLayer::Num2WordLayer;
12
-
13
- std::u32string transform(std::u32string_view input) const override;
14
- char32_t decimal_separator() const override { return U','; }
15
- std::u32string to_cardinal_int(int32_t number) const override;
16
- std::u32string to_cardinal_float(float number, std::u32string_view repr) const override;
17
- std::u32string to_ordinal_int(int32_t number, std::u32string_view suffix = U"") const override;
18
- std::u32string to_currency(char32_t currency, std::variant<int32_t, float> number) const override;
19
- std::u32string to_fraction(int32_t numerator, int32_t denominator) const override;
20
- std::u32string to_day(uint32_t day) const override;
21
- std::u32string to_month(uint32_t month) const override;
22
- std::u32string to_year(uint32_t year) const override;
23
- bool is_ordinal_suffix(std::u32string_view suffix) const override;
27
+ Num2Word();
24
28
 
25
29
  protected:
26
- std::u32string verbalize(const processor::num2word::StringifiedNumber& number) const override;
30
+ using Context = processor::Context;
31
+ using Match = processor::num2word::Match;
32
+ using Number = processor::num2word::Number;
33
+
34
+ // Resolution
35
+ bool accept(const Match& match, const Context& context) const override;
36
+ NumberReading resolve(const Match& match, const Context& context) const override;
37
+
38
+ // Readings
39
+ std::u32string read_number(const Number& number, const NumberReading& reading) const override;
40
+ std::u32string read_code_digits(std::u32string_view digits) const override;
41
+ std::u32string read_date(const Match& match, const NumberReading& reading) const override;
42
+ std::u32string read_phone(const Match& match, const NumberReading& reading) const override;
43
+ std::u32string read_fraction(const Match& match, const NumberReading& reading) const override;
44
+ std::u32string read_time(const Match& match, const NumberReading& reading) const override;
45
+ std::u32string read_ordinal(const Match& match, const NumberReading& reading) const override;
46
+ std::u32string read_decade(const Match& match, const NumberReading& reading) const override;
47
+ std::u32string read_compound(const Match& match, const NumberReading& reading) const override;
48
+ std::u32string read_money(const Number& number, const Match& match, const NumberReading& reading) const override;
49
+ std::u32string read_scale(const Number& number, const Match& match, const NumberReading& reading) const override;
50
+ std::u32string read_percent(const Number& number, const Match& match, const NumberReading& reading) const override;
51
+ std::u32string read_unit(const Number& number, const Match& match, const NumberReading& reading) const override;
27
52
  };
28
53
 
29
54
  } // namespace phonemis::de
@@ -0,0 +1,56 @@
1
+ #include "patterns.h"
2
+ #include <phonemis/base/processor/layers/num2word/primitives.h>
3
+ #include <phonemis/utils/unicode.h>
4
+
5
+ #include <vector>
6
+
7
+ namespace phonemis::de {
8
+
9
+ using namespace utils;
10
+ using namespace processor;
11
+ using namespace processor::num2word;
12
+
13
+ std::optional<Match> PhonePattern::match(std::u32string_view text, size_t position) const {
14
+ if (!is_clear_before(text, position, U".,") || text[position] != U'0') {
15
+ return std::nullopt;
16
+ }
17
+
18
+ // The area code and the number: written together (0301234567), or apart (030 1234567, 030/1234567)
19
+ size_t end = digits_end(text, position);
20
+ size_t length = end - position;
21
+ if (length < 6) {
22
+ bool apart = length >= 3 && end < text.size() && (text[end] == U' ' || text[end] == U'/' || text[end] == U'-') &&
23
+ digits_end(text, end + 1) >= end + 4;
24
+ if (!apart) {
25
+ return std::nullopt;
26
+ }
27
+ end = digits_end(text, end + 1);
28
+ }
29
+
30
+ // Then any further groups: 0800-123 45 67. Each could end the number, if nothing continues it there.
31
+ std::vector<size_t> ends = {end};
32
+ while (ends.back() + 1 < text.size() && (text[ends.back()] == U' ' || text[ends.back()] == U'-') &&
33
+ unicode::isdigit(text[ends.back() + 1])) {
34
+ ends.push_back(digits_end(text, ends.back() + 1));
35
+ }
36
+ for (auto it = ends.rbegin(); it != ends.rend(); ++it) {
37
+ // Not followed by a digit, even after a word character, a dot or a comma
38
+ bool continued = is_digit_after(text, *it) || (!is_clear_after(text, *it, U".,") && is_digit_after(text, *it + 1));
39
+ if (!continued) {
40
+ Match phone{.kind = Kind::PHONE, .span = {position, *it}};
41
+ for (size_t i = position; i < *it;) {
42
+ size_t digits = digits_end(text, i);
43
+ if (digits > i) {
44
+ phone.numbers.push_back(digits_at(text, i));
45
+ i = digits;
46
+ } else {
47
+ i++;
48
+ }
49
+ }
50
+ return phone;
51
+ }
52
+ }
53
+ return std::nullopt;
54
+ }
55
+
56
+ } // namespace phonemis::de
@@ -0,0 +1,15 @@
1
+ #pragma once
2
+
3
+ #include <phonemis/base/processor/layers/num2word/pattern.h>
4
+
5
+ namespace phonemis::de {
6
+
7
+ // 030 1234567, 0800-123 45 67: an area code starting with 0, then the number, optionally in groups.
8
+ class PhonePattern : public processor::num2word::Pattern {
9
+ public:
10
+ PhonePattern() : Pattern(processor::num2word::Kind::PHONE) {}
11
+
12
+ std::optional<processor::num2word::Match> match(std::u32string_view text, size_t position) const override;
13
+ };
14
+
15
+ } // namespace phonemis::de
@@ -7,8 +7,8 @@
7
7
  #include <phonemis/base/ipipeline.h>
8
8
  #include <phonemis/base/phonemizer/hybrid_phonemizer.h>
9
9
  #include <phonemis/base/phonemizer/lexicon_phonemizer.h>
10
+ #include <phonemis/base/processor/preprocessor.h>
10
11
  #include <phonemis/base/processor/processor.h>
11
- #include <phonemis/base/processor/trim_layer.h>
12
12
  #include <phonemis/base/tokenizer/tokenizer.h>
13
13
  #include <phonemis/utils/conversions.h>
14
14
 
@@ -24,8 +24,8 @@ public:
24
24
  phonemizer_(config.phonemizer) {
25
25
 
26
26
  // 1. Setup Preprocessing layers
27
- preprocessor_.add_layer(std::make_unique<processor::TrimLayer>());
28
- preprocessor_.add_layer(std::make_unique<Num2Word>());
27
+ preprocessor_ = processor::make_preprocessor<Num2Word>(
28
+ config.preprocessor, {.terms = &constants::term2word::kTerms, .symbols = &constants::sym2word::kSymbols});
29
29
  }
30
30
 
31
31
  // Performs a preprocessing stage of the pipeline.
@@ -1,55 +1,210 @@
1
1
  #pragma once
2
2
 
3
+ #include <phonemis/base/processor/layers/num2word/types.h>
4
+ #include <phonemis/base/processor/common/conditions.h>
5
+ #include <phonemis/base/processor/layers/num2word/notation.h>
6
+ #include <phonemis/base/processor/layers/term2word/types.h>
3
7
  #include <phonemis/base/tokenizer/types.h>
4
8
 
9
+ #include <array>
5
10
  #include <cstdint>
6
11
  #include <map>
7
12
  #include <string>
8
13
  #include <unordered_map>
9
14
  #include <unordered_set>
15
+ #include <utility>
10
16
  #include <vector>
11
17
 
12
18
  namespace phonemis::en::constants {
13
19
 
14
20
  // --- Number to Word Normalization ---
15
21
  namespace num2word {
16
- // Cards map: basic number -> word
17
- inline const std::unordered_map<int32_t, std::u32string> kCardinals = {
18
- {0, U"zero"}, {1, U"one"}, {2, U"two"}, {3, U"three"}, {4, U"four"},
19
- {5, U"five"}, {6, U"six"}, {7, U"seven"}, {8, U"eight"}, {9, U"nine"},
20
- {10, U"ten"}, {11, U"eleven"}, {12, U"twelve"}, {13, U"thirteen"}, {14, U"fourteen"},
21
- {15, U"fifteen"}, {16, U"sixteen"}, {17, U"seventeen"}, {18, U"eighteen"}, {19, U"nineteen"},
22
- {20, U"twenty"}, {30, U"thirty"}, {40, U"forty"}, {50, U"fifty"}, {60, U"sixty"},
23
- {70, U"seventy"}, {80, U"eighty"}, {90, U"ninety"}
24
- };
25
-
26
- // Ordinal exceptions: cardinal word -> ordinal word
27
- inline const std::unordered_map<std::u32string, std::u32string> kOrdinals = {
22
+ using ::phonemis::processor::num2word::DateFormat;
23
+ using ::phonemis::processor::num2word::Forms;
24
+ using ::phonemis::processor::num2word::Joiners;
25
+ using ::phonemis::processor::num2word::Keys;
26
+ using ::phonemis::processor::num2word::keys_of;
27
+ using ::phonemis::processor::num2word::Notation;
28
+ using ::phonemis::processor::num2word::PhoneFormat;
29
+ using ::phonemis::processor::num2word::SuffixFormat;
30
+
31
+ inline constexpr std::array<std::u32string_view, 20> kOnes = {
32
+ U"zero", U"one", U"two", U"three", U"four", U"five", U"six", U"seven", U"eight", U"nine",
33
+ U"ten", U"eleven", U"twelve", U"thirteen", U"fourteen", U"fifteen", U"sixteen", U"seventeen",U"eighteen", U"nineteen"
34
+ };
35
+
36
+ inline constexpr std::array<std::u32string_view, 10> kTens = {
37
+ U"", U"", U"twenty", U"thirty", U"forty", U"fifty", U"sixty", U"seventy", U"eighty", U"ninety"
38
+ };
39
+
40
+ // Scale words, largest first
41
+ inline const std::vector<std::pair<uint64_t, std::u32string>> kScaleWords = {
42
+ {1000000000000ULL, U"trillion"}, {1000000000ULL, U"billion"}, {1000000ULL, U"million"}, {1000ULL, U"thousand"}
43
+ };
44
+
45
+ // Ordinals which are not formed with "th": cardinal word -> ordinal word
46
+ inline const std::unordered_map<std::u32string, std::u32string> kIrregularOrdinals = {
28
47
  {U"one", U"first"}, {U"two", U"second"}, {U"three", U"third"}, {U"five", U"fifth"},
29
48
  {U"eight", U"eighth"}, {U"nine", U"ninth"}, {U"twelve", U"twelfth"}
30
49
  };
31
50
 
32
- // Large scale names: scale value -> name
33
- inline const std::map<std::int64_t, std::u32string> kLargeCardinals = {
34
- {100LL, U"hundred"},
35
- {1000LL, U"thousand"},
36
- {1000000LL, U"million"},
37
- {1000000000LL, U"billion"},
38
- {1000000000000LL, U"trillion"}
51
+ inline const std::vector<std::u32string> kMonthNames = {
52
+ U"January", U"February", U"March", U"April", U"May", U"June",
53
+ U"July", U"August", U"September", U"October", U"November", U"December"
54
+ };
55
+
56
+ inline const std::unordered_map<std::u32string, Forms> kCurrencies = {
57
+ {U"$", {U"dollar", U"dollars"}}, {U"€", {U"euro", U"euros"}}, {U"£", {U"pound", U"pounds"}}, {U"¥", {U"yen", U"yen"}}
58
+ };
59
+
60
+ inline const std::unordered_map<std::u32string, std::u32string> kScales = {
61
+ {U"thousand", U"thousand"}, {U"million", U"million"}, {U"billion", U"billion"}, {U"trillion", U"trillion"},
62
+ {U"k", U"thousand"}, {U"K", U"thousand"}, {U"M", U"million"}, {U"bn", U"billion"}
63
+ };
64
+
65
+ inline const std::unordered_map<std::u32string, Forms> kUnits = {
66
+ {U"km", {U"kilometer", U"kilometers"}}, {U"m", {U"meter", U"meters"}},
67
+ {U"cm", {U"centimeter", U"centimeters"}}, {U"mm", {U"millimeter", U"millimeters"}},
68
+ {U"nm", {U"nanometer", U"nanometers"}}, {U"m²", {U"square meter", U"square meters"}},
69
+ {U"km²", {U"square kilometer", U"square kilometers"}}, {U"m³", {U"cubic meter", U"cubic meters"}},
70
+ {U"kg", {U"kilogram", U"kilograms"}}, {U"g", {U"gram", U"grams"}},
71
+ {U"mg", {U"milligram", U"milligrams"}}, {U"lb", {U"pound", U"pounds"}},
72
+ {U"lbs", {U"pound", U"pounds"}}, {U"oz", {U"ounce", U"ounces"}},
73
+ {U"ft", {U"foot", U"feet"}}, {U"l", {U"liter", U"liters"}},
74
+ {U"L", {U"liter", U"liters"}}, {U"ml", {U"milliliter", U"milliliters"}},
75
+ {U"mL", {U"milliliter", U"milliliters"}}, {U"TB", {U"terabyte", U"terabytes"}},
76
+ {U"GB", {U"gigabyte", U"gigabytes"}}, {U"MB", {U"megabyte", U"megabytes"}},
77
+ {U"KB", {U"kilobyte", U"kilobytes"}}, {U"kB", {U"kilobyte", U"kilobytes"}},
78
+ {U"Hz", {U"hertz", U"hertz"}}, {U"kHz", {U"kilohertz", U"kilohertz"}},
79
+ {U"MHz", {U"megahertz", U"megahertz"}}, {U"GHz", {U"gigahertz", U"gigahertz"}},
80
+ {U"W", {U"watt", U"watts"}}, {U"kW", {U"kilowatt", U"kilowatts"}},
81
+ {U"kWh", {U"kilowatt-hour", U"kilowatt-hours"}}, {U"V", {U"volt", U"volts"}},
82
+ {U"mph", {U"mile per hour", U"miles per hour"}}, {U"km/h", {U"kilometer per hour", U"kilometers per hour"}},
83
+ {U"°C", {U"degree Celsius", U"degrees Celsius"}}, {U"°F", {U"degree Fahrenheit", U"degrees Fahrenheit"}},
84
+ {U"°", {U"degree", U"degrees"}}
85
+ };
86
+
87
+ inline const std::map<std::pair<uint64_t, uint64_t>, std::u32string> kFractions = {
88
+ {{1, 2}, U"one half"}, {{1, 3}, U"one third"}, {{2, 3}, U"two thirds"}, {{1, 4}, U"one quarter"},
89
+ {{3, 4}, U"three quarters"}
90
+ };
91
+
92
+ inline const Keys kTimeSuffixes = {U"a.m.", U"p.m.", U"am.", U"pm.", U"am", U"pm", U"AM", U"PM"};
93
+
94
+ // Months, also abbreviated (lowercase)
95
+ inline const std::unordered_set<std::u32string> kMonths = {
96
+ U"january", U"february", U"march", U"april", U"may", U"june", U"july", U"august", U"september", U"october",
97
+ U"november", U"december", U"jan", U"feb", U"mar", U"apr", U"jun", U"jul", U"aug", U"sep", U"sept", U"oct",
98
+ U"nov", U"dec"
99
+ };
100
+
101
+ // Words before a 4-digit number which make it a year: in 1999, since 1999 (and months)
102
+ inline const std::unordered_set<std::u32string> kYearCues = {
103
+ U"in", U"of", U"since", U"from", U"by", U"until", U"till", U"circa", U"year", U"the", U"during", U"before",
104
+ U"after", U"early", U"late", U"mid"
39
105
  };
40
106
 
41
- // Currencies
42
- inline const std::unordered_map<char32_t, std::u32string> kCurrencies = {
43
- {U'$', U"dollar"}, {U'€', U"euro"}, {U'£', U"pound"}
107
+ inline const std::unordered_set<std::u32string> kIrregularPlurals = {
108
+ U"people", U"children", U"men", U"women", U"feet", U"persons"
44
109
  };
45
110
 
46
- // Months
47
- inline const std::vector<std::u32string> kMonths = {
48
- U"", U"January", U"February", U"March", U"April", U"May", U"June",
49
- U"July", U"August", U"September", U"October", U"November", U"December"
111
+ // Words before a time with a dot, which make it a time: at 10.30
112
+ inline const std::unordered_set<std::u32string> kTimeWords = {
113
+ U"at", U"from", U"until", U"till", U"to", U"by", U"around", U"about", U"before", U"after", U"since", U"between",
114
+ U"and", U"is", U"it's", U"or"
50
115
  };
116
+
117
+ // Words after an amount that do not make it an adjective ("$5 a month" vs "a $5 bill")
118
+ inline const std::unordered_set<std::u32string> kStopWords = {
119
+ U"a", U"an", U"the", U"and", U"or", U"but", U"nor", U"in", U"on", U"at", U"to", U"for", U"of", U"per", U"with",
120
+ U"from", U"by", U"into", U"than", U"more", U"less", U"each", U"every", U"is", U"are", U"was", U"were", U"be",
121
+ U"been", U"will", U"would", U"can", U"could", U"should", U"may", U"might", U"must", U"plus", U"minus", U"times",
122
+ U"anyway", U"now", U"then", U"so", U"that", U"this", U"these", U"those", U"it", U"if", U"when", U"which", U"who",
123
+ U"what", U"where", U"why", U"how", U"you", U"i", U"we", U"they", U"he", U"she", U"as", U"up", U"down", U"off",
124
+ U"out", U"over", U"under", U"about", U"around", U"after", U"before", U"back", U"away", U"ago", U"versus", U"vs",
125
+ U"too", U"also", U"only", U"just", U"even", U"still", U"yet", U"already", U"not", U"no", U"there", U"here",
126
+ U"all", U"both", U"while", U"because", U"since", U"until", U"though", U"although", U"unless", U"has", U"have",
127
+ U"had", U"do", U"does", U"did", U"get", U"got", U"instead", U"worth", U"today", U"tomorrow", U"tonight",
128
+ U"outside", U"inside", U"apart", U"ahead", U"behind", U"above", U"below", U"long", U"wide", U"high", U"tall",
129
+ U"deep", U"old", U"later", U"earlier", U"overall"
130
+ };
131
+
132
+ // --- Notation: how numbers are written ---
133
+ inline const Notation kNotation = {
134
+ .group_separators = U",", .decimal_separators = U".", .time_separators = U":.", .time_suffixes = kTimeSuffixes,
135
+ .currencies = keys_of(kCurrencies), .scales = keys_of(kScales), .units = keys_of(kUnits), .fractions = true
136
+ };
137
+
138
+ // Words between numbers: 3.8.10, 10.0.0.51, 10-15, 1920x1080, 2:1, -5, 2 + 2
139
+ inline const Joiners kJoiners = {
140
+ .point = U"point", .dot = U"dot", .range = U" to ", .by = U"by", .score = U" to ", .minus = U"minus", .plus = U"plus"
141
+ };
142
+
143
+ // 27.03.2026, 27-03-2026: the year has four digits (3.8.10 is a version)
144
+ inline const DateFormat kDateFormat = {.separators = U".-", .boundaries = U".,/-", .short_year = false};
145
+
146
+ // 1-555-123-4567, (555) 123-4567, 555.123.4567, 555 123 4567, 555-1234: the longest first, each its own pass
147
+ inline const std::vector<PhoneFormat> kPhoneFormats = {
148
+ {.groups = {{3, 3}, {3, 3}, {4, 4}}, .prefix = U"1-"},
149
+ {.groups = {{3, 3}, {3, 3}, {4, 4}}, .parenthesized = true},
150
+ {.groups = {{3, 3}, {3, 3}, {4, 4}}, .separators = U"."},
151
+ {.groups = {{3, 3}, {3, 3}, {4, 4}}, .separators = U" "},
152
+ {.groups = {{3, 3}, {4, 4}}}
153
+ };
154
+
155
+ // 21st, 2nd, 3rd, 4th
156
+ inline const Keys kOrdinalSuffixes = {U"st", U"nd", U"rd", U"th"};
157
+
158
+ // 1990s, '90s, 90's
159
+ inline const Keys kDecadeSuffixes = {U"s"};
160
+ inline const SuffixFormat kDecadeFormat = {.apostrophes = true, .boundaries = U".,-"};
51
161
  } // namespace num2word
52
162
 
163
+ // --- Symbols to Word Normalization ---
164
+ namespace sym2word {
165
+ using ::phonemis::processor::Readings;
166
+
167
+ inline const Readings kSymbols = {
168
+ {U"&", {U"and"}}, {U"+", {U"plus"}}, {U"=", {U"equals"}}, {U"@", {U"at"}}, {U"%", {U"percent"}},
169
+ {U"°", {U"degrees"}}, {U"#", {U"number"}}, {U"²", {U"squared"}}, {U"³", {U"cubed"}}, {U"π", {U"pi"}},
170
+ {U"×", {U"times"}}, {U"±", {U"plus or minus"}}, {U"½", {U"one half"}}
171
+ };
172
+ } // namespace sym2word
173
+
174
+ // --- Terms to Word Normalization ---
175
+ namespace term2word {
176
+ using ::phonemis::processor::before_name;
177
+ using ::phonemis::processor::before_number;
178
+ using ::phonemis::processor::term2word::Terms;
179
+
180
+ inline const Terms kTerms = {
181
+ .abbreviations = {
182
+ // Before a number only: No. 5
183
+ {U"No.", {{U"number", before_number}}},
184
+ {U"no.", {{U"number", before_number}}},
185
+ {U"Nos.", {{U"numbers", before_number}}},
186
+ {U"vol.", {{U"volume", before_number}}},
187
+ {U"Vol.", {{U"volume", before_number}}},
188
+ {U"p.", {{U"page", before_number}}},
189
+ {U"pp.", {{U"pages", before_number}}},
190
+ {U"ch.", {{U"chapter", before_number}}},
191
+ {U"Ch.", {{U"chapter", before_number}}},
192
+ {U"fig.", {{U"figure", before_number}}},
193
+ {U"Fig.", {{U"figure", before_number}}},
194
+ // Anywhere
195
+ {U"e.g.", {U"for example"}},
196
+ {U"i.e.", {U"that is"}},
197
+ {U"etc.", {U"et cetera"}},
198
+ {U"vs.", {U"versus"}},
199
+ {U"Mr.", {U"Mister"}},
200
+ {U"Mrs.", {U"Missus"}},
201
+ {U"Dr.", {{U"Doctor", before_name}}},
202
+ {U"St.", {{U"Saint", before_name}, U"Street"}},
203
+ },
204
+ .web = {.dot = U"dot", .at = U"at", .slash = U"slash"}
205
+ };
206
+ } // namespace term2word
207
+
53
208
  // --- Tokenization Rules ---
54
209
  namespace tokenizer {
55
210
  using ::phonemis::tokenizer::split::Rule;
@@ -115,10 +270,6 @@ namespace ipa {
115
270
  } // namespace ipa
116
271
 
117
272
  // --- Symbols & Punctuation Mapping ---
118
- inline const std::unordered_map<char32_t, char32_t> kSanitizerReplacements = {
119
- {U'’', U'\''}
120
- };
121
-
122
273
  inline const std::unordered_map<char32_t, std::u32string> kAddSymbols = {
123
274
  {U'.', U"dot"},
124
275
  {U'/', U"slash"}
@@ -16,13 +16,11 @@ bool HMMTagger::should_lowercase(std::u32string_view word) const {
16
16
  Tag best_tag = "XX";
17
17
  double max_prob = -std::numeric_limits<double>::infinity();
18
18
 
19
- for (const auto& [tag, word_map] : emission_probs_) {
20
- auto it = word_map.find(utf8_lower_word);
21
- if (it != word_map.end()) {
22
- if (it->second > max_prob) {
23
- max_prob = it->second;
24
- best_tag = tag;
25
- }
19
+ for (size_t id = 0; id < emission_probs_.size(); ++id) {
20
+ auto it = emission_probs_[id].find(utf8_lower_word);
21
+ if (it != emission_probs_[id].end() && it->second > max_prob) {
22
+ max_prob = it->second;
23
+ best_tag = tag_names_[id];
26
24
  }
27
25
  }
28
26