react-native-executorch 0.5.3 → 0.5.5

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 (158) hide show
  1. package/android/src/main/cpp/CMakeLists.txt +2 -1
  2. package/common/rnexecutorch/data_processing/Numerical.cpp +27 -19
  3. package/common/rnexecutorch/data_processing/Numerical.h +53 -4
  4. package/common/rnexecutorch/data_processing/dsp.cpp +1 -1
  5. package/common/rnexecutorch/data_processing/dsp.h +1 -1
  6. package/common/rnexecutorch/data_processing/gzip.cpp +47 -0
  7. package/common/rnexecutorch/data_processing/gzip.h +7 -0
  8. package/common/rnexecutorch/host_objects/ModelHostObject.h +24 -0
  9. package/common/rnexecutorch/metaprogramming/TypeConcepts.h +21 -1
  10. package/common/rnexecutorch/models/BaseModel.cpp +3 -2
  11. package/common/rnexecutorch/models/BaseModel.h +3 -2
  12. package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +103 -39
  13. package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +39 -21
  14. package/common/rnexecutorch/models/speech_to_text/asr/ASR.cpp +310 -0
  15. package/common/rnexecutorch/models/speech_to_text/asr/ASR.h +62 -0
  16. package/common/rnexecutorch/models/speech_to_text/stream/HypothesisBuffer.cpp +82 -0
  17. package/common/rnexecutorch/models/speech_to_text/stream/HypothesisBuffer.h +25 -0
  18. package/common/rnexecutorch/models/speech_to_text/stream/OnlineASRProcessor.cpp +99 -0
  19. package/common/rnexecutorch/models/speech_to_text/stream/OnlineASRProcessor.h +33 -0
  20. package/common/rnexecutorch/models/speech_to_text/types/DecodingOptions.h +15 -0
  21. package/common/rnexecutorch/models/speech_to_text/types/GenerationResult.h +12 -0
  22. package/common/rnexecutorch/models/speech_to_text/types/ProcessResult.h +12 -0
  23. package/common/rnexecutorch/models/speech_to_text/types/Segment.h +14 -0
  24. package/common/rnexecutorch/models/speech_to_text/types/Word.h +13 -0
  25. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +75 -53
  26. package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
  27. package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +5 -5
  28. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +7 -12
  29. package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
  30. package/lib/typescript/types/stt.d.ts +0 -9
  31. package/lib/typescript/types/stt.d.ts.map +1 -1
  32. package/package.json +1 -1
  33. package/react-native-executorch.podspec +2 -0
  34. package/src/modules/natural_language_processing/SpeechToTextModule.ts +118 -54
  35. package/src/types/stt.ts +0 -12
  36. package/common/rnexecutorch/models/EncoderDecoderBase.cpp +0 -21
  37. package/common/rnexecutorch/models/EncoderDecoderBase.h +0 -31
  38. package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +0 -27
  39. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +0 -50
  40. package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +0 -25
  41. package/lib/Error.js +0 -53
  42. package/lib/ThreadPool.d.ts +0 -10
  43. package/lib/ThreadPool.js +0 -28
  44. package/lib/common/Logger.d.ts +0 -8
  45. package/lib/common/Logger.js +0 -19
  46. package/lib/constants/directories.js +0 -2
  47. package/lib/constants/llmDefaults.d.ts +0 -6
  48. package/lib/constants/llmDefaults.js +0 -16
  49. package/lib/constants/modelUrls.d.ts +0 -223
  50. package/lib/constants/modelUrls.js +0 -322
  51. package/lib/constants/ocr/models.d.ts +0 -882
  52. package/lib/constants/ocr/models.js +0 -182
  53. package/lib/constants/ocr/symbols.js +0 -139
  54. package/lib/constants/sttDefaults.d.ts +0 -28
  55. package/lib/constants/sttDefaults.js +0 -68
  56. package/lib/controllers/LLMController.d.ts +0 -47
  57. package/lib/controllers/LLMController.js +0 -213
  58. package/lib/controllers/OCRController.js +0 -67
  59. package/lib/controllers/SpeechToTextController.d.ts +0 -56
  60. package/lib/controllers/SpeechToTextController.js +0 -349
  61. package/lib/controllers/VerticalOCRController.js +0 -70
  62. package/lib/hooks/computer_vision/useClassification.d.ts +0 -15
  63. package/lib/hooks/computer_vision/useClassification.js +0 -7
  64. package/lib/hooks/computer_vision/useImageEmbeddings.d.ts +0 -15
  65. package/lib/hooks/computer_vision/useImageEmbeddings.js +0 -7
  66. package/lib/hooks/computer_vision/useImageSegmentation.d.ts +0 -38
  67. package/lib/hooks/computer_vision/useImageSegmentation.js +0 -7
  68. package/lib/hooks/computer_vision/useOCR.d.ts +0 -20
  69. package/lib/hooks/computer_vision/useOCR.js +0 -41
  70. package/lib/hooks/computer_vision/useObjectDetection.d.ts +0 -15
  71. package/lib/hooks/computer_vision/useObjectDetection.js +0 -7
  72. package/lib/hooks/computer_vision/useStyleTransfer.d.ts +0 -15
  73. package/lib/hooks/computer_vision/useStyleTransfer.js +0 -7
  74. package/lib/hooks/computer_vision/useVerticalOCR.d.ts +0 -21
  75. package/lib/hooks/computer_vision/useVerticalOCR.js +0 -43
  76. package/lib/hooks/general/useExecutorchModule.d.ts +0 -13
  77. package/lib/hooks/general/useExecutorchModule.js +0 -7
  78. package/lib/hooks/natural_language_processing/useLLM.d.ts +0 -10
  79. package/lib/hooks/natural_language_processing/useLLM.js +0 -78
  80. package/lib/hooks/natural_language_processing/useSpeechToText.d.ts +0 -27
  81. package/lib/hooks/natural_language_processing/useSpeechToText.js +0 -49
  82. package/lib/hooks/natural_language_processing/useTextEmbeddings.d.ts +0 -16
  83. package/lib/hooks/natural_language_processing/useTextEmbeddings.js +0 -7
  84. package/lib/hooks/natural_language_processing/useTokenizer.d.ts +0 -17
  85. package/lib/hooks/natural_language_processing/useTokenizer.js +0 -52
  86. package/lib/hooks/useModule.js +0 -45
  87. package/lib/hooks/useNonStaticModule.d.ts +0 -20
  88. package/lib/hooks/useNonStaticModule.js +0 -49
  89. package/lib/index.d.ts +0 -48
  90. package/lib/index.js +0 -58
  91. package/lib/module/utils/SpeechToTextModule/ASR.js +0 -191
  92. package/lib/module/utils/SpeechToTextModule/ASR.js.map +0 -1
  93. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js +0 -73
  94. package/lib/module/utils/SpeechToTextModule/OnlineProcessor.js.map +0 -1
  95. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js +0 -56
  96. package/lib/module/utils/SpeechToTextModule/hypothesisBuffer.js.map +0 -1
  97. package/lib/module/utils/stt.js +0 -22
  98. package/lib/module/utils/stt.js.map +0 -1
  99. package/lib/modules/BaseModule.js +0 -25
  100. package/lib/modules/BaseNonStaticModule.js +0 -14
  101. package/lib/modules/computer_vision/ClassificationModule.d.ts +0 -8
  102. package/lib/modules/computer_vision/ClassificationModule.js +0 -17
  103. package/lib/modules/computer_vision/ImageEmbeddingsModule.d.ts +0 -8
  104. package/lib/modules/computer_vision/ImageEmbeddingsModule.js +0 -17
  105. package/lib/modules/computer_vision/ImageSegmentationModule.d.ts +0 -11
  106. package/lib/modules/computer_vision/ImageSegmentationModule.js +0 -27
  107. package/lib/modules/computer_vision/OCRModule.d.ts +0 -14
  108. package/lib/modules/computer_vision/OCRModule.js +0 -17
  109. package/lib/modules/computer_vision/ObjectDetectionModule.d.ts +0 -9
  110. package/lib/modules/computer_vision/ObjectDetectionModule.js +0 -17
  111. package/lib/modules/computer_vision/StyleTransferModule.d.ts +0 -8
  112. package/lib/modules/computer_vision/StyleTransferModule.js +0 -17
  113. package/lib/modules/computer_vision/VerticalOCRModule.d.ts +0 -14
  114. package/lib/modules/computer_vision/VerticalOCRModule.js +0 -19
  115. package/lib/modules/general/ExecutorchModule.d.ts +0 -7
  116. package/lib/modules/general/ExecutorchModule.js +0 -14
  117. package/lib/modules/natural_language_processing/LLMModule.d.ts +0 -28
  118. package/lib/modules/natural_language_processing/LLMModule.js +0 -45
  119. package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +0 -24
  120. package/lib/modules/natural_language_processing/SpeechToTextModule.js +0 -36
  121. package/lib/modules/natural_language_processing/TextEmbeddingsModule.d.ts +0 -9
  122. package/lib/modules/natural_language_processing/TextEmbeddingsModule.js +0 -21
  123. package/lib/modules/natural_language_processing/TokenizerModule.d.ts +0 -12
  124. package/lib/modules/natural_language_processing/TokenizerModule.js +0 -30
  125. package/lib/native/NativeETInstaller.js +0 -2
  126. package/lib/native/NativeOCR.js +0 -2
  127. package/lib/native/NativeVerticalOCR.js +0 -2
  128. package/lib/native/RnExecutorchModules.d.ts +0 -7
  129. package/lib/native/RnExecutorchModules.js +0 -18
  130. package/lib/tsconfig.tsbuildinfo +0 -1
  131. package/lib/types/common.d.ts +0 -32
  132. package/lib/types/common.js +0 -25
  133. package/lib/types/imageSegmentation.js +0 -26
  134. package/lib/types/llm.d.ts +0 -46
  135. package/lib/types/llm.js +0 -9
  136. package/lib/types/objectDetection.js +0 -94
  137. package/lib/types/ocr.js +0 -1
  138. package/lib/types/stt.d.ts +0 -94
  139. package/lib/types/stt.js +0 -85
  140. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts +0 -27
  141. package/lib/typescript/utils/SpeechToTextModule/ASR.d.ts.map +0 -1
  142. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts +0 -23
  143. package/lib/typescript/utils/SpeechToTextModule/OnlineProcessor.d.ts.map +0 -1
  144. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts +0 -13
  145. package/lib/typescript/utils/SpeechToTextModule/hypothesisBuffer.d.ts.map +0 -1
  146. package/lib/typescript/utils/stt.d.ts +0 -2
  147. package/lib/typescript/utils/stt.d.ts.map +0 -1
  148. package/lib/utils/ResourceFetcher.d.ts +0 -24
  149. package/lib/utils/ResourceFetcher.js +0 -305
  150. package/lib/utils/ResourceFetcherUtils.d.ts +0 -54
  151. package/lib/utils/ResourceFetcherUtils.js +0 -127
  152. package/lib/utils/llm.d.ts +0 -6
  153. package/lib/utils/llm.js +0 -72
  154. package/lib/utils/stt.js +0 -21
  155. package/src/utils/SpeechToTextModule/ASR.ts +0 -303
  156. package/src/utils/SpeechToTextModule/OnlineProcessor.ts +0 -87
  157. package/src/utils/SpeechToTextModule/hypothesisBuffer.ts +0 -79
  158. package/src/utils/stt.ts +0 -28
package/src/utils/stt.ts DELETED
@@ -1,28 +0,0 @@
1
- export const longCommonInfPref = (
2
- seq1: number[],
3
- seq2: number[],
4
- hammingDistThreshold: number
5
- ) => {
6
- let maxInd = 0;
7
- let maxLength = 0;
8
-
9
- for (let i = 0; i < seq1.length; i++) {
10
- let j = 0;
11
- let hammingDist = 0;
12
- while (
13
- j < seq2.length &&
14
- i + j < seq1.length &&
15
- (seq1[i + j] === seq2[j] || hammingDist < hammingDistThreshold)
16
- ) {
17
- if (seq1[i + j] !== seq2[j]) {
18
- hammingDist++;
19
- }
20
- j++;
21
- }
22
- if (j >= maxLength) {
23
- maxLength = j;
24
- maxInd = i;
25
- }
26
- }
27
- return maxInd;
28
- };