$ npm install @gkt/transcriber
Or via unpkg.com:
// es6 module;// common js module// const Transcriber = require('@gkt/transcriber');// script tag// const Transcriber = window.Transcriber;// Provide a base URL that is proxied to your GreenKey backend instanceconst transcriber = gkUrl: '/greenkey';// This will prompt the user for access to the microphonetranscriber;
Transcriptions are produced in real time and communicated to the client via the
Transcriber.TRANSCRIBER_DATA_RECEIVED event. The first argument to the event handler is the
transcriber instance and the second is an object containing the current result of the transcription.
The following top-level fields are included:
|session||string||A unique identifier for the transcription session|
|final||boolean||Indicates whether this is the final version of the transcript|
|clockStart||string (ISO8601 date)||The time the transcription recording started|
|segments||array of objects||A list of segment objects|
segments array contains objects with these fields:
|final||boolean||Indicates whether this segment is finished processing|
|startTimeSec||number||The offset in seconds from
|endTimeSec||number||The offset in seconds from
|transcript||string||The text of the raw transcript|
|interpreted_quote||object||Present when a quote is detected in the transcript|
|interpreted_quote.imString||string||The generated IM String of the detected quote|
|interpreted_quote.productClass.label||string||The product class of the detected quote|
|words||array||A list of transcript works with confidence levels|
Some example apps are provided in the
examples directory. Edit the
.html files to set the
gkUrl variable to your GreenKey instance before opening in a browser.
The examples are full apps that send audio data recorded from the microphone, receive transcription results and display them.
This library uses the MediaDevices.getUserMedia() API for gaining access to the user's microphone hardware. This API is only available in secure contexts, so your application must be served over HTTPS in order for it to work.
To publish a new version, update the
version field in the
package.json file and run:
$ npm publish --access public
This will automatically apply a git tag matching the version and push it.