Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIResponse ¶
type APIResponse struct {
SrcLang string `json:"src_lang"` // e.g "pt"
DstLang string `json:"dst_lang"` // e.g "en"
Query string `json:"query"` // e.g "obrigado"
CorrectQuery string `json:"correct_query"` // e.g "obrigado"
ExactMatches []Lemma `json:"exact_matches"`
InexactMatches []Lemma `json:"inexact_matches"`
RealExamples []RealExample `json:"real_examples"`
}
APIResponse is the root structure of parsed API response
type AudioLink ¶
type AudioLink struct {
URLPart string `json:"url_part"` // e.g "PT_BR/f5/f5491d72610965dd0a287c1ab1025c0f-300"
Lang string `json:"lang"` // e.g "Brazilian Portuguese"
}
AudioLink contains the link to the audio file along with the language variant
type Lemma ¶
type Lemma struct {
Featured bool `json:"featured"`
Wt int `json:"wt"` // e.g 1000 or 386
LemmaID string `json:"lemma_id"` // e.g "PT:obrigado49462"
Text string `json:"text"` // e.g. "obrigado"
WordType wordProperties `json:"word_type"` // e.g "adjective / past participle, masculine"
AudioLinks []AudioLink `json:"audio_links"`
Forms []LemmaForm `json:"forms"`
Translations []Translation `json:"translations"`
}
Lemma contains information about one found word (lemma)
type LemmaForm ¶
type LemmaForm struct {
Text string `json:"text"` // e.g "obrigada"
FormType wordProperties `json:"form_type"` // e.g "f sl"
}
LemmaForm contains variants of the lemma (how it would be in plural, feminine, etc)
type LingueeError ¶
type LingueeError struct {
Message string `json:"message"`
StatusCode int `json:"status_code"`
Correction *string `json:"correction,omitempty"`
}
LingueeError is a Linguee error which implements error interface
func (*LingueeError) Error ¶
func (e *LingueeError) Error() string
type RealExample ¶
type RealExample struct {
ID string `json:"id"` // e.g "row_0_8255523216_0"
Src string `json:"src"` // e.g "Parabéns e um grande obrigado a todos que ajudaram [...] ao sucesso desta noite!"
Dst string `json:"dst"` // e.g "Well done and many thanks to everyone who helped [...] make this evening a success!"
URL string `json:"url"` // e.g "http://www.findmadeleine.com/pt/updates@page=2.html"
}
RealExample is an example of usage of the word in the context
type Translation ¶
type Translation struct {
Featured bool `json:"featured"`
Text string `json:"text"` // e.g "required"
Bid string `json:"bid"` // e.g. "10003211476"
LemmaID string `json:"lemma_id"` // e.g "EN:required5162"
WordType wordProperties `json:"word_type"` // e.g "adjective"
AudioLinks []AudioLink `json:"audio_link"`
Examples []TranslationExample `json:"examples"`
}
Translation is one of the possible translation of the term
type TranslationExample ¶
type TranslationExample struct {
Source string `json:"source"` // e.g. "Estou obrigado pelo contrato a trabalhar seis horas por dia."
Target string `json:"target"` // e.g. "I am bound by the contract to work six hours a day."
}
TranslationExample is a pair of phrases in source and target languages, providing a usage sample for the term
type Translator ¶
Translator is the main API endpoint
func (*Translator) Translate ¶
func (t *Translator) Translate(q, srcLang, dstLang string, guessDirection bool, processCorrection bool) (*APIResponse, error)
Translate returns translation for text from srclang to dstLang