modernmt

package module
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 14 Imported by: 0

README

ModernMT Go Library

Provides convenient access to the ModernMT API.

Documentation

See the official website API docs.

Requirements

Go 1.16 or higher

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Status  int
	Type    string
	Message string
}

func (APIError) Error

func (re APIError) Error() string

type DetectedLanguage added in v1.0.4

type DetectedLanguage struct {
	BilledCharacters int
	DetectedLanguage string
}

type GlossaryTerm added in v1.5.0

type GlossaryTerm struct {
	Term     string `json:"term"`
	Language string `json:"language"`
}

type ImportJob

type ImportJob struct {
	Id       string
	Memory   int64
	Size     int
	Progress float32
}

type Memory

type Memory struct {
	Id           int64
	Name         string
	Description  string
	CreationDate string
}

type ModernMT

type ModernMT struct {
	Memories memoryServices
	// contains filtered or unexported fields
}

func Create

func Create(apiKey string) *ModernMT

func CreateWithClientId added in v1.1.0

func CreateWithClientId(apiKey string, apiClient int64) *ModernMT

func CreateWithIdentity

func CreateWithIdentity(apiKey string, platform string, platformVersion string) *ModernMT

func CreateWithIdentityAndClientId added in v1.1.0

func CreateWithIdentityAndClientId(apiKey string, platform string, platformVersion string, apiClient int64) *ModernMT

func (*ModernMT) BatchTranslate added in v1.2.0

func (re *ModernMT) BatchTranslate(webhook string, source string, target string, q string, options *TranslateOptions) (bool, error)

func (*ModernMT) BatchTranslateAdaptive added in v1.2.0

func (re *ModernMT) BatchTranslateAdaptive(webhook string, source string, target string, q string, hints []int64, contextVector string,
	options *TranslateOptions) (bool, error)

func (*ModernMT) BatchTranslateAdaptiveWithKeys added in v1.2.0

func (re *ModernMT) BatchTranslateAdaptiveWithKeys(webhook string, source string, target string, q string, hints []string,
	contextVector string, options *TranslateOptions) (bool, error)

func (*ModernMT) BatchTranslateList added in v1.2.0

func (re *ModernMT) BatchTranslateList(webhook string, source string, target string, q []string,
	options *TranslateOptions) (bool, error)

func (*ModernMT) BatchTranslateListAdaptive added in v1.2.0

func (re *ModernMT) BatchTranslateListAdaptive(webhook string, source string, target string, q []string, hints []int64,
	contextVector string, options *TranslateOptions) (bool, error)

func (*ModernMT) BatchTranslateListAdaptiveWithKeys added in v1.2.0

func (re *ModernMT) BatchTranslateListAdaptiveWithKeys(webhook string, source string, target string, q []string, hints []string,
	contextVector string, options *TranslateOptions) (bool, error)

func (*ModernMT) DetectLanguage added in v1.0.4

func (re *ModernMT) DetectLanguage(q string, format string) (DetectedLanguage, error)

func (*ModernMT) DetectLanguages added in v1.0.4

func (re *ModernMT) DetectLanguages(q []string, format string) ([]DetectedLanguage, error)

func (*ModernMT) GetContextVector

func (re *ModernMT) GetContextVector(source string, target string, text string, hints []int64,
	limit int) (string, error)

func (*ModernMT) GetContextVectorByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorByKeys(source string, target string, text string, hints []string,
	limit int) (string, error)

func (*ModernMT) GetContextVectorFromFile

func (re *ModernMT) GetContextVectorFromFile(source string, target string, file *os.File, hints []int64,
	limit int, compression string) (string, error)

func (*ModernMT) GetContextVectorFromFileByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorFromFileByKeys(source string, target string, file *os.File, hints []string,
	limit int, compression string) (string, error)

func (*ModernMT) GetContextVectorFromFilePath

func (re *ModernMT) GetContextVectorFromFilePath(source string, target string, path string, hints []int64,
	limit int, compression string) (string, error)

func (*ModernMT) GetContextVectorFromFilePathByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorFromFilePathByKeys(source string, target string, path string, hints []string,
	limit int, compression string) (string, error)

func (*ModernMT) GetContextVectors

func (re *ModernMT) GetContextVectors(source string, targets []string, text string, hints []int64,
	limit int) (map[string]interface{}, error)

func (*ModernMT) GetContextVectorsByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorsByKeys(source string, targets []string, text string, hints []string,
	limit int) (map[string]interface{}, error)

