voice
voice copied to clipboard
Automatic Punctuation
Is there a way to have the punctuation automatically added to the text? e.g., "question mark".
+100. How might we get this functionality?
I am also looking for a solution for this. Any ideas?
Me too! Would be great for voice notes, longer dictations
I think this would help for iOS https://developer.apple.com/documentation/speech/sfspeechrecognitionrequest/3930023-addspunctuation
Ok, so using patch-package I changed:
diff --git a/node_modules/@react-native-voice/voice/ios/Voice/Voice.m b/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
index fd9dad8..6f13745 100644
--- a/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
+++ b/node_modules/@react-native-voice/voice/ios/Voice/Voice.m
@@ -153,6 +153,11 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
// Configure request so that results are returned before audio recording is finished
self.recognitionRequest.shouldReportPartialResults = YES;
+ // Configure request to add punctuation to speech recognition results.
+ if (@available(iOS 16.0, *)) {
+ self.recognitionRequest.addsPunctuation = YES;
+ }
+
if (self.recognitionRequest == nil) {
[self sendResult:@{@"code": @"recognition_init"} :nil :nil :nil];
[self teardown];
Steps using Yarn:
- Install packages:
yarn add --dev patch-package postinstall-postinstall
- In package.json add a script:
"scripts": {
+ "postinstall": "patch-package"
}
- Modify file, open node_modules/@react-native-voice/voice/ios/Voice/Voice.m:
Add these lines after self.recognitionRequest.shouldReportPartialResults = YES;
// Configure request to add punctuation to speech recognition results.
if (@available(iOS 16.0, *)) {
self.recognitionRequest.addsPunctuation = YES;
}
- Create patch file running:
yarn patch-package @react-native-voice/voice
-
Build app again, I used eas build.
-
Enjoy
Is there any update? I want to get the proper punctuation on Android, Thanks