grace-recognition
v1.0.0
Published
A composition api for SpeechRecognition
Downloads
10
Maintainers
Readme
grace-recognition
A composition api for SpeechSynthesis
Documentation • Change Log
Installing
# use pnpm
$ pnpm install grace-recognition
# use npm
$ npm install grace-recognition --save
# use yarn
$ yarn add grace-recognition
Usage
- Simple use:
export type RecognitionEventType =
| 'start'
| 'audiostart'
| 'soundstart'
| 'speechstart'
| 'result'
| 'speechend'
| 'soundend'
| 'audioend'
| 'end'
| 'error'
| 'nomatch'
export interface RecognitionOptions {
preferTouchEvent: boolean
lang: 'zh-CN' | string
interimResults: boolean
maxAlternatives: number
continuous: boolean
onStatusChange?: (
status: RecognitionEventType,
event: Event | SpeechRecognitionEvent | SpeechRecognitionErrorEvent
) => void
}
import GraceRecognition from 'grace-recognition'
const recognition = new GraceRecognition({
continuous: true,
onStatusChange: (
status: RecognitionEventType,
event: Event | SpeechRecognitionEvent | SpeechRecognitionErrorEvent
) => {}
})
recognition.start('very good')
recognition.recognition('powered by saqqdy<https://github.com/saqqdy>')
- Using unpkg CDN:
<script src="https://unpkg.com/grace-recognition/1.0.0/dist/index.global.prod.js"></script>
<script>
const recognition = new GraceRecognition()
</script>
Support & Issues
Please open an issue here.