Class: Phrase

.models. Phrase

A class representing a Phrase

new Phrase( [data])

Create a new Phrase
Parameters:
Name Type Argument Description
data Object <optional>
The raw data for this phrase. See the DLx specification for Phrases for more information on formatting phrase data.
Properties
Name Type Argument Description
endTime Number <optional>
The time within the accompanying media files that this phrase ends, in seconds (decimals allowed).
key String <optional>
A key that uniquely identifies this phrase within the text, as a string. Must consist of a valid abbreviation, a period, and the number of this phrase within the text (index starts at 1). For example: `A.3` or `DogStory.24`.
language String <optional>
The abbreviation for the language that this phrase is in. Must be a valid Abbreviation.
notes Array <optional>
An array of notes about this phrase. Each note should adhere to the Note format.
speaker String <optional>
The abbreviation of the speaker of this phrase. Must be a valid Abbreviation.
startTime Number <optional>
The time within the accompanying media files that this phrase begins, in seconds (decimals allowed).
tags Map | Object <optional>
An object containing tags and their values. May also be an iterable object, whose items are arrays of tags and their values (in other words, the standard method for instantiating a new Map object; see MDN's Map documentation for more details).
transcription Object The transcriptions of this phrase, optionally in multiple orthographies. Must be formatted as a MultiLangString.
translation Object The translations of this phrase, optionally in multiple orthographies. Must be formatted as a MultiLangString. May also include a `type` property.
Properties
Name Type Argument Description
type String <optional>
The type of translation (usually `free` or `literal`).
url String <optional>
The URL where this phrase can be accessed. Must be a valid URI.
words Array An array of word tokens in this phrase. Each item must be formatted as a Word object.
Properties:
Name Type Description
endTime Number The time within the accompanying media files that this phrase ends, in seconds (decimals allowed).
key String A key that uniquely identifies this phrase within the text, as a string.
language String The abbreviation for the language of this phrase.
notes Array An array of notes about this phrase. Each note is an instance of the Note class.
speaker String The abbreviation of the speaker of this phrase.
startTime Number The time within the accompanying media files that this phrase begins, in seconds (decimals allowed).
tags Tags A set of tags for this phrase, as a Map object.
transcription MultiLangString The transcriptions for this phrase, as a MultiLangString
txn String A shorthand for accessing the default orthography of the `transcription` object, if one is set
translation MultiLangString The translations for this phrase, as a MultiLangString
tln String A shorthand for accessing the default orthography of the `translation` object, if one is set
url String The URL where this phrase can be accessed.
words Array An array of word tokens in this phrase. Each item is an instance of the Word class.
Example
const phrase = new Phrase({

  transcription: {
    spa:  'Hola, me llamo Daniel.',
    ipa:  'ola me jamo dænjɛl',
  },

  translation: {
    eng:  'Hello, my name is Daniel.',
    type: 'free',
  },

  words: [],

});