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
Properties
Name Type Attributes Default Description
model

some models / languages need special handling

hesitation <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
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
isFinal
Source:
Returns:
Type
String

formatResult(result)

Creates a new result with all transcriptions formatted

Parameters:
Name Type Description
result
Source:

period(text) → {string}

puts a period on the end of a sentence

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