Class: FormatStream

FormatStream

new FormatStream(opts)

Applies some basic formating to transcriptions:

  • Capitalize the first word of each sentence
  • Add a period to the end
  • Fix any "cruft" in the transcription
  • etc.
Parameters:
Name Type Attributes Default Description
opts Object
Properties
Name Type Attributes Default Description
model String

some models / languages need special handling

hesitation String <optional>
'\u2026'

what to put down for a "hesitation" event, defaults to an ellipsis (...)

options.objectMode Boolean <optional>
false

emit result objects instead of string Buffers for the data events.

Source:

Methods

capitalize(text) → {string}

Capitalizes the first word of a sentence

Parameters:
Name Type Description
text String
Source:
Returns:
Type
string

clean(text, isFinal) → {String}

Formats one or more words, removing special symbols, junk, and spacing for some languages

Parameters:
Name Type Description
text String
isFinal Boolean
Source:
Returns:
Type
String

formatResult(result, encoding, next)

Creates a new result with all transcriptions formatted

Parameters:
Name Type Description
result Object
encoding String
next function
Source:

period(text) → {string}

Puts a period on the end of a sentence

Parameters:
Name Type Description
text String
Source:
Returns:
Type
string