CustomWord

public struct CustomWord : Codable, Equatable

Information about a word that is to be added to a custom language model.

  • For the Add custom words method, you must specify the custom word that is to be added to or updated in the custom model. Do not include spaces in the word. Use a - (dash) or _ (underscore) to connect the tokens of compound words. Omit this parameter for the Add a custom word method.

    Declaration

    Swift

    public var word: String?
  • For a custom model that is based on a previous-generation model, an array of sounds-like pronunciations for the custom word. Specify how words that are difficult to pronounce, foreign words, acronyms, and so on can be pronounced by users.

    • For a word that is not in the service’s base vocabulary, omit the parameter to have the service automatically generate a sounds-like pronunciation for the word.
    • For a word that is in the service’s base vocabulary, use the parameter to specify additional pronunciations for the word. You cannot override the default pronunciation of a word; pronunciations you add augment the pronunciation from the base vocabulary. A word can have at most five sounds-like pronunciations. A pronunciation can include at most 40 characters not including spaces. For a custom model that is based on a next-generation model, omit this field. Custom models based on next-generation models do not support the sounds_like field. The service ignores the field.

    Declaration

    Swift

    public var soundsLike: [String]?
  • An alternative spelling for the custom word when it appears in a transcript. Use the parameter when you want the word to have a spelling that is different from its usual representation or from its spelling in corpora training data.

    Declaration

    Swift

    public var displayAs: String?
  • Initialize a CustomWord with member variables.

    Declaration

    Swift

    public init(
        word: String? = nil,
        soundsLike: [String]? = nil,
        displayAs: String? = nil
    )

    Parameters

    word

    For the Add custom words method, you must specify the custom word that is to be added to or updated in the custom model. Do not include spaces in the word. Use a - (dash) or _ (underscore) to connect the tokens of compound words. Omit this parameter for the Add a custom word method.

    soundsLike

    For a custom model that is based on a previous-generation model, an array of sounds-like pronunciations for the custom word. Specify how words that are difficult to pronounce, foreign words, acronyms, and so on can be pronounced by users.

    • For a word that is not in the service’s base vocabulary, omit the parameter to have the service automatically generate a sounds-like pronunciation for the word.
    • For a word that is in the service’s base vocabulary, use the parameter to specify additional pronunciations for the word. You cannot override the default pronunciation of a word; pronunciations you add augment the pronunciation from the base vocabulary. A word can have at most five sounds-like pronunciations. A pronunciation can include at most 40 characters not including spaces. For a custom model that is based on a next-generation model, omit this field. Custom models based on next-generation models do not support the sounds_like field. The service ignores the field.

    displayAs

    An alternative spelling for the custom word when it appears in a transcript. Use the parameter when you want the word to have a spelling that is different from its usual representation or from its spelling in corpora training data.

    Return Value

    An initialized CustomWord.