languagetranslatorv3

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2018 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Overview

Package languagetranslatorv3 : Operations and models for the LanguageTranslatorV3 service

Index

Constants

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"`

	// 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"`

	// 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 *os.File `json:"forced_glossary,omitempty"`

	// The filename for forcedGlossary.
	ForcedGlossaryFilename *string `json:"forced_glossary_filename,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 *os.File `json:"parallel_corpus,omitempty"`

	// The filename for parallelCorpus.
	ParallelCorpusFilename *string `json:"parallel_corpus_filename,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 *os.File) *CreateModelOptions

SetForcedGlossary : Allow user to set ForcedGlossary

func (*CreateModelOptions) SetForcedGlossaryFilename

func (options *CreateModelOptions) SetForcedGlossaryFilename(forcedGlossaryFilename string) *CreateModelOptions

SetForcedGlossaryFilename : Allow user to set ForcedGlossaryFilename

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 *os.File) *CreateModelOptions

SetParallelCorpus : Allow user to set ParallelCorpus

func (*CreateModelOptions) SetParallelCorpusFilename

func (options *CreateModelOptions) SetParallelCorpusFilename(parallelCorpusFilename string) *CreateModelOptions

SetParallelCorpusFilename : Allow user to set ParallelCorpusFilename

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 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 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.WatsonService
}

LanguageTranslatorV3 : IBM Watson™ 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: V3 See: http://www.ibm.com/watson/developercloud/language-translator.html

func NewLanguageTranslatorV3

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

NewLanguageTranslatorV3 : Instantiate LanguageTranslatorV3

func (*LanguageTranslatorV3) CreateModel

func (languageTranslator *LanguageTranslatorV3) CreateModel(createModelOptions *CreateModelOptions) (*core.DetailedResponse, 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>maxium of 10 custom models per language pair</b>.

func (*LanguageTranslatorV3) DeleteModel

func (languageTranslator *LanguageTranslatorV3) DeleteModel(deleteModelOptions *DeleteModelOptions) (*core.DetailedResponse, error)

DeleteModel : Delete model Deletes a custom translation model.

func (*LanguageTranslatorV3) GetCreateModelResult

func (languageTranslator *LanguageTranslatorV3) GetCreateModelResult(response *core.DetailedResponse) *TranslationModel

GetCreateModelResult : Retrieve result of CreateModel operation

func (*LanguageTranslatorV3) GetDeleteModelResult

func (languageTranslator *LanguageTranslatorV3) GetDeleteModelResult(response *core.DetailedResponse) *DeleteModelResult

GetDeleteModelResult : Retrieve result of DeleteModel operation

func (*LanguageTranslatorV3) GetGetModelResult

func (languageTranslator *LanguageTranslatorV3) GetGetModelResult(response *core.DetailedResponse) *TranslationModel

GetGetModelResult : Retrieve result of GetModel operation

func (*LanguageTranslatorV3) GetIdentifyResult

func (languageTranslator *LanguageTranslatorV3) GetIdentifyResult(response *core.DetailedResponse) *IdentifiedLanguages

GetIdentifyResult : Retrieve result of Identify operation

func (*LanguageTranslatorV3) GetListIdentifiableLanguagesResult

func (languageTranslator *LanguageTranslatorV3) GetListIdentifiableLanguagesResult(response *core.DetailedResponse) *IdentifiableLanguages

GetListIdentifiableLanguagesResult : Retrieve result of ListIdentifiableLanguages operation

func (*LanguageTranslatorV3) GetListModelsResult

func (languageTranslator *LanguageTranslatorV3) GetListModelsResult(response *core.DetailedResponse) *TranslationModels

GetListModelsResult : Retrieve result of ListModels operation

func (*LanguageTranslatorV3) GetModel

func (languageTranslator *LanguageTranslatorV3) GetModel(getModelOptions *GetModelOptions) (*core.DetailedResponse, 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) GetTranslateResult

func (languageTranslator *LanguageTranslatorV3) GetTranslateResult(response *core.DetailedResponse) *TranslationResult

GetTranslateResult : Retrieve result of Translate operation

func (*LanguageTranslatorV3) Identify

func (languageTranslator *LanguageTranslatorV3) Identify(identifyOptions *IdentifyOptions) (*core.DetailedResponse, error)

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

func (*LanguageTranslatorV3) ListIdentifiableLanguages

func (languageTranslator *LanguageTranslatorV3) ListIdentifiableLanguages(listIdentifiableLanguagesOptions *ListIdentifiableLanguagesOptions) (*core.DetailedResponse, 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) (*core.DetailedResponse, error)

ListModels : List models Lists available translation models.

func (*LanguageTranslatorV3) NewCreateModelOptions

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

NewCreateModelOptions : Instantiate CreateModelOptions

func (*LanguageTranslatorV3) NewDeleteModelOptions

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

NewDeleteModelOptions : Instantiate DeleteModelOptions

func (*LanguageTranslatorV3) NewGetModelOptions

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

NewGetModelOptions : Instantiate GetModelOptions

func (*LanguageTranslatorV3) NewIdentifyOptions

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

NewIdentifyOptions : Instantiate IdentifyOptions

func (*LanguageTranslatorV3) NewListIdentifiableLanguagesOptions

func (languageTranslator *LanguageTranslatorV3) NewListIdentifiableLanguagesOptions() *ListIdentifiableLanguagesOptions

NewListIdentifiableLanguagesOptions : Instantiate ListIdentifiableLanguagesOptions

func (*LanguageTranslatorV3) NewListModelsOptions

func (languageTranslator *LanguageTranslatorV3) NewListModelsOptions() *ListModelsOptions

NewListModelsOptions : Instantiate ListModelsOptions

func (*LanguageTranslatorV3) NewTranslateOptions

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

NewTranslateOptions : Instantiate TranslateOptions

func (*LanguageTranslatorV3) Translate

func (languageTranslator *LanguageTranslatorV3) Translate(translateOptions *TranslateOptions) (*core.DetailedResponse, error)

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

type LanguageTranslatorV3Options

type LanguageTranslatorV3Options struct {
	Version        string
	URL            string
	Username       string
	Password       string
	IAMApiKey      string
	IAMAccessToken string
	IAMURL         string
}

LanguageTranslatorV3Options : Service options

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.
	DefaultModels *bool `json:"default,omitempty"`

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

ListModelsOptions : The listModels options.

func (*ListModelsOptions) SetDefaultModels

func (options *ListModelsOptions) SetDefaultModels(defaultModels bool) *ListModelsOptions

SetDefaultModels : Allow user to set DefaultModels

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 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"`

	// Model ID of the translation model to use. If this is specified, the **source** and **target** parameters will be
	// ignored. The method requires either a model ID or both the **source** and **target** parameters.
	ModelID *string `json:"model_id,omitempty"`

	// Language code of the source text language. Use with `target` as an alternative way to select a translation model.
	// When `source` and `target` are set, and a model ID is not set, the system chooses a default model for the language
	// pair (usually the model based on the news domain).
	Source *string `json:"source,omitempty"`

	// Language code of the translation target language. Use with source as an alternative way to select a translation
	// model.
	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.
	TranslationOutput *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