func (*ModernMT) GetContextVectorsFromFile

func (re *ModernMT) GetContextVectorsFromFile(source string, targets []string, file *os.File, hints []int64,
	limit int, compression string) (map[string]interface{}, error)

func (*ModernMT) GetContextVectorsFromFileByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorsFromFileByKeys(source string, targets []string, file *os.File, hints []string,
	limit int, compression string) (map[string]interface{}, error)

func (*ModernMT) GetContextVectorsFromFilePath

func (re *ModernMT) GetContextVectorsFromFilePath(source string, targets []string, path string, hints []int64,
	limit int, compression string) (map[string]interface{}, error)

func (*ModernMT) GetContextVectorsFromFilePathByKeys added in v1.0.3

func (re *ModernMT) GetContextVectorsFromFilePathByKeys(source string, targets []string, path string, hints []string,
	limit int, compression string) (map[string]interface{}, error)

func (*ModernMT) HandleTranslateCallback added in v1.2.0

func (re *ModernMT) HandleTranslateCallback(body []byte, signature string) (Translation, error)

func (*ModernMT) HandleTranslateCallbackWithMetadata added in v1.2.0

func (re *ModernMT) HandleTranslateCallbackWithMetadata(body []byte, signature string, metadata interface{}) (Translation, error)

func (*ModernMT) HandleTranslateListCallback added in v1.2.0

func (re *ModernMT) HandleTranslateListCallback(body []byte, signature string) ([]Translation, error)

func (*ModernMT) HandleTranslateListCallbackWithMetadata added in v1.2.0

func (re *ModernMT) HandleTranslateListCallbackWithMetadata(body []byte, signature string, metadata interface{}) ([]Translation, error)

func (*ModernMT) ListSupportedLanguages

func (re *ModernMT) ListSupportedLanguages() ([]string, error)

func (*ModernMT) Me added in v1.3.0

func (re *ModernMT) Me() (User, error)

func (*ModernMT) Qe added in v1.3.0

func (re *ModernMT) Qe(source string, target string, sentence string, translation string) (QualityEstimation, error)

func (*ModernMT) QeList added in v1.3.0

func (re *ModernMT) QeList(source string, target string,
	sentences []string, translations []string) ([]QualityEstimation, error)

func (*ModernMT) Translate

func (re *ModernMT) Translate(source string, target string, q string, options *TranslateOptions) (Translation, error)

func (*ModernMT) TranslateAdaptive

func (re *ModernMT) TranslateAdaptive(source string, target string, q string, hints []int64, contextVector string,
	options *TranslateOptions) (Translation, error)

func (*ModernMT) TranslateAdaptiveWithKeys added in v1.0.3

func (re *ModernMT) TranslateAdaptiveWithKeys(source string, target string, q string, hints []string,
	contextVector string, options *TranslateOptions) (Translation, error)

func (*ModernMT) TranslateList

func (re *ModernMT) TranslateList(source string, target string, q []string,
	options *TranslateOptions) ([]Translation, error)

func (*ModernMT) TranslateListAdaptive

func (re *ModernMT) TranslateListAdaptive(source string, target string, q []string, hints []int64,
	contextVector string, options *TranslateOptions) ([]Translation, error)

func (*ModernMT) TranslateListAdaptiveWithKeys added in v1.0.3

func (re *ModernMT) TranslateListAdaptiveWithKeys(source string, target string, q []string, hints []string,
	contextVector string, options *TranslateOptions) ([]Translation, error)

type QualityEstimation added in v1.3.0

type QualityEstimation struct {
	Score float32
}

type TranslateOptions

type TranslateOptions struct {
	Priority           string
	ProjectId          string
	Multiline          *bool
	Timeout            int
	Format             string
	AltTranslations    int
	Session            string
	Glossaries         interface{}
	IgnoreGlossaryCase bool
	MaskProfanities    bool

	// batch translation
	Metadata       interface{}
	IdempotencyKey string
}

type Translation

type Translation struct {
	Translation         string
	ContextVector       string
	Characters          int
	BilledCharacters    int
	DetectedLanguage    string
	AltTranslations     []string
	DetectedProfanities bool
}

type User added in v1.3.0

type User struct {
	Id               int64
	Name             string
	Email            string
	RegistrationDate string
	Country          string
	IsBusiness       int8
	Status           string
	BillingPeriod    billingPeriod
}

Jump to

Keyboard shortcuts

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