libmozhi

package module
v0.0.0-...-697ab3b Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: AGPL-3.0 Imports: 17 Imported by: 0

README

LibMozhi

AGPLv3 Matrix Go Reference

Library that backs Mozhi.

File Matrix

  • autodetect.go - Auto detect language from given text.
  • engines.go - Code for getting data from engines themselves
  • langlist-*.go - List of languages supported by the specific engine
  • tts.go - Get TTS data for given text
  • retrieve.go - Used to get new langlist data
  • libmozhi.go - Main functions that wrap around the others to make the thing usable

Documentation

Overview

Autogenerated by retrieve.go. DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDetectLibreTranslate

func AutoDetectLibreTranslate(query string) (string, error)

func AutoDetectWatson

func AutoDetectWatson(query string) (string, error)

func TTS

func TTS(engine string, lang string, text string) ([]byte, error)

Types

type ImgOut

type ImgOut struct {
	SourceB64            string
	TranslatedImgB64     string
	SourceLang           string
	TargetLang           string
	SourceTextParsed     string
	TranslatedTextParsed string
}

func ImageGoogle

func ImageGoogle(to string, from string, imgB64 string) (ImgOut, error)

type LangOut

type LangOut struct {
	Engine                string        `json:"engine"`
	AutoDetect            string        `json:"detected"`
	OutputText            string        `json:"translated-text"`
	SourceLang            string        `json:"source_language"`
	TargetLang            string        `json:"target_language"`
	WordChoices           []WordChoices `json:"word_choices"`
	SourceTransliteration string        `json:"source_transliteration"`
	TargetTransliteration string        `json:"target_transliteration"`
}

func Translate

func Translate(engine string, to string, from string, text string) (LangOut, error)

General function to translate stuff so there is no need for a huge if-block everywhere

func TranslateAll

func TranslateAll(to string, from string, query string) []LangOut

func TranslateSome

func TranslateSome(engines []string, to string, from string, query string) ([]LangOut, error)

type List

type List struct {
	Name string
	Id   string
}

func LangList

func LangList(engine string, listType string) ([]List, error)

type WordChoices

type WordChoices struct {
	Word           string   `json:"word"`
	ExamplesSource []string `json:"examples_source"`
	ExamplesTarget []string `json:"examples_target"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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