react-native-executorch 0.10.5 → 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.
- package/README.md +10 -1
- package/android/build.gradle.kts +4 -3
- package/ios/RnExecutorch.mm +15 -17
- package/lib/module/fetcher/fetcher.js +35 -122
- package/lib/module/fetcher/fetcher.js.map +1 -1
- package/lib/module/fetcher/telemetry.js +1 -1
- package/lib/module/index.js +12 -13
- package/lib/module/index.js.map +1 -1
- package/lib/module/models.js +4 -2
- package/lib/module/models.js.map +1 -1
- package/lib/typescript/src/fetcher/fetcher.d.ts +3 -7
- package/lib/typescript/src/fetcher/fetcher.d.ts.map +1 -1
- package/lib/typescript/src/models.d.ts.map +1 -1
- package/package.json +9 -7
- package/react-native-executorch.podspec +6 -2
- package/src/fetcher/fetcher.ts +38 -131
- package/src/fetcher/telemetry.ts +1 -1
- package/src/models.ts +6 -1
- package/third-party/common/phonemis/CMakeLists.txt +70 -14
- package/third-party/common/phonemis/README.md +183 -33
- package/third-party/common/phonemis/THIRD_PARTY_NOTICES.md +57 -0
- package/third-party/common/phonemis/knowledge/code_style.md +642 -0
- package/third-party/common/phonemis/licenses/Unicode-3.0.txt +39 -0
- package/third-party/common/phonemis/licenses/misaki-Apache-2.0.txt +201 -0
- package/third-party/common/phonemis/licenses/nlohmann-json-MIT.txt +21 -0
- package/third-party/common/phonemis/licenses/xsimd-BSD-3-Clause.txt +29 -0
- package/third-party/common/phonemis/src/phonemis/base/config.h +6 -0
- package/third-party/common/phonemis/src/phonemis/base/ipipeline.cpp +75 -0
- package/third-party/common/phonemis/src/phonemis/base/ipipeline.h +21 -0
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/constants.h +2 -5
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/lexicon_phonemizer.cpp +3 -4
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.cpp +17 -8
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/neural_phonemizer.h +4 -0
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.cpp +21 -6
- package/third-party/common/phonemis/src/phonemis/base/phonemizer/nn/tokenizer.h +13 -4
- package/third-party/common/phonemis/src/phonemis/base/pipeline.cpp +8 -0
- package/third-party/common/phonemis/src/phonemis/base/pipeline.h +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.cpp +37 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/conditions.h +45 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/constants.h +10 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/context.cpp +105 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/context.h +49 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/document.cpp +173 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/document.h +67 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/text.cpp +75 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/text.h +60 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/common/types.h +18 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/config.h +53 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layer.h +9 -7
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/constants.h +20 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.cpp +89 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/layer.h +35 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/normalize/types.h +16 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/kind.h +40 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/layer.h +382 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/notation.h +30 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.cpp +51 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/numerals.h +31 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern.h +30 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.cpp +17 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/pattern_set.h +31 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.cpp +811 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/patterns.h +285 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.cpp +64 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/primitives.h +23 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/num2word/types.h +94 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sanitizer/layer.cpp +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/{sanitizer_layer.h → layers/sanitizer/layer.h} +8 -8
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.cpp +65 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/sym2word/layer.h +29 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.cpp +170 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/layer.h +40 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/term2word/types.h +25 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.cpp +47 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/layers/trim/layer.h +19 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.cpp +60 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/preprocessor.h +45 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/processor.cpp +6 -7
- package/third-party/common/phonemis/src/phonemis/base/processor/processor.h +14 -10
- package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.cpp +89 -52
- package/third-party/common/phonemis/src/phonemis/base/tagger/hmm_tagger.h +16 -9
- package/third-party/common/phonemis/src/phonemis/base/tokenizer/tokenizer.cpp +13 -12
- package/third-party/common/phonemis/src/phonemis/lang/de/constants.h +183 -19
- package/third-party/common/phonemis/src/phonemis/lang/de/num2word.cpp +355 -309
- package/third-party/common/phonemis/src/phonemis/lang/de/num2word.h +42 -17
- package/third-party/common/phonemis/src/phonemis/lang/de/patterns.cpp +56 -0
- package/third-party/common/phonemis/src/phonemis/lang/de/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/de/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/en/constants.h +181 -30
- package/third-party/common/phonemis/src/phonemis/lang/en/hmm_tagger.cpp +5 -7
- package/third-party/common/phonemis/src/phonemis/lang/en/num2word.cpp +232 -135
- package/third-party/common/phonemis/src/phonemis/lang/en/num2word.h +41 -16
- package/third-party/common/phonemis/src/phonemis/lang/en/pipeline.h +3 -10
- package/third-party/common/phonemis/src/phonemis/lang/es/constants.h +182 -60
- package/third-party/common/phonemis/src/phonemis/lang/es/num2word.cpp +247 -212
- package/third-party/common/phonemis/src/phonemis/lang/es/num2word.h +38 -18
- package/third-party/common/phonemis/src/phonemis/lang/es/patterns.cpp +50 -0
- package/third-party/common/phonemis/src/phonemis/lang/es/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/es/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/fr/constants.h +152 -26
- package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.cpp +252 -179
- package/third-party/common/phonemis/src/phonemis/lang/fr/num2word.h +38 -15
- package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.cpp +83 -0
- package/third-party/common/phonemis/src/phonemis/lang/fr/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/fr/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/hi/constants.h +62 -10
- package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.cpp +74 -123
- package/third-party/common/phonemis/src/phonemis/lang/hi/num2word.h +27 -16
- package/third-party/common/phonemis/src/phonemis/lang/hi/pipeline.h +5 -3
- package/third-party/common/phonemis/src/phonemis/lang/it/constants.h +122 -42
- package/third-party/common/phonemis/src/phonemis/lang/it/num2word.cpp +200 -207
- package/third-party/common/phonemis/src/phonemis/lang/it/num2word.h +30 -18
- package/third-party/common/phonemis/src/phonemis/lang/it/patterns.cpp +25 -0
- package/third-party/common/phonemis/src/phonemis/lang/it/patterns.h +15 -0
- package/third-party/common/phonemis/src/phonemis/lang/it/pipeline.h +3 -3
- package/third-party/common/phonemis/src/phonemis/lang/pl/constants.h +346 -77
- package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.cpp +631 -246
- package/third-party/common/phonemis/src/phonemis/lang/pl/num2word.h +47 -15
- package/third-party/common/phonemis/src/phonemis/lang/pl/pipeline.h +6 -6
- package/third-party/common/phonemis/src/phonemis/lang/pt/constants.h +201 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.cpp +365 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/num2word.h +53 -0
- package/third-party/common/phonemis/src/phonemis/lang/pt/pipeline.h +4 -2
- package/third-party/common/phonemis/src/phonemis/main.cpp +42 -11
- package/third-party/common/phonemis/src/phonemis/protophone/meta.h +24 -0
- package/third-party/common/phonemis/src/phonemis/protophone/numeric.h +26 -0
- package/third-party/common/phonemis/src/phonemis/protophone/protophone.cpp +525 -0
- package/third-party/common/phonemis/src/phonemis/protophone/protophone.h +80 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor.h +76 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor_utils.h +89 -0
- package/third-party/common/phonemis/src/phonemis/protophone/tensor_view.h +125 -0
- package/third-party/common/phonemis/src/phonemis/protophone/types.h +43 -0
- package/third-party/common/phonemis/src/phonemis/utils/strings.h +20 -14
- package/third-party/common/phonemis/src/phonemis/utils/unicode.h +15 -1
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_arithmetic.hpp +267 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_bit.hpp +232 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_cast.hpp +43 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_complex.hpp +112 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_details.hpp +386 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_logical.hpp +240 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_math.hpp +2601 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_memory.hpp +1006 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_rounding.hpp +72 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_swizzle.hpp +260 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/common/xsimd_common_trigo.hpp +996 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/utils/shifts.hpp +82 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx.hpp +2111 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2.hpp +1591 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx2_128.hpp +170 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512bw.hpp +724 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512cd.hpp +28 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512dq.hpp +270 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512er.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512f.hpp +2919 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512ifma.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512pf.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi.hpp +76 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vbmi2.hpp +130 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512bw.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx512vnni_avx512vbmi2.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avx_128.hpp +164 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_avxvnni.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common.hpp +26 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_common_fwd.hpp +127 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_constants.hpp +393 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_emulated.hpp +787 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx.hpp +93 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_avx2.hpp +46 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma3_sse.hpp +97 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_fma4.hpp +92 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_i8mm_neon64.hpp +17 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_isa.hpp +148 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon.hpp +3580 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_neon64.hpp +1614 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_rvv.hpp +1515 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_scalar.hpp +1210 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse2.hpp +2333 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse3.hpp +66 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_1.hpp +510 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sse4_2.hpp +44 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_ssse3.hpp +186 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_sve.hpp +1186 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vsx.hpp +947 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_vxe.hpp +787 -0
- package/third-party/common/phonemis/src/third-party/xsimd/arch/xsimd_wasm.hpp +1819 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_arch.hpp +242 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_config.hpp +633 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_arm.hpp +132 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_ppc.hpp +54 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_riscv.hpp +95 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_s390x.hpp +56 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpu_features_x86.hpp +1121 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_cpuid.hpp +144 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_getauxval.hpp +159 -0
- package/third-party/common/phonemis/src/third-party/xsimd/config/xsimd_macros.hpp +78 -0
- package/third-party/common/phonemis/src/third-party/xsimd/math/xsimd_rem_pio2.hpp +707 -0
- package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_aligned_allocator.hpp +349 -0
- package/third-party/common/phonemis/src/third-party/xsimd/memory/xsimd_alignment.hpp +102 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_all_registers.hpp +57 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_api.hpp +3106 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx2_register.hpp +57 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512bw_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512cd_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512dq_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512er_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512f_register.hpp +77 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512ifma_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512pf_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi2_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vbmi_register.hpp +51 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512bw_register.hpp +54 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx512vnni_avx512vbmi2_register.hpp +53 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avx_register.hpp +79 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_avxvnni_register.hpp +44 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch.hpp +1666 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_constant.hpp +572 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_batch_fwd.hpp +41 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_common_arch.hpp +49 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_emulated_register.hpp +80 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx2_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_avx_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma3_sse_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_fma4_register.hpp +50 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_i8mm_neon64_register.hpp +55 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon64_register.hpp +55 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_neon_register.hpp +130 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_register.hpp +96 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_rvv_register.hpp +491 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse2_register.hpp +59 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse3_register.hpp +49 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_1_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sse4_2_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_ssse3_register.hpp +48 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_sve_register.hpp +216 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_traits.hpp +409 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_utils.hpp +462 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vsx_register.hpp +84 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_vxe_register.hpp +86 -0
- package/third-party/common/phonemis/src/third-party/xsimd/types/xsimd_wasm_register.hpp +59 -0
- package/third-party/common/phonemis/src/third-party/xsimd/utils/bits.hpp +122 -0
- package/third-party/common/phonemis/src/third-party/xsimd/utils/xsimd_type_traits.hpp +145 -0
- package/third-party/common/phonemis/src/third-party/xsimd/xsimd.hpp +43 -0
- package/third-party/common/phonemis/src/phonemis/base/processor/constants.h +0 -11
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/config.h +0 -16
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.cpp +0 -271
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/layer.h +0 -45
- package/third-party/common/phonemis/src/phonemis/base/processor/num2word/types.h +0 -29
- package/third-party/common/phonemis/src/phonemis/base/processor/sanitizer_layer.cpp +0 -22
- package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.cpp +0 -40
- package/third-party/common/phonemis/src/phonemis/base/processor/trim_layer.h +0 -22
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#include "constants.h"
|
|
2
|
+
#include "patterns.h"
|
|
3
|
+
#include <phonemis/base/processor/layers/num2word/primitives.h>
|
|
4
|
+
#include <phonemis/utils/strings.h>
|
|
5
|
+
#include <phonemis/utils/unicode.h>
|
|
6
|
+
|
|
7
|
+
#include <optional>
|
|
8
|
+
#include <string>
|
|
9
|
+
|
|
10
|
+
namespace phonemis::es {
|
|
11
|
+
|
|
12
|
+
using namespace constants::num2word;
|
|
13
|
+
using namespace processor;
|
|
14
|
+
using namespace processor::num2word;
|
|
15
|
+
using namespace utils;
|
|
16
|
+
|
|
17
|
+
std::optional<Match> LawPattern::match(std::u32string_view text, size_t position) const {
|
|
18
|
+
// A law word, then spaces
|
|
19
|
+
size_t word_end = position;
|
|
20
|
+
while (word_end > 0 && unicode::isspace(text[word_end - 1])) {
|
|
21
|
+
word_end--;
|
|
22
|
+
}
|
|
23
|
+
size_t word_begin = word_end;
|
|
24
|
+
while (word_begin > 0 && unicode::isword(text[word_begin - 1])) {
|
|
25
|
+
word_begin--;
|
|
26
|
+
}
|
|
27
|
+
if (word_end == position || !kLaws.contains(strings::to_lower(text.substr(word_begin, word_end - word_begin)))) {
|
|
28
|
+
return std::nullopt;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Its number, then a year of 19xx or 20xx
|
|
32
|
+
Number number = digits_at(text, position);
|
|
33
|
+
size_t year = number.span.end + 1;
|
|
34
|
+
if (number.span.end == position || number.integer.size() > 3 || year >= text.size() ||
|
|
35
|
+
!strings::contains(std::u32string_view(U"./-"), text[year - 1])) {
|
|
36
|
+
return std::nullopt;
|
|
37
|
+
}
|
|
38
|
+
Number year_number = digits_at(text, year);
|
|
39
|
+
if (year_number.integer.size() != 4 ||
|
|
40
|
+
!(year_number.integer.starts_with(U"19") || year_number.integer.starts_with(U"20"))) {
|
|
41
|
+
return std::nullopt;
|
|
42
|
+
}
|
|
43
|
+
size_t end = year_number.span.end;
|
|
44
|
+
if (!is_clear_after(text, end) || is_digit_after(text, end, U".,/")) {
|
|
45
|
+
return std::nullopt;
|
|
46
|
+
}
|
|
47
|
+
return Match{.kind = Kind::DATE, .span = {position, end}, .numbers = {number, year_number}};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
} // namespace phonemis::es
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include <phonemis/base/processor/layers/num2word/pattern.h>
|
|
4
|
+
|
|
5
|
+
namespace phonemis::es {
|
|
6
|
+
|
|
7
|
+
// Ley 2/2018: the number of a law with its year. The law word stays, its numbers are the number and the year.
|
|
8
|
+
class LawPattern : public processor::num2word::Pattern {
|
|
9
|
+
public:
|
|
10
|
+
LawPattern() : Pattern(processor::num2word::Kind::DATE) {}
|
|
11
|
+
|
|
12
|
+
std::optional<processor::num2word::Match> match(std::u32string_view text, size_t position) const override;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
} // namespace phonemis::es
|
|
@@ -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_
|
|
28
|
-
|
|
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,181 @@
|
|
|
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>
|
|
13
|
+
#include <string_view>
|
|
8
14
|
#include <unordered_map>
|
|
9
15
|
#include <unordered_set>
|
|
16
|
+
#include <utility>
|
|
10
17
|
#include <vector>
|
|
11
18
|
|
|
12
19
|
namespace phonemis::fr::constants {
|
|
13
20
|
|
|
14
21
|
// --- Number to Word Normalization ---
|
|
15
22
|
namespace num2word {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
{15, U"quinze"}, {16, U"seize"}, {17, U"dix sept"}, {18, U"dix huit"}, {19, U"dix neuf"},
|
|
24
|
-
{20, U"vingt"}, {30, U"trente"}, {40, U"quarante"}, {50, U"cinquante"}, {60, U"soixante"}
|
|
25
|
-
};
|
|
23
|
+
using ::phonemis::processor::num2word::DateFormat;
|
|
24
|
+
using ::phonemis::processor::num2word::Forms;
|
|
25
|
+
using ::phonemis::processor::num2word::Joiners;
|
|
26
|
+
using ::phonemis::processor::num2word::Keys;
|
|
27
|
+
using ::phonemis::processor::num2word::keys_of;
|
|
28
|
+
using ::phonemis::processor::num2word::Notation;
|
|
29
|
+
using ::phonemis::processor::num2word::PhoneFormat;
|
|
26
30
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
{1000LL, U"mille"},
|
|
31
|
-
{1000000LL, U"million"},
|
|
32
|
-
{1000000000LL, U"milliard"}
|
|
31
|
+
inline constexpr std::array<std::u32string_view, 20> kOnes = {
|
|
32
|
+
U"zéro", U"un", U"deux", U"trois", U"quatre", U"cinq", U"six", U"sept", U"huit", U"neuf",
|
|
33
|
+
U"dix", U"onze", U"douze", U"treize", U"quatorze", U"quinze", U"seize", U"dix-sept", U"dix-huit", U"dix-neuf"
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
//
|
|
36
|
-
inline
|
|
37
|
-
|
|
36
|
+
// Tens, where 70 and 90 are built on 60 and 80: soixante-dix, quatre-vingt-dix
|
|
37
|
+
inline constexpr std::array<std::u32string_view, 9> kTens = {
|
|
38
|
+
U"", U"dix", U"vingt", U"trente", U"quarante", U"cinquante", U"soixante", U"", U"quatre-vingt"
|
|
38
39
|
};
|
|
39
40
|
|
|
40
|
-
// Months (index 1 = January)
|
|
41
41
|
inline const std::vector<std::u32string> kMonths = {
|
|
42
|
-
U"
|
|
43
|
-
U"juillet",
|
|
42
|
+
U"janvier", U"février", U"mars", U"avril", U"mai", U"juin",
|
|
43
|
+
U"juillet", U"août", U"septembre", U"octobre", U"novembre", U"décembre"
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
inline const std::unordered_set<std::u32string> kWeekdays = {
|
|
47
|
+
U"lundi", U"mardi", U"mercredi", U"jeudi", U"vendredi", U"samedi", U"dimanche"
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
inline const std::unordered_map<std::u32string, Forms> kCurrencies = {
|
|
51
|
+
{U"€", {U"euro", U"euros"}}, {U"$", {U"dollar", U"dollars"}}, {U"£", {U"livre", U"livres"}},
|
|
52
|
+
{U"CHF", {U"franc suisse", U"francs suisses"}}, {U"M€", {U"million d'euros", U"millions d'euros"}}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
inline const std::unordered_map<std::u32string, std::u32string> kScales = {
|
|
56
|
+
{U"millions", U"millions"}, {U"million", U"million"}, {U"milliards", U"milliards"}, {U"milliard", U"milliard"},
|
|
57
|
+
{U"k", U"mille"}, {U"K", U"mille"}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
inline const std::unordered_map<std::u32string, Forms> kUnits = {
|
|
61
|
+
{U"km", {U"kilomètre", U"kilomètres"}}, {U"m", {U"mètre", U"mètres"}},
|
|
62
|
+
{U"cm", {U"centimètre", U"centimètres"}}, {U"mm", {U"millimètre", U"millimètres"}},
|
|
63
|
+
{U"nm", {U"nanomètre", U"nanomètres"}}, {U"m²", {U"mètre carré", U"mètres carrés"}},
|
|
64
|
+
{U"km²", {U"kilomètre carré", U"kilomètres carrés"}}, {U"m³", {U"mètre cube", U"mètres cubes"}},
|
|
65
|
+
{U"ha", {U"hectare", U"hectares"}}, {U"kg", {U"kilogramme", U"kilogrammes"}},
|
|
66
|
+
{U"g", {U"gramme", U"grammes"}}, {U"mg", {U"milligramme", U"milligrammes"}},
|
|
67
|
+
{U"t", {U"tonne", U"tonnes"}}, {U"l", {U"litre", U"litres"}},
|
|
68
|
+
{U"L", {U"litre", U"litres"}}, {U"cl", {U"centilitre", U"centilitres"}},
|
|
69
|
+
{U"ml", {U"millilitre", U"millilitres"}}, {U"mL", {U"millilitre", U"millilitres"}},
|
|
70
|
+
{U"km/h", {U"kilomètre par heure", U"kilomètres par heure"}}, {U"°C", {U"degré Celsius", U"degrés Celsius"}},
|
|
71
|
+
{U"°", {U"degré", U"degrés"}}, {U"To", {U"téraoctet", U"téraoctets"}},
|
|
72
|
+
{U"Go", {U"gigaoctet", U"gigaoctets"}}, {U"Mo", {U"mégaoctet", U"mégaoctets"}},
|
|
73
|
+
{U"Ko", {U"kilooctet", U"kilooctets"}}, {U"GHz", {U"gigahertz", U"gigahertz"}},
|
|
74
|
+
{U"MHz", {U"mégahertz", U"mégahertz"}}, {U"Hz", {U"hertz", U"hertz"}},
|
|
75
|
+
{U"kW", {U"kilowatt", U"kilowatts"}}, {U"kWh", {U"kilowattheure", U"kilowattheures"}},
|
|
76
|
+
{U"W", {U"watt", U"watts"}}, {U"V", {U"volt", U"volts"}},
|
|
77
|
+
{U"Mbit/s", {U"mégabit par seconde", U"mégabits par seconde"}}, {U"min", {U"minute", U"minutes"}},
|
|
78
|
+
{U"s", {U"seconde", U"secondes"}}
|
|
44
79
|
};
|
|
45
80
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
81
|
+
inline const std::map<std::pair<uint64_t, uint64_t>, std::u32string> kFractions = {
|
|
82
|
+
{{1, 2}, U"un demi"}, {{1, 3}, U"un tiers"}, {{2, 3}, U"deux tiers"}, {{1, 4}, U"un quart"},
|
|
83
|
+
{{3, 4}, U"trois quarts"}
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
// Nouns in -e are feminine unless listed below or ending like a masculine noun; other feminine nouns are listed
|
|
87
|
+
inline const std::unordered_set<std::u32string> kFeminineNouns = {
|
|
88
|
+
U"fois", U"voix", U"nuit", U"part", U"dent", U"main", U"fleur", U"mort", U"photo", U"vidéo", U"radio", U"moto",
|
|
89
|
+
U"eau", U"loi", U"foi", U"fin", U"faim", U"peur", U"mer", U"cour", U"tour", U"souris", U"noix", U"paix", U"croix",
|
|
90
|
+
U"forêt", U"image", U"page", U"plage", U"cage", U"nage", U"rage"
|
|
91
|
+
};
|
|
92
|
+
inline const std::unordered_set<std::u32string> kMasculineInE = {
|
|
93
|
+
U"monde", U"livre", U"groupe", U"modèle", U"problème", U"système", U"programme", U"exemple", U"nombre", U"membre",
|
|
94
|
+
U"homme", U"père", U"frère", U"rôle", U"style", U"site", U"espace", U"service", U"commerce", U"couple",
|
|
95
|
+
U"magazine", U"musée", U"lycée", U"verre", U"chiffre", U"véhicule", U"stade", U"poste", U"signe", U"rythme",
|
|
96
|
+
U"volume", U"domaine", U"vote", U"texte", U"téléphone", U"jeune", U"collège", U"kilowattheure", U"gramme",
|
|
97
|
+
U"kilogramme", U"milligramme", U"pourcentage", U"ordre", U"type", U"genre", U"acte", U"arbre", U"autre",
|
|
98
|
+
U"génome", U"crime", U"trimestre", U"semestre", U"siècle", U"masque", U"risque", U"casque", U"disque", U"manque",
|
|
99
|
+
U"parc", U"vice", U"film"
|
|
100
|
+
};
|
|
101
|
+
inline const std::vector<std::u32string> kMasculineEndings = {U"age", U"ège", U"isme", U"ème", U"aire", U"tre", U"cle", U"ste", U"ome"};
|
|
102
|
+
|
|
103
|
+
// Words after a number which are not the noun it counts
|
|
104
|
+
inline const std::unordered_set<std::u32string> kStopWords = {
|
|
105
|
+
U"avec", U"dans", U"pour", U"mais", U"donc", U"puis", U"sur", U"sous", U"par", U"chez", U"vers", U"entre", U"sans",
|
|
106
|
+
U"contre", U"comme", U"selon", U"alors", U"aussi", U"déjà", U"encore", U"très", U"plus", U"moins", U"tout",
|
|
107
|
+
U"tous", U"toute", U"toutes"
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
inline const std::unordered_set<std::u32string> kNumberWords = {
|
|
111
|
+
U"zéro", U"un", U"une", U"deux", U"trois", U"quatre", U"cinq", U"six", U"sept", U"huit", U"neuf", U"dix", U"onze",
|
|
112
|
+
U"douze", U"treize", U"quatorze", U"quinze", U"seize", U"vingt", U"vingts", U"trente", U"quarante", U"cinquante",
|
|
113
|
+
U"soixante", U"cent", U"cents", U"mille"
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
// Words before a time with a dot, which make it a time: à 18.30
|
|
117
|
+
inline const std::unordered_set<std::u32string> kTimeWords = {
|
|
118
|
+
U"à", U"vers", U"dès", U"de", U"jusqu'à", U"avant", U"après", U"entre", U"et"
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// --- Notation: how numbers are written ---
|
|
122
|
+
inline const Notation kNotation = {
|
|
123
|
+
.group_separators = U" \u00a0\u202f.", .decimal_separators = U",.", .time_separators = U":.h", .time_suffixes = {U"h"},
|
|
124
|
+
.currencies = keys_of(kCurrencies), .scales = keys_of(kScales), .units = keys_of(kUnits), .fractions = true
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
// Words between numbers: 3.8.10, 10.0.0.51, 10-15, 1920x1080, 2:1, -5, 2 + 2
|
|
128
|
+
inline const Joiners kJoiners = {
|
|
129
|
+
.point = U"virgule", .dot = U"point", .range = U" à ", .by = U"par", .score = U" à ", .minus = U"moins", .plus = U"plus"
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// 05/11, 05/11/2024, 1.5.2024: the year is optional
|
|
133
|
+
inline const DateFormat kDateFormat = {.separators = U"./", .boundaries = U".,/", .year_required = false};
|
|
134
|
+
|
|
135
|
+
// 06 12 34 56 78, 06.12.34.56.78, 0612345678
|
|
136
|
+
inline const PhoneFormat kPhoneFormat = {
|
|
137
|
+
.groups = {{2, 2}, {2, 2}, {2, 2}, {2, 2}, {2, 2}}, .separators = U" .", .optional_separators = true,
|
|
138
|
+
.leading_zero = true, .boundaries = U".,", .closing = U""
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
// 1er, 1re, 2e, 2ème, 2nd, 3èmes
|
|
142
|
+
inline const Keys kOrdinalSuffixes = {
|
|
143
|
+
U"ères", U"èmes", U"ère", U"ème", U"eme", U"ers", U"er", U"res", U"re", U"es", U"ndes", U"nde", U"nds", U"nd",
|
|
144
|
+
U"e", U"è"
|
|
50
145
|
};
|
|
51
146
|
} // namespace num2word
|
|
52
147
|
|
|
148
|
+
// --- Symbols to Word Normalization ---
|
|
149
|
+
namespace sym2word {
|
|
150
|
+
using ::phonemis::processor::Readings;
|
|
151
|
+
|
|
152
|
+
inline const Readings kSymbols = {
|
|
153
|
+
{U"&", {U"et"}}, {U"+", {U"plus"}}, {U"=", {U"égale"}}, {U"@", {U"arobase"}}, {U"%", {U"pour cent"}},
|
|
154
|
+
{U"°", {U"degrés"}}, {U"§", {U"paragraphe"}}, {U"#", {U"hashtag"}}, {U"²", {U"carré"}}, {U"³", {U"cube"}},
|
|
155
|
+
{U"π", {U"pi"}}, {U"×", {U"fois"}}, {U"½", {U"un demi"}}, {U"€", {U"euros"}}, {U"$", {U"dollars"}},
|
|
156
|
+
{U"£", {U"livres"}}
|
|
157
|
+
};
|
|
158
|
+
} // namespace sym2word
|
|
159
|
+
|
|
160
|
+
// --- Terms to Word Normalization ---
|
|
161
|
+
namespace term2word {
|
|
162
|
+
using ::phonemis::processor::before_number;
|
|
163
|
+
using ::phonemis::processor::term2word::Terms;
|
|
164
|
+
|
|
165
|
+
inline const Terms kTerms = {
|
|
166
|
+
.abbreviations = {
|
|
167
|
+
// Before a number only: n° 5
|
|
168
|
+
{U"n°", {{U"numéro", before_number}}},
|
|
169
|
+
{U"N°", {{U"numéro", before_number}}},
|
|
170
|
+
{U"nº", {{U"numéro", before_number}}},
|
|
171
|
+
{U"p.", {{U"page", before_number}}},
|
|
172
|
+
{U"art.", {{U"article", before_number}}},
|
|
173
|
+
{U"Art.", {{U"article", before_number}}},
|
|
174
|
+
},
|
|
175
|
+
.web = {.dot = U"point", .at = U"arobase", .slash = U"slash"}
|
|
176
|
+
};
|
|
177
|
+
} // namespace term2word
|
|
178
|
+
|
|
53
179
|
// --- Tokenization Rules ---
|
|
54
180
|
namespace tokenizer {
|
|
55
181
|
using ::phonemis::tokenizer::split::Rule;
|