Skip to content

Commit f205414

Browse files
authored
Add word to cspell and fix naming clash (#538)
## Description Adds word `probs` to cspell to be recognized and renames two variables to avoid naming clash inside a function. ### Introduces a breaking change? - [ ] Yes - [x] No ### Type of change - [ ] Bug fix (change which fixes an issue) - [ ] New feature (change which adds functionality) - [ ] Documentation update (improves or adds clarity to existing documentation) - [x] Other (chores, tests, code style improvements etc.) ### Tested on - [x] iOS - [x] Android ### Testing instructions Check if warnings are not present ### Screenshots <!-- Add screenshots here, if applicable --> ### Related issues #536 ### Checklist - [x] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have updated the documentation accordingly - [x] My changes generate no new warnings ### Additional notes <!-- Include any additional information, assumptions, or context that reviewers might need to understand this PR. -->
1 parent f7a5130 commit f205414

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

.cspell-wordlist.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,5 @@ startoftranscript
6464
endoftext
6565
softmax
6666
logit
67-
logits
67+
logits
68+
probs

packages/react-native-executorch/src/utils/SpeechToTextModule/ASR.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ export class ASR {
217217

218218
private async estimateWordTimestampsLinear(
219219
tokens: number[],
220-
start: number,
221-
end: number
220+
timestampStart: number,
221+
timestampEnd: number
222222
): Promise<WordObject[]> {
223-
const duration = (end - start) * this.timePrecision;
223+
const duration = (timestampEnd - timestampStart) * this.timePrecision;
224224
const segmentText = (
225225
(await this.tokenizerModule.decode(tokens)) as string
226226
).trim();
@@ -235,7 +235,7 @@ export class ASR {
235235

236236
const wordObjects: WordObject[] = [];
237237
const startTimeOffset =
238-
(start - this.timestampBeginToken) * this.timePrecision;
238+
(timestampStart - this.timestampBeginToken) * this.timePrecision;
239239

240240
let prevCharNum = 0;
241241
for (let j = 0; j < words.length; j++) {

0 commit comments

Comments
 (0)