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
@@ -0,0 +1,83 @@
1
+ #include "patterns.h"
2
+ #include <phonemis/base/processor/layers/num2word/primitives.h>
3
+ #include <phonemis/utils/conversions.h>
4
+
5
+ #include <array>
6
+ #include <optional>
7
+ #include <string>
8
+
9
+ namespace phonemis::fr {
10
+
11
+ using namespace processor;
12
+ using namespace processor::num2word;
13
+
14
+ namespace {
15
+ int roman_digit(char32_t c) {
16
+ switch (c) {
17
+ case U'I':
18
+ return 1;
19
+ case U'V':
20
+ return 5;
21
+ case U'X':
22
+ return 10;
23
+ case U'L':
24
+ return 50;
25
+ case U'C':
26
+ return 100;
27
+ default:
28
+ return 0;
29
+ }
30
+ }
31
+
32
+ // The value of a Roman numeral written in its canonical form (XIX, not XVIIII).
33
+ std::optional<int> roman_value(std::u32string_view numeral) {
34
+ int value = 0;
35
+ for (size_t i = 0; i < numeral.size(); ++i) {
36
+ int digit = roman_digit(numeral[i]);
37
+ value += i + 1 < numeral.size() && digit < roman_digit(numeral[i + 1]) ? -digit : digit;
38
+ }
39
+
40
+ static constexpr std::array<std::pair<int, std::u32string_view>, 9> kSymbols = {
41
+ {{100, U"C"}, {90, U"XC"}, {50, U"L"}, {40, U"XL"}, {10, U"X"}, {9, U"IX"}, {5, U"V"}, {4, U"IV"}, {1, U"I"}}};
42
+ std::u32string canonical;
43
+ for (int rest = value; const auto& [symbol_value, symbol] : kSymbols) {
44
+ for (; rest >= symbol_value; rest -= symbol_value) {
45
+ canonical += symbol;
46
+ }
47
+ }
48
+ return canonical == numeral ? std::optional(value) : std::nullopt;
49
+ }
50
+ } // namespace
51
+
52
+ std::optional<Match> RomanOrdinalPattern::match(std::u32string_view text, size_t position) const {
53
+ if (!is_clear_before(text, position)) {
54
+ return std::nullopt;
55
+ }
56
+
57
+ // Two Roman digits or more, or a single I (Ier)
58
+ size_t end = position;
59
+ while (end < text.size() && roman_digit(text[end])) {
60
+ end++;
61
+ }
62
+ std::u32string_view numeral = text.substr(position, end - position);
63
+ if (numeral.size() < 2 && numeral != U"I") {
64
+ return std::nullopt;
65
+ }
66
+ auto value = roman_value(numeral);
67
+ if (!value) {
68
+ return std::nullopt;
69
+ }
70
+
71
+ for (auto suffix : keys_at(text, end, {U"er", U"re", U"ère", U"e", U"ème"})) {
72
+ if (is_clear_after(text, end + suffix.size())) {
73
+ std::u32string digits = utils::conversions::utf8_to_u32(std::to_string(*value));
74
+ return Match{.kind = Kind::ORDINAL,
75
+ .span = {position, end + suffix.size()},
76
+ .numbers = {{.span = {position, end}, .integer = digits}},
77
+ .suffix = suffix};
78
+ }
79
+ }
80
+ return std::nullopt;
81
+ }
82
+
83
+ } // namespace phonemis::fr
@@ -0,0 +1,15 @@
1
+ #pragma once
2
+
3
+ #include <phonemis/base/processor/layers/num2word/pattern.h>
4
+
5
+ namespace phonemis::fr {
6
+
7
+ // XXe, XIXème, Ier: an ordinal written in Roman numerals. Its number is the value of the numeral.
8
+ class RomanOrdinalPattern : public processor::num2word::Pattern {
9
+ public:
10
+ RomanOrdinalPattern() : Pattern(processor::num2word::Kind::ORDINAL) {}
11
+
12
+ std::optional<processor::num2word::Match> match(std::u32string_view text, size_t position) const override;
13
+ };
14
+
15
+ } // namespace phonemis::fr
@@ -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,5 +1,9 @@
1
1
  #pragma once
2
2
 
3
+ #include <phonemis/base/processor/common/conditions.h>
4
+ #include <phonemis/base/processor/layers/normalize/types.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
 
