Skip to content

Commit af3de99

Browse files
Update explainer (#153)
Co-authored-by: Evan Liu <evliu@google.com>
1 parent 227a270 commit af3de99

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

explainers/on-device-speech-recognition.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Applications can offer speech recognition capabilities even without an active in
2424
## New Methods
2525

2626
### 1. `Promise<boolean> availableOnDevice(DOMString lang)`
27-
This method checks if on-device speech recognition is available for a specific language. Developers can use this to determine whether to enable on-device features or fall back to cloud-based recognition.
27+
This method checks if on-device speech recognition is available for a specific language. Developers can use this to determine whether to enable features that require on-device speech recognition.
2828

2929
#### Example Usage
3030
```javascript
@@ -38,13 +38,13 @@ SpeechRecognition.availableOnDevice(lang).then((available) => {
3838
});
3939
```
4040

41-
### 2. `Promise<boolean> installOnDevice()`
42-
This method install the resources required for on-device speech recognition. The installation process may download and configure necessary language models.
41+
### 2. `Promise<boolean> installOnDevice(DOMString[] lang)`
42+
This method install the resources required for on-device speech recognition for the given BCP-47 language codes. The installation process may download and configure necessary language models.
4343

4444
#### Example Usage
4545
```javascript
4646
const lang = 'en-US';
47-
SpeechRecognition.installOnDevice(lang).then((success) => {
47+
SpeechRecognition.installOnDevice([lang]).then((success) => {
4848
if (success) {
4949
console.log('On-device speech recognition resources installed successfully.');
5050
} else {
@@ -62,7 +62,6 @@ The `mode` attribute in the `SpeechRecognition` interface defines how speech rec
6262

6363
- **"on-device-preferred"**: Use on-device speech recognition if available. If not, fall back to cloud-based speech recognition.
6464
- **"on-device-only"**: Only use on-device speech recognition. If it's unavailable, throw an error.
65-
- **"cloud-only"**: Only use cloud-based speech recognition, bypassing on-device options entirely.
6665

6766
#### Example Usage
6867
```javascript
@@ -72,8 +71,7 @@ recognition.start();
7271
```
7372

7473
## Privacy considerations
75-
To reduce the risk of fingerprinting, user agents must obtain explicit and informed user consent before installing on-device speech recognition languages that differ from the user's preferred language or when the user is not connected to an Ethernet or Wi-Fi network.
74+
To reduce the risk of fingerprinting, user agents must implementing privacy-preserving countermeasures. The Web Speech API will employ the same masking techniques used by the [Web Translation API](https://github.com/webmachinelearning/writing-assistance-apis/pull/47).
7675

7776
## Conclusion
78-
79-
The addition of on-device speech recognition capabilities to the Web Speech API marks a significant step forward in creating more private, performant, and accessible web applications. By leveraging these new methods, developers can enhance user experiences while addressing key concerns around privacy and connectivity.
77+
The addition of on-device speech recognition capabilities to the Web Speech API marks a significant step forward in creating more private, performant, and accessible web applications. By leveraging these new methods, developers can enhance user experiences while addressing key concerns around privacy and connectivity.

0 commit comments

Comments
 (0)