service

package
v0.0.0-...-9eaf9d2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrTatoebaSentenceAlreadyExists = errors.New("tatoebaSentence already exists")
View Source
var ErrTranslationAlreadyExists = errors.New("custsomtranslation already exists")
View Source
var ErrTranslationNotFound = errors.New("translation not found")

Functions

This section is empty.

Types

type TatoebaClient

type TatoebaClient interface {
	FindSentencePairs(ctx context.Context, param TatoebaSentenceSearchCondition) (*TatoebaSentencePairSearchResult, error)

	FindSentenceBySentenceNumber(ctx context.Context, sentenceNumber int) (TatoebaSentence, error)

	ImportSentences(ctx context.Context, reader io.Reader) error

	ImportLinks(ctx context.Context, reader io.Reader) error
}

type TatoebaSentence

type TatoebaSentence interface {
	GetSentenceNumber() int
	GetLang2() appD.Lang2
	GetText() string
	GetAuthor() string
	GetUpdatedAt() time.Time
}

func NewTatoebaSentence

func NewTatoebaSentence(sentenceNumber int, lang2 appD.Lang2, text, author string, updatedAt time.Time) (TatoebaSentence, error)

type TatoebaSentencePair

type TatoebaSentencePair interface {
	GetSrc() TatoebaSentence
	GetDst() TatoebaSentence
}

func NewTatoebaSentencePair

func NewTatoebaSentencePair(src, dst TatoebaSentence) (TatoebaSentencePair, error)

type TatoebaSentencePairSearchResult

type TatoebaSentencePairSearchResult struct {
	TotalCount int64
	Results    []TatoebaSentencePair
}

type TatoebaSentenceSearchCondition

type TatoebaSentenceSearchCondition interface {
	GetPageNo() int
	GetPageSize() int
	GetKeyword() string
	IsRandom() bool
}

func NewTatoebaSentenceSearchCondition

func NewTatoebaSentenceSearchCondition(pageNo, pageSize int, keyword string, random bool) (TatoebaSentenceSearchCondition, error)

type TranslationAddParameter

type TranslationAddParameter interface {
	GetText() string
	GetPos() domain.WordPos
	GetLang2() appD.Lang2
	GetTranslated() string
}

func NewTransalationAddParameter

func NewTransalationAddParameter(text string, pos domain.WordPos, lang2 appD.Lang2, translated string) (TranslationAddParameter, error)

type TranslationUpdateParameter

type TranslationUpdateParameter interface {
	GetTranslated() string
}

func NewTransaltionUpdateParameter

func NewTransaltionUpdateParameter(translated string) (TranslationUpdateParameter, error)

type TranslatorClient

type TranslatorClient interface {
	DictionaryLookup(ctx context.Context, fromLang, toLang appD.Lang2, text string) ([]domain.Translation, error)
	DictionaryLookupWithPos(ctx context.Context, fromLang, toLang appD.Lang2, text string, pos domain.WordPos) (domain.Translation, error)
	FindTranslationsByFirstLetter(ctx context.Context, lang2 appD.Lang2, firstLetter string) ([]domain.Translation, error)
	FindTranslationByTextAndPos(ctx context.Context, lang2 appD.Lang2, text string, pos domain.WordPos) (domain.Translation, error)
	FindTranslationsByText(ctx context.Context, lang2 appD.Lang2, text string) ([]domain.Translation, error)
	AddTranslation(ctx context.Context, param TranslationAddParameter) error
	UpdateTranslation(ctx context.Context, lang2 appD.Lang2, text string, pos domain.WordPos, param TranslationUpdateParameter) error
	RemoveTranslation(ctx context.Context, lang2 appD.Lang2, text string, pos domain.WordPos) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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