5
9
  #include <array>
@@ -12,8 +16,25 @@
12
16
 
13
17
  namespace phonemis::hi::constants {
14
18
 
19
+ // --- Character Normalization ---
20
+ namespace normalize {
21
+ using ::phonemis::processor::normalize::Characters;
22
+
23
+ // Echo's classes, but the zero-width non-joiner and joiner stay: they decide how Devanagari letters join
24
+ inline const Characters kCharacters = {
25
+ {U"…", U"..."}, // Ellipsis
26
+ {U"«»„“”‟˝", U"\""}, // Quotes
27
+ {U"‘’‚‛´`ʼ", U"'"}, // Apostrophes
28
+ {U"\u200b\ufeff", U""} // Invisible: zero-width space, byte order mark
29
+ };
30
+ } // namespace normalize
31
+
15
32
  // --- Number to Word Normalization ---
16
33
  namespace num2word {
34
+ using ::phonemis::processor::num2word::DateFormat;
35
+ using ::phonemis::processor::num2word::Joiners;
36
+ using ::phonemis::processor::num2word::keys_of;
37
+ using ::phonemis::processor::num2word::Notation;
17
38
  // Hindi has unique cardinal words for every number 0-99 — they are not
18
39
  // compositionally derivable from tens + units like in most European
19
40
  // languages. Above 99 the construction becomes regular: hundreds use
@@ -53,10 +74,10 @@ namespace num2word {
53
74
 
54
75
  // Currencies. Hindi loanword currencies are invariable in form, so only the
55
76
  // singular noun is stored.
56
- inline const std::unordered_map<char32_t, std::u32string> kCurrencies = {
57
- {U'$', U"डॉलर"},
58
- {U'€', U"यूरो"},
59
- {U'£', U"पाउंड"}
77
+ inline const std::unordered_map<std::u32string, std::u32string> kCurrencies = {
78
+ {U"$", U"डॉलर"},
79
+ {U"€", U"यूरो"},
80
+ {U"£", U"पाउंड"}
60
81
  };
61
82
 
62
83
  // Months: standard Gregorian month names in Hindi (used as-is in dates).
@@ -84,15 +105,46 @@ namespace num2word {
84
105
  U"वाँ", U"वीं", U"वें"
85
106
  };
86
107
 
87
- // Recognized ordinal suffixes for digit-attached notation. Only the
88
- // alpha-only base "व" is matched at scan time; trailing matras / nasal
89
- // marks of the suffix are reattached to the verbalized form because the
90
- // base scanner does not classify combining marks as alphabetic.
91
- inline const std::unordered_set<std::u32string> kOrdinalSuffixes = {
92
- U"व"
108
+ // Ordinal suffixes after digits, in the order of OrdinalForms: 5वाँ, 5वीं, 5वें
109
+ inline const std::vector<std::u32string> kOrdinalSuffixes = {
110
+ U"वाँ", U"वीं", U"वें"
111
+ };
112
+
113
+ // --- Notation: how numbers are written ---
114
+ inline const Notation kNotation = {
115
+ .group_separators = U",", .decimal_separators = U".", .time_separators = U":", .currencies = keys_of(kCurrencies),
116
+ .fractions = true
117
+ };
118
+
119
+ // Words between numbers: 3.8.10, 10.0.0.51, 10-15, 1920x1080, 2:1, -5, 2 + 2
120
+ inline const Joiners kJoiners = {
121
+ .point = U"दशमलव", .dot = U"दशमलव", .range = U" से ", .by = U"गुणा", .score = U" ", .minus = U"माइनस", .plus = U"प्लस"
93
122
  };
123
+
124
+ // 27.03.2026, 27-03-2026: the year has four digits
125
+ inline const DateFormat kDateFormat = {.separators = U".-/", .short_year = false};
94
126
  } // namespace num2word
95
127
 
128
+ // --- Symbols to Word Normalization ---
129
+ namespace sym2word {
130
+ using ::phonemis::processor::Readings;
131
+
132
+ // TODO: not verified against a reference verbalizer yet
133
+ inline const Readings kSymbols = {
134
+ {U"&", {U"और"}}, {U"+", {U"प्लस"}}, {U"=", {U"बराबर"}}, {U"%", {U"प्रतिशत"}}, {U"@", {U"एट"}},
135
+ {U"°", {U"डिग्री"}}, {U"$", {U"डॉलर"}}, {U"€", {U"यूरो"}}, {U"£", {U"पाउंड"}}, {U"₹", {U"रुपये"}}
136
+ };
137
+ } // namespace sym2word
138
+
139
+ // --- Terms to Word Normalization ---
140
+ namespace term2word {
141
+ using ::phonemis::processor::term2word::Terms;
142
+
143
+ inline const Terms kTerms = {
144
+ .web = {.dot = U"डॉट", .at = U"एट", .slash = U"स्लैश"}
145
+ };
146
+ } // namespace term2word
147
+
96
148
  // --- Tokenization Rules ---
97
149
  namespace tokenizer {
98
150
  using ::phonemis::tokenizer::split::Rule;
@@ -1,162 +1,113 @@
1
- #include "num2word.h"
2
1
  #include "constants.h"
3
- #include <phonemis/utils/conversions.h>
2
+ #include "num2word.h"
3
+ #include <phonemis/base/processor/layers/num2word/numerals.h>
4
+ #include <phonemis/base/processor/layers/num2word/patterns.h>
5
+
4
6
  #include <algorithm>
5
- #include <cmath>
6
7
  #include <cstddef>
7
- #include <cstdlib>
8
8
 
9
9
  namespace phonemis::hi {
10
10
 
11
- using namespace constants;
12
- using namespace phonemis::utils;
11
+ using namespace constants::num2word;
12
+ using namespace processor;
13
+ using namespace processor::num2word;
13
14
 
14
15
  namespace {
15
-
16
- // Hindi ordinals split into three gender/number forms. The numeric values
17
- // align with the column order used in `kOrdinalsSpecial` and `kOrdinalEndings`.
18
- enum class OrdinalForm : std::size_t { MASCULINE = 0, FEMININE = 1, PLURAL = 2 };
19
-
20
- // Maps an ordinal suffix to a gender/number form. The base scanner only
21
- // captures the alpha portion ("व") of a Devanagari suffix because matras and
22
- // nasal marks aren't classified as alphabetic, so the masculine form is the
23
- // only one selectable through digit-attached notation in raw text. Direct
24
- // API callers can pass the full ending ("वाँ", "वीं", "वें") to pick a
25
- // specific form.
26
- OrdinalForm form_from_suffix(std::u32string_view suffix) {
27
- if (suffix == U"वीं") return OrdinalForm::FEMININE;
28
- if (suffix == U"वें") return OrdinalForm::PLURAL;
29
- return OrdinalForm::MASCULINE;
16
+ uint64_t value(const Number& number) {
17
+ return value_of(number.integer).value_or(0);
30
18
  }
31
19
 
32
- } // namespace
33
-
34
- std::u32string Num2Word::to_cardinal_int(int32_t value) const {
35
- if (value < 0) {
36
- return U"माइनस " + to_cardinal_int(std::abs(value));
20
+ // Every number up to 99 is its own word; then "<digit> सौ", and the Indian scales (हज़ार, लाख, करोड़)
21
+ std::u32string cardinal(uint64_t n) {
22
+ if (n < 100) {
23
+ return kCardinals.at(static_cast<int32_t>(n));
37
24
  }
38
-
39
- if (auto it = num2word::kCardinals.find(value); it != num2word::kCardinals.end()) {
40
- return it->second;
25
+ if (n < 1000) {
26
+ uint64_t rest = n % 100;
27
+ return kCardinals.at(static_cast<int32_t>(n / 100)) + U" सौ" + (rest ? U" " + cardinal(rest) : U"");
41
28
  }
42
29
 
43
- if (value < 1000) {
44
- // 100-999: "<digit> सौ" with an optional remainder. Hindi keeps "एक"
45
- // before "सौ" (one hundred reads as "एक सौ", not bare "सौ").
46
- int32_t hundreds_high = value / 100;
47
- int32_t rest = value % 100;
48
- std::u32string head = num2word::kCardinals.at(hundreds_high) + U" सौ";
49
- if (rest == 0) return head;
50
- return head + U" " + to_cardinal_int(rest);
51
- }
52
-
53
- // Indian-numbering decomposition (हज़ार / लाख / करोड़) in descending order.
54
- // Unlike Western numbering, the next scale up after हज़ार multiplies by 100
55
- // (lakh = 100k) and then 100 again (crore = 10M), so 1,000,000 reads as
56
- // "दस लाख" rather than as a million-scoped phrase.
57
- for (auto it = num2word::kLargeCardinals.rbegin(); it != num2word::kLargeCardinals.rend(); ++it) {
58
- int64_t base = it->first;
59
- if (static_cast<int64_t>(value) >= base) {
60
- int32_t high = value / static_cast<int32_t>(base);
61
- int32_t low = value % static_cast<int32_t>(base);
62
-
63
- // Hindi keeps the leading "एक" in front of every scale noun (e.g.
64
- // 1000 -> "एक हज़ार", 100000 -> "एक लाख"), unlike European languages
65
- // that drop the multiplier of one.
66
- std::u32string res = to_cardinal_int(high) + U" " + it->second;
67
- if (low > 0) {
68
- res += U" " + to_cardinal_int(low);
69
- }
70
- return res;
30
+ // Hindi keeps the "एक" of every scale: एक हज़ार, एक लाख
31
+ for (auto it = kLargeCardinals.rbegin(); it != kLargeCardinals.rend(); ++it) {
32
+ auto base = static_cast<uint64_t>(it->first);
33
+ if (n >= base) {
34
+ uint64_t low = n % base;
35
+ return cardinal(n / base) + U" " + it->second + (low ? U" " + cardinal(low) : U"");
71
36
  }
72
37
  }
73
-
74
- return conversions::utf8_to_u32(std::to_string(value));
38
+ return U"";
75
39
  }
76
40
 
77
- std::u32string Num2Word::to_cardinal_float(float value, std::u32string_view repr) const {
78
- if (value < 0.0f) {
79
- return U"माइनस " + to_cardinal_float(std::abs(value), repr);
80
- }
81
-
82
- std::string value_str = conversions::u32_to_utf8(repr);
83
-
84
- // Trim trailing zeros and any dangling decimal point.
85
- auto rit = std::find_if(value_str.rbegin(), value_str.rend(),
86
- [](char c) { return c != '0'; });
87
- value_str = std::string(value_str.begin(), rit.base());
88
- if (!value_str.empty() && value_str.back() == '.') {
89
- value_str.pop_back();
90
- }
91
-
92
- size_t dot_pos = value_str.find('.');
93
- if (dot_pos == std::string::npos) {
94
- return to_cardinal_int(value_str.empty() ? 0 : std::stoi(value_str));
41
+ std::u32string digits(std::u32string_view text) {
42
+ std::vector<std::u32string> words;
43
+ for (char32_t c : text) {
44
+ words.push_back(cardinal(c - U'0'));
95
45
  }
96
-
97
- std::string integer_part_str = value_str.substr(0, dot_pos);
98
- std::string fractional_part_str = value_str.substr(dot_pos + 1);
99
- int32_t integer_part = integer_part_str.empty() ? 0 : std::stoi(integer_part_str);
100
-
101
- // Hindi reads the fractional part digit-by-digit (e.g. 0.05 -> "शून्य
102
- // दशमलव शून्य पाँच"), unlike languages that verbalize it as a whole number.
103
- std::u32string frac_words;
104
- for (char c : fractional_part_str) {
105
- if (!frac_words.empty()) frac_words += U" ";
106
- frac_words += to_cardinal_int(c - '0');
107
- }
108
-
109
- return to_cardinal_int(integer_part) + U" दशमलव " + frac_words;
46
+ return join(words);
110
47
  }
48
+ } // namespace
111
49
 
112
- std::u32string Num2Word::to_ordinal_int(int32_t value, std::u32string_view suffix) const {
113
- OrdinalForm form = form_from_suffix(suffix);
50
+ Num2Word::Num2Word() : Num2WordLayer(kNotation, kJoiners) {
51
+ add_pattern(std::make_unique<DatePattern>(kDateFormat));
52
+ add_pattern(std::make_unique<SuffixPattern>(Kind::ORDINAL, kOrdinalSuffixes));
53
+ }
114
54
 
115
- if (auto it = num2word::kOrdinalsSpecial.find(value); it != num2word::kOrdinalsSpecial.end()) {
116
- return it->second[static_cast<std::size_t>(form)];
55
+ std::u32string Num2Word::read_number(const Number& number, const NumberReading& reading) const {
56
+ if (number.fraction.empty() && spoken_digits(number, 7)) {
57
+ return digits(number.integer);
117
58
  }
118
59
 
119
- // Regular ordinal: cardinal phrase with the gender-specific ending fused
120
- // onto the last token (no separating space, e.g. "इक्कीसवाँ").
121
- return to_cardinal_int(value) + num2word::kOrdinalEndings[static_cast<std::size_t>(form)];
60
+ // The fraction is read digit by digit, without its trailing zeros: 0.50 -> शून्य दशमलव पाँच
61
+ std::u32string_view fraction = number.fraction;
62
+ fraction = fraction.substr(0, fraction.find_last_not_of(U'0') + 1);
63
+ std::u32string integer = cardinal(value(number));
64
+ return fraction.empty() ? integer : integer + U" दशमलव " + digits(fraction);
122
65
  }
123
66
 
124
- std::u32string Num2Word::to_currency(char32_t currency, std::variant<int32_t, float> /*number*/) const {
125
- // Hindi loanword currencies (डॉलर, यूरो, पाउंड) are invariant; the same
126
- // form is used regardless of the amount.
127
- if (auto it = num2word::kCurrencies.find(currency); it != num2word::kCurrencies.end()) {
128
- return it->second;
67
+ std::u32string Num2Word::read_code_digits(std::u32string_view text) const {
68
+ auto n = value_of(text);
69
+ if ((text.size() > 1 && text[0] == U'0') || text.size() >= 7 || !n) {
70
+ return digits(text);
129
71
  }
130
- return std::u32string(1, currency);
72
+ return cardinal(*n);
131
73
  }
132
74
 
133
- std::u32string Num2Word::to_fraction(int32_t numerator, int32_t denominator) const {
134
- // Common fractions have dedicated Hindi nouns; everything else falls back
135
- // to the colloquial "<num> बटा <den>" pattern.
136
- if (numerator == 1 && denominator == 2) return U"आधा";
137
- if (denominator == 3) return to_cardinal_int(numerator) + U" तिहाई";
138
- if (denominator == 4) return to_cardinal_int(numerator) + U" चौथाई";
139
- return to_cardinal_int(numerator) + U" बटा " + to_cardinal_int(denominator);
75
+ std::u32string Num2Word::read_date(const Match& match, const NumberReading& reading) const {
76
+ // सत्ताईस मार्च दो हज़ार छब्बीस
77
+ return cardinal(value(match.numbers[0])) + U" " + kMonths[value(match.numbers[1])] + U" " +
78
+ cardinal(value(match.numbers[2]));
140
79
  }
141
80
 
142
- std::u32string Num2Word::to_day(uint32_t day) const {
143
- // Hindi dates render the day as a plain cardinal (e.g. "27 मार्च").
144
- return to_cardinal_int(static_cast<int32_t>(day));
81
+ std::u32string Num2Word::read_fraction(const Match& match, const NumberReading& reading) const {
82
+ // Common fractions have their own nouns, others are "<a> बटा <b>"
83
+ uint64_t a = value(match.numbers[0]), b = value(match.numbers[1]);
84
+ if (a == 1 && b == 2) {
85
+ return U"आधा";
86
+ }
87
+ if (b == 3 || b == 4) {
88
+ return cardinal(a) + (b == 3 ? U" तिहाई" : U" चौथाई");
89
+ }
90
+ return cardinal(a) + U" बटा " + cardinal(b);
145
91
  }
146
92
 
147
- std::u32string Num2Word::to_month(uint32_t month) const {
148
- if (month >= 1 && month <= 12) {
149
- return num2word::kMonths[month];
93
+ std::u32string Num2Word::read_ordinal(const Match& match, const NumberReading& reading) const {
94
+ // The suffix gives the form: masculine (वाँ), feminine (वीं) or plural (वें)
95
+ size_t form = std::ranges::find(kOrdinalSuffixes, match.suffix) - kOrdinalSuffixes.begin();
96
+ uint64_t n = value(match.numbers[0]);
97
+
98
+ // पहला, दूसरा, तीसरा, चौथा, छठा: irregular
99
+ if (auto it = kOrdinalsSpecial.find(static_cast<int32_t>(n)); n < 10 && it != kOrdinalsSpecial.end()) {
100
+ return it->second[form];
150
101
  }
151
- return U"";
102
+ return cardinal(n) + kOrdinalEndings[form];
152
103
  }
153
104
 
154
- std::u32string Num2Word::to_year(uint32_t year) const {
155
- return to_cardinal_int(static_cast<int32_t>(year));
105
+ std::u32string Num2Word::read_money(const Number& number, const Match& match, const NumberReading& reading) const {
106
+ return read_number(number, reading) + U" " + kCurrencies.at(std::u32string(match.unit));
156
107
  }
157
108
 
158
- bool Num2Word::is_ordinal_suffix(std::u32string_view suffix) const {
159
- return num2word::kOrdinalSuffixes.contains(std::u32string(suffix));
109
+ std::u32string Num2Word::read_percent(const Number& number, const Match& match, const NumberReading& reading) const {
110
+ return read_number(number, reading) + U" प्रतिशत";
160
111
  }
161
112
 
162
- } // namespace phonemis::hi
113
+ } // namespace phonemis::hi
@@ -1,25 +1,36 @@
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::hi {
8
8
 
9
- class Num2Word : public processor::num2word::Num2WordLayer {
9
+ // Hindi numbers are read without context so far.
10
+ struct NumberReading {};
11
+
12
+ // TODO: outdated - Hindi readings predate the context-aware design and have no reference verbalizer.
13
+ // Missing: Indian digit grouping (1,00,000), Devanagari digits, units and context (gender) of the counted noun.
14
+ class Num2Word : public processor::num2word::Num2WordLayer<NumberReading> {
10
15
  public:
11
- using Num2WordLayer::Num2WordLayer;
12
-
13
- char32_t decimal_separator() const override { return U'.'; }
14
- std::u32string to_cardinal_int(int32_t number) const override;
15
- std::u32string to_cardinal_float(float number, std::u32string_view repr) const override;
16
- std::u32string to_ordinal_int(int32_t number, std::u32string_view suffix = U"") const override;
17
- std::u32string to_currency(char32_t currency, std::variant<int32_t, float> number) const override;
18
- std::u32string to_fraction(int32_t numerator, int32_t denominator) const override;
19
- std::u32string to_day(uint32_t day) const override;
20
- std::u32string to_month(uint32_t month) const override;
21
- std::u32string to_year(uint32_t year) const override;
22
- bool is_ordinal_suffix(std::u32string_view suffix) const override;
16
+ Num2Word();
17
+
18
+ protected:
19
+ using Context = processor::Context;
20
+ using Match = processor::num2word::Match;
21
+ using Number = processor::num2word::Number;
22
+
23
+ // Resolution
24
+ NumberReading resolve(const Match& match, const Context& context) const override { return {}; }
25
+
26
+ // Readings
27
+ std::u32string read_number(const Number& number, const NumberReading& reading) const override;
28
+ std::u32string read_code_digits(std::u32string_view digits) const override;
29
+ std::u32string read_date(const Match& match, const NumberReading& reading) const override;
30
+ std::u32string read_fraction(const Match& match, const NumberReading& reading) const override;
31
+ std::u32string read_ordinal(const Match& match, const NumberReading& reading) const override;
32
+ std::u32string read_money(const Number& number, const Match& match, const NumberReading& reading) const override;
33
+ std::u32string read_percent(const Number& number, const Match& match, const NumberReading& reading) const override;
23
34
  };
24
35
 
25
- } // namespace phonemis::hi
36
+ } // namespace phonemis::hi
@@ -8,8 +8,8 @@
8
8
  #include <phonemis/base/ipipeline.h>
9
9
  #include <phonemis/base/phonemizer/hybrid_phonemizer.h>
10
10
  #include <phonemis/base/phonemizer/lexicon_phonemizer.h>
11
+ #include <phonemis/base/processor/preprocessor.h>
11
12
  #include <phonemis/base/processor/processor.h>
12
- #include <phonemis/base/processor/trim_layer.h>
13
13
  #include <phonemis/base/tokenizer/tokenizer.h>
14
14
 
15
15
  #include <memory>
@@ -24,8 +24,10 @@ public:
24
24
  phonemizer_(make_phonemizer_config(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_ =
28
+ processor::make_preprocessor<Num2Word>(config.preprocessor, {.characters = &constants::normalize::kCharacters,
29
+ .terms = &constants::term2word::kTerms,
30
+ .symbols = &constants::sym2word::kSymbols});
29
31
  }
30
32
 
31
33
  // Performs a preprocessing stage of the pipeline.