languagetranslatorv3

package
v0.0.0-...-0deef17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package languagetranslatorv3 : Operations and models for the LanguageTranslatorV3 service

Index

Constants

View Source
const (
	DocumentStatus_Status_Available  = "available"
	DocumentStatus_Status_Failed     = "failed"
	DocumentStatus_Status_Processing = "processing"
)

Constants associated with the DocumentStatus.Status property. The status of the translation job associated with a submitted document.

View Source
const (
	TranslationModel_Status_Available   = "available"
	TranslationModel_Status_Deleted     = "deleted"
	TranslationModel_Status_Dispatching = "dispatching"
	TranslationModel_Status_Error       = "error"
	TranslationModel_Status_Publishing  = "publishing"
	TranslationModel_Status_Queued      = "queued"
	TranslationModel_Status_Trained     = "trained"
	TranslationModel_Status_Training    = "training"
	TranslationModel_Status_Uploaded    = "uploaded"
	TranslationModel_Status_Uploading   = "uploading"
)

Constants associated with the TranslationModel.Status property. Availability of a model.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateModelOptions

type CreateModelOptions struct {

	// The model ID of the model to use as the base for customization. To see available models, use the `List models`
	// method. Usually all IBM provided models are customizable. In addition, all your models that have been created via
	// parallel corpus customization, can be further customized with a forced glossary.
	BaseModelID *string `json:"base_model_id" validate:"required"`

	// A TMX file with your customizations. The customizations in the file completely overwrite the domain translaton data,
	// including high frequency or high confidence phrase translations. You can upload only one glossary with a file size
	// less than 10 MB per call. A forced glossary should contain single words or short phrases.
	ForcedGlossary io.ReadCloser `json:"forced_glossary,omitempty"`

	// A TMX file with parallel sentences for source and target language. You can upload multiple parallel_corpus files in
	// one request. All uploaded parallel_corpus files combined, your parallel corpus must contain at least 5,000 parallel
	// sentences to train successfully.
	ParallelCorpus io.ReadCloser `json:"parallel_corpus,omitempty"`

	// An optional model name that you can use to identify the model. Valid characters are letters, numbers, dashes,
	// underscores, spaces and apostrophes. The maximum length is 32 characters.
	Name *string `json:"name,omitempty"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

CreateModelOptions : The CreateModel options.

func (*CreateModelOptions) SetBaseModelID

func (options *CreateModelOptions) SetBaseModelID(baseModelID string) *CreateModelOptions

SetBaseModelID : Allow user to set BaseModelID

func (*CreateModelOptions) SetForcedGlossary

func (options *CreateModelOptions) SetForcedGlossary(forcedGlossary io.ReadCloser) *CreateModelOptions

SetForcedGlossary : Allow user to set ForcedGlossary

func (*CreateModelOptions) SetHeaders

func (options *CreateModelOptions) SetHeaders(param map[string]string) *CreateModelOptions

SetHeaders : Allow user to set Headers

func (*CreateModelOptions) SetName

func (options *CreateModelOptions) SetName(name string) *CreateModelOptions

SetName : Allow user to set Name

func (*CreateModelOptions) SetParallelCorpus

func (options *CreateModelOptions) SetParallelCorpus(parallelCorpus io.ReadCloser) *CreateModelOptions

SetParallelCorpus : Allow user to set ParallelCorpus

type DeleteDocumentOptions

type DeleteDocumentOptions struct {

	// Document ID of the document to delete.
	DocumentID *string `json:"document_id" validate:"required"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

DeleteDocumentOptions : The DeleteDocument options.

func (*DeleteDocumentOptions) SetDocumentID

func (options *DeleteDocumentOptions) SetDocumentID(documentID string) *DeleteDocumentOptions

SetDocumentID : Allow user to set DocumentID

func (*DeleteDocumentOptions) SetHeaders

func (options *DeleteDocumentOptions) SetHeaders(param map[string]string) *DeleteDocumentOptions

SetHeaders : Allow user to set Headers

type DeleteModelOptions

type DeleteModelOptions struct {

	// Model ID of the model to delete.
	ModelID *string `json:"model_id" validate:"required"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

DeleteModelOptions : The DeleteModel options.

func (*DeleteModelOptions) SetHeaders

func (options *DeleteModelOptions) SetHeaders(param map[string]string) *DeleteModelOptions

SetHeaders : Allow user to set Headers

func (*DeleteModelOptions) SetModelID

func (options *DeleteModelOptions) SetModelID(modelID string) *DeleteModelOptions

SetModelID : Allow user to set ModelID

type DeleteModelResult

type DeleteModelResult struct {

	// "OK" indicates that the model was successfully deleted.
	Status *string `json:"status" validate:"required"`
}

DeleteModelResult : DeleteModelResult struct

type DocumentList

type DocumentList struct {

	// An array of all previously submitted documents.
	Documents []DocumentStatus `json:"documents" validate:"required"`
}

DocumentList : DocumentList struct

type DocumentStatus

type DocumentStatus struct {

	// System generated ID identifying a document being translated using one specific translation model.
	DocumentID *string `json:"document_id" validate:"required"`

	// filename from the submission (if it was missing in the multipart-form, 'noname.<ext matching content type>' is used.
	Filename *string `json:"filename" validate:"required"`

	// The status of the translation job associated with a submitted document.
	Status *string `json:"status" validate:"required"`

	// A globally unique string that identifies the underlying model that is used for translation.
	ModelID *string `json:"model_id" validate:"required"`

	// Model ID of the base model that was used to customize the model. If the model is not a custom model, this will be
	// absent or an empty string.
	BaseModelID *string `json:"base_model_id,omitempty"`

	// Translation source language code.
	Source *string `json:"source" validate:"required"`

	// Translation target language code.
	Target *string `json:"target" validate:"required"`

	// The time when the document was submitted.
	Created *strfmt.DateTime `json:"created" validate:"required"`

	// The time when the translation completed.
	Completed *strfmt.DateTime `json:"completed,omitempty"`

	// The number of words in the source document, present only if status=available.
	WordCount *int64 `json:"word_count,omitempty"`

	// The number of characters in the source document, present only if status=available.
	CharacterCount *int64 `json:"character_count,omitempty"`
}

DocumentStatus : Document information, including translation status.

type GetDocumentStatusOptions

type GetDocumentStatusOptions struct {

	// The document ID of the document.
	DocumentID *string `json:"document_id" validate:"required"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

GetDocumentStatusOptions : The GetDocumentStatus options.

func (*GetDocumentStatusOptions) SetDocumentID

func (options *GetDocumentStatusOptions) SetDocumentID(documentID string) *GetDocumentStatusOptions

SetDocumentID : Allow user to set DocumentID

func (*GetDocumentStatusOptions) SetHeaders

func (options *GetDocumentStatusOptions) SetHeaders(param map[string]string) *GetDocumentStatusOptions

SetHeaders : Allow user to set Headers

type GetModelOptions

type GetModelOptions struct {

	// Model ID of the model to get.
	ModelID *string `json:"model_id" validate:"required"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

GetModelOptions : The GetModel options.

func (*GetModelOptions) SetHeaders

func (options *GetModelOptions) SetHeaders(param map[string]string) *GetModelOptions

SetHeaders : Allow user to set Headers

func (*GetModelOptions) SetModelID

func (options *GetModelOptions) SetModelID(modelID string) *GetModelOptions

SetModelID : Allow user to set ModelID

type GetTranslatedDocumentOptions

type GetTranslatedDocumentOptions struct {

	// The document ID of the document that was submitted for translation.
	DocumentID *string `json:"document_id" validate:"required"`

	// The type of the response: application/powerpoint, application/mspowerpoint, application/x-rtf, application/json,
	// application/xml, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,
	// application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation,
	// application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document,
	// application/vnd.oasis.opendocument.spreadsheet, application/vnd.oasis.opendocument.presentation,
	// application/vnd.oasis.opendocument.text, application/pdf, application/rtf, text/html, text/json, text/plain,
	// text/richtext, text/rtf, or text/xml. A character encoding can be specified by including a `charset` parameter. For
	// example, 'text/html;charset=utf-8'.
	Accept *string `json:"Accept,omitempty"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

GetTranslatedDocumentOptions : The GetTranslatedDocument options.

func (*GetTranslatedDocumentOptions) SetAccept

SetAccept : Allow user to set Accept

func (*GetTranslatedDocumentOptions) SetDocumentID

func (options *GetTranslatedDocumentOptions) SetDocumentID(documentID string) *GetTranslatedDocumentOptions

SetDocumentID : Allow user to set DocumentID

func (*GetTranslatedDocumentOptions) SetHeaders

SetHeaders : Allow user to set Headers

type IdentifiableLanguage

type IdentifiableLanguage struct {

	// The language code for an identifiable language.
	Language *string `json:"language" validate:"required"`

	// The name of the identifiable language.
	Name *string `json:"name" validate:"required"`
}

IdentifiableLanguage : IdentifiableLanguage struct

type IdentifiableLanguages

type IdentifiableLanguages struct {

	// A list of all languages that the service can identify.
	Languages []IdentifiableLanguage `json:"languages" validate:"required"`
}

IdentifiableLanguages : IdentifiableLanguages struct

type IdentifiedLanguage

type IdentifiedLanguage struct {

	// The language code for an identified language.
	Language *string `json:"language" validate:"required"`

	// The confidence score for the identified language.
	Confidence *float64 `json:"confidence" validate:"required"`
}

IdentifiedLanguage : IdentifiedLanguage struct

type IdentifiedLanguages

type IdentifiedLanguages struct {

	// A ranking of identified languages with confidence scores.
	Languages []IdentifiedLanguage `json:"languages" validate:"required"`
}

IdentifiedLanguages : IdentifiedLanguages struct

type IdentifyOptions

type IdentifyOptions struct {

	// Input text in UTF-8 format.
	Text *string `json:"text" validate:"required"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

IdentifyOptions : The Identify options.

func (*IdentifyOptions) SetHeaders

func (options *IdentifyOptions) SetHeaders(param map[string]string) *IdentifyOptions

SetHeaders : Allow user to set Headers

func (*IdentifyOptions) SetText

func (options *IdentifyOptions) SetText(text string) *IdentifyOptions

SetText : Allow user to set Text

type LanguageTranslatorV3

type LanguageTranslatorV3 struct {
	Service *core.BaseService
	Version string
}

LanguageTranslatorV3 : IBM Watson&trade; Language Translator translates text from one language to another. The service offers multiple IBM provided translation models that you can customize based on your unique terminology and language. Use Language Translator to take news from across the globe and present it in your language, communicate with your customers in their own language, and more.

Version: 3.0.0 See: https://cloud.ibm.com/docs/services/language-translator/

func NewLanguageTranslatorV3

func NewLanguageTranslatorV3(options *LanguageTranslatorV3Options) (service *LanguageTranslatorV3, err error)

NewLanguageTranslatorV3 : Instantiate LanguageTranslatorV3

func (*LanguageTranslatorV3) CreateModel

func (languageTranslator *LanguageTranslatorV3) CreateModel(createModelOptions *CreateModelOptions) (result *TranslationModel, response *core.DetailedResponse, err error)

CreateModel : Create model Uploads Translation Memory eXchange (TMX) files to customize a translation model.

You can either customize a model with a forced glossary or with a corpus that contains parallel sentences. To create a model that is customized with a parallel corpus <b>and</b> a forced glossary, proceed in two steps: customize with a parallel corpus first and then customize the resulting model with a glossary. Depending on the type of customization and the size of the uploaded corpora, training can range from minutes for a glossary to several hours for a large parallel corpus. You can upload a single forced glossary file and this file must be less than <b>10 MB</b>. You can upload multiple parallel corpora tmx files. The cumulative file size of all uploaded files is limited to <b>250 MB</b>. To successfully train with a parallel corpus you must have at least <b>5,000 parallel sentences</b> in your corpus.

You can have a <b>maximum of 10 custom models per language pair</b>.

func (*LanguageTranslatorV3) DeleteDocument

func (languageTranslator *LanguageTranslatorV3) DeleteDocument(deleteDocumentOptions *DeleteDocumentOptions) (response *core.DetailedResponse, err error)

DeleteDocument : Delete document Deletes a document.

func (*LanguageTranslatorV3) DeleteModel

func (languageTranslator *LanguageTranslatorV3) DeleteModel(deleteModelOptions *DeleteModelOptions) (result *DeleteModelResult, response *core.DetailedResponse, err error)

DeleteModel : Delete model Deletes a custom translation model.

func (*LanguageTranslatorV3) DisableSSLVerification

func (languageTranslator *LanguageTranslatorV3) DisableSSLVerification()

DisableSSLVerification bypasses verification of the server's SSL certificate

func (*LanguageTranslatorV3) GetDocumentStatus

func (languageTranslator *LanguageTranslatorV3) GetDocumentStatus(getDocumentStatusOptions *GetDocumentStatusOptions) (result *DocumentStatus, response *core.DetailedResponse, err error)

GetDocumentStatus : Get document status Gets the translation status of a document.

func (*LanguageTranslatorV3) GetModel

func (languageTranslator *LanguageTranslatorV3) GetModel(getModelOptions *GetModelOptions) (result *TranslationModel, response *core.DetailedResponse, err error)

GetModel : Get model details Gets information about a translation model, including training status for custom models. Use this API call to poll the status of your customization request. A successfully completed training will have a status of `available`.

func (*LanguageTranslatorV3) GetTranslatedDocument

func (languageTranslator *LanguageTranslatorV3) GetTranslatedDocument(getTranslatedDocumentOptions *GetTranslatedDocumentOptions) (result io.ReadCloser, response *core.DetailedResponse, err error)

GetTranslatedDocument : Get translated document Gets the translated document associated with the given document ID.

func (*LanguageTranslatorV3) Identify

func (languageTranslator *LanguageTranslatorV3) Identify(identifyOptions *IdentifyOptions) (result *IdentifiedLanguages, response *core.DetailedResponse, err error)

Identify : Identify language Identifies the language of the input text.

func (*LanguageTranslatorV3) ListDocuments

func (languageTranslator *LanguageTranslatorV3) ListDocuments(listDocumentsOptions *ListDocumentsOptions) (result *DocumentList, response *core.DetailedResponse, err error)

ListDocuments : List documents Lists documents that have been submitted for translation.

func (*LanguageTranslatorV3) ListIdentifiableLanguages

func (languageTranslator *LanguageTranslatorV3) ListIdentifiableLanguages(listIdentifiableLanguagesOptions *ListIdentifiableLanguagesOptions) (result *IdentifiableLanguages, response *core.DetailedResponse, err error)

ListIdentifiableLanguages : List identifiable languages Lists the languages that the service can identify. Returns the language code (for example, `en` for English or `es` for Spanish) and name of each language.

func (*LanguageTranslatorV3) ListModels

func (languageTranslator *LanguageTranslatorV3) ListModels(listModelsOptions *ListModelsOptions) (result *TranslationModels, response *core.DetailedResponse, err error)

ListModels : List models Lists available translation models.

func (*LanguageTranslatorV3) NewCreateModelOptions

func (languageTranslator *LanguageTranslatorV3) NewCreateModelOptions(baseModelID string) *CreateModelOptions

NewCreateModelOptions : Instantiate CreateModelOptions

func (*LanguageTranslatorV3) NewDeleteDocumentOptions

func (languageTranslator *LanguageTranslatorV3) NewDeleteDocumentOptions(documentID string) *DeleteDocumentOptions

NewDeleteDocumentOptions : Instantiate DeleteDocumentOptions

func (*LanguageTranslatorV3) NewDeleteModelOptions

func (languageTranslator *LanguageTranslatorV3) NewDeleteModelOptions(modelID string) *DeleteModelOptions

NewDeleteModelOptions : Instantiate DeleteModelOptions

func (*LanguageTranslatorV3) NewGetDocumentStatusOptions

func (languageTranslator *LanguageTranslatorV3) NewGetDocumentStatusOptions(documentID string) *GetDocumentStatusOptions

NewGetDocumentStatusOptions : Instantiate GetDocumentStatusOptions

func (*LanguageTranslatorV3) NewGetModelOptions

func (languageTranslator *LanguageTranslatorV3) NewGetModelOptions(modelID string) *GetModelOptions

NewGetModelOptions : Instantiate GetModelOptions

func (*LanguageTranslatorV3) NewGetTranslatedDocumentOptions

func (languageTranslator *LanguageTranslatorV3) NewGetTranslatedDocumentOptions(documentID string) *GetTranslatedDocumentOptions

NewGetTranslatedDocumentOptions : Instantiate GetTranslatedDocumentOptions

func (*LanguageTranslatorV3) NewIdentifyOptions

func (languageTranslator *LanguageTranslatorV3) NewIdentifyOptions(text string) *IdentifyOptions

NewIdentifyOptions : Instantiate IdentifyOptions

func (*LanguageTranslatorV3) NewListDocumentsOptions

func (languageTranslator *LanguageTranslatorV3) NewListDocumentsOptions() *ListDocumentsOptions

NewListDocumentsOptions : Instantiate ListDocumentsOptions

func (*LanguageTranslatorV3) NewListIdentifiableLanguagesOptions

func (languageTranslator *LanguageTranslatorV3) NewListIdentifiableLanguagesOptions() *ListIdentifiableLanguagesOptions

NewListIdentifiableLanguagesOptions : Instantiate ListIdentifiableLanguagesOptions

func (*LanguageTranslatorV3) NewListModelsOptions

func (languageTranslator *LanguageTranslatorV3) NewListModelsOptions() *ListModelsOptions

NewListModelsOptions : Instantiate ListModelsOptions

func (*LanguageTranslatorV3) NewTranslateDocumentOptions

func (languageTranslator *LanguageTranslatorV3) NewTranslateDocumentOptions(file io.ReadCloser, filename string) *TranslateDocumentOptions

NewTranslateDocumentOptions : Instantiate TranslateDocumentOptions

func (*LanguageTranslatorV3) NewTranslateOptions

func (languageTranslator *LanguageTranslatorV3) NewTranslateOptions(text []string) *TranslateOptions

NewTranslateOptions : Instantiate TranslateOptions

func (*LanguageTranslatorV3) SetServiceURL

func (languageTranslator *LanguageTranslatorV3) SetServiceURL(url string) error

SetServiceURL sets the service URL

func (*LanguageTranslatorV3) Translate

func (languageTranslator *LanguageTranslatorV3) Translate(translateOptions *TranslateOptions) (result *TranslationResult, response *core.DetailedResponse, err error)

Translate : Translate Translates the input text from the source language to the target language.

func (*LanguageTranslatorV3) TranslateDocument

func (languageTranslator *LanguageTranslatorV3) TranslateDocument(translateDocumentOptions *TranslateDocumentOptions) (result *DocumentStatus, response *core.DetailedResponse, err error)

TranslateDocument : Translate document Submit a document for translation. You can submit the document contents in the `file` parameter, or you can reference a previously submitted document by document ID.

type LanguageTranslatorV3Options

type LanguageTranslatorV3Options struct {
	URL           string
	Authenticator core.Authenticator
	Version       string
}

LanguageTranslatorV3Options : Service options

type ListDocumentsOptions

type ListDocumentsOptions struct {

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

ListDocumentsOptions : The ListDocuments options.

func (*ListDocumentsOptions) SetHeaders

func (options *ListDocumentsOptions) SetHeaders(param map[string]string) *ListDocumentsOptions

SetHeaders : Allow user to set Headers

type ListIdentifiableLanguagesOptions

type ListIdentifiableLanguagesOptions struct {

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

ListIdentifiableLanguagesOptions : The ListIdentifiableLanguages options.

func (*ListIdentifiableLanguagesOptions) SetHeaders

SetHeaders : Allow user to set Headers

type ListModelsOptions

type ListModelsOptions struct {

	// Specify a language code to filter results by source language.
	Source *string `json:"source,omitempty"`

	// Specify a language code to filter results by target language.
	Target *string `json:"target,omitempty"`

	// If the default parameter isn't specified, the service will return all models (default and non-default) for each
	// language pair. To return only default models, set this to `true`. To return only non-default models, set this to
	// `false`. There is exactly one default model per language pair, the IBM provided base model.
	Default *bool `json:"default,omitempty"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

ListModelsOptions : The ListModels options.

func (*ListModelsOptions) SetDefault

func (options *ListModelsOptions) SetDefault(defaultVar bool) *ListModelsOptions

SetDefault : Allow user to set Default

func (*ListModelsOptions) SetHeaders

func (options *ListModelsOptions) SetHeaders(param map[string]string) *ListModelsOptions

SetHeaders : Allow user to set Headers

func (*ListModelsOptions) SetSource

func (options *ListModelsOptions) SetSource(source string) *ListModelsOptions

SetSource : Allow user to set Source

func (*ListModelsOptions) SetTarget

func (options *ListModelsOptions) SetTarget(target string) *ListModelsOptions

SetTarget : Allow user to set Target

type TranslateDocumentOptions

type TranslateDocumentOptions struct {

	// The source file to translate.
	//
	// [Supported file
	// types](https://cloud.ibm.com/docs/services/language-translator?topic=language-translator-document-translator-tutorial#supported-file-formats)
	//
	// Maximum file size: **20 MB**.
	File io.ReadCloser `json:"file" validate:"required"`

	// The filename for file.
	Filename *string `json:"filename" validate:"required"`

	// The content type of file.
	FileContentType *string `json:"file_content_type,omitempty"`

	// The model to use for translation. `model_id` or both `source` and `target` are required.
	ModelID *string `json:"model_id,omitempty"`

	// Language code that specifies the language of the source document.
	Source *string `json:"source,omitempty"`

	// Language code that specifies the target language for translation.
	Target *string `json:"target,omitempty"`

	// To use a previously submitted document as the source for a new translation, enter the `document_id` of the document.
	DocumentID *string `json:"document_id,omitempty"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

TranslateDocumentOptions : The TranslateDocument options.

func (*TranslateDocumentOptions) SetDocumentID

func (options *TranslateDocumentOptions) SetDocumentID(documentID string) *TranslateDocumentOptions

SetDocumentID : Allow user to set DocumentID

func (*TranslateDocumentOptions) SetFile

SetFile : Allow user to set File

func (*TranslateDocumentOptions) SetFileContentType

func (options *TranslateDocumentOptions) SetFileContentType(fileContentType string) *TranslateDocumentOptions

SetFileContentType : Allow user to set FileContentType

func (*TranslateDocumentOptions) SetFilename

func (options *TranslateDocumentOptions) SetFilename(filename string) *TranslateDocumentOptions

SetFilename : Allow user to set Filename

func (*TranslateDocumentOptions) SetHeaders

func (options *TranslateDocumentOptions) SetHeaders(param map[string]string) *TranslateDocumentOptions

SetHeaders : Allow user to set Headers

func (*TranslateDocumentOptions) SetModelID

func (options *TranslateDocumentOptions) SetModelID(modelID string) *TranslateDocumentOptions

SetModelID : Allow user to set ModelID

func (*TranslateDocumentOptions) SetSource

func (options *TranslateDocumentOptions) SetSource(source string) *TranslateDocumentOptions

SetSource : Allow user to set Source

func (*TranslateDocumentOptions) SetTarget

func (options *TranslateDocumentOptions) SetTarget(target string) *TranslateDocumentOptions

SetTarget : Allow user to set Target

type TranslateOptions

type TranslateOptions struct {

	// Input text in UTF-8 encoding. Multiple entries will result in multiple translations in the response.
	Text []string `json:"text" validate:"required"`

	// A globally unique string that identifies the underlying model that is used for translation.
	ModelID *string `json:"model_id,omitempty"`

	// Translation source language code.
	Source *string `json:"source,omitempty"`

	// Translation target language code.
	Target *string `json:"target,omitempty"`

	// Allows users to set headers to be GDPR compliant
	Headers map[string]string
}

TranslateOptions : The Translate options.

func (*TranslateOptions) SetHeaders

func (options *TranslateOptions) SetHeaders(param map[string]string) *TranslateOptions

SetHeaders : Allow user to set Headers

func (*TranslateOptions) SetModelID

func (options *TranslateOptions) SetModelID(modelID string) *TranslateOptions

SetModelID : Allow user to set ModelID

func (*TranslateOptions) SetSource

func (options *TranslateOptions) SetSource(source string) *TranslateOptions

SetSource : Allow user to set Source

func (*TranslateOptions) SetTarget

func (options *TranslateOptions) SetTarget(target string) *TranslateOptions

SetTarget : Allow user to set Target

func (*TranslateOptions) SetText

func (options *TranslateOptions) SetText(text []string) *TranslateOptions

SetText : Allow user to set Text

type Translation

type Translation struct {

	// Translation output in UTF-8.
	Translation *string `json:"translation" validate:"required"`
}

Translation : Translation struct

type TranslationModel

type TranslationModel struct {

	// A globally unique string that identifies the underlying model that is used for translation.
	ModelID *string `json:"model_id" validate:"required"`

	// Optional name that can be specified when the model is created.
	Name *string `json:"name,omitempty"`

	// Translation source language code.
	Source *string `json:"source,omitempty"`

	// Translation target language code.
	Target *string `json:"target,omitempty"`

	// Model ID of the base model that was used to customize the model. If the model is not a custom model, this will be an
	// empty string.
	BaseModelID *string `json:"base_model_id,omitempty"`

	// The domain of the translation model.
	Domain *string `json:"domain,omitempty"`

	// Whether this model can be used as a base for customization. Customized models are not further customizable, and some
	// base models are not customizable.
	Customizable *bool `json:"customizable,omitempty"`

	// Whether or not the model is a default model. A default model is the model for a given language pair that will be
	// used when that language pair is specified in the source and target parameters.
	DefaultModel *bool `json:"default_model,omitempty"`

	// Either an empty string, indicating the model is not a custom model, or the ID of the service instance that created
	// the model.
	Owner *string `json:"owner,omitempty"`

	// Availability of a model.
	Status *string `json:"status,omitempty"`
}

TranslationModel : Response payload for models.

type TranslationModels

type TranslationModels struct {

	// An array of available models.
	Models []TranslationModel `json:"models" validate:"required"`
}

TranslationModels : The response type for listing existing translation models.

type TranslationResult

type TranslationResult struct {

	// Number of words in the input text.
	WordCount *int64 `json:"word_count" validate:"required"`

	// Number of characters in the input text.
	CharacterCount *int64 `json:"character_count" validate:"required"`

	// List of translation output in UTF-8, corresponding to the input text entries.
	Translations []Translation `json:"translations" validate:"required"`
}

TranslationResult : TranslationResult struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL