Documentation ¶
Index ¶
- Constants
- func DefinitionCommand() lib.Command
- func ExtractTranslationText(node *html.Node) (text, pronouns string)
- func ParcoursupCommand(bot *lib.Bot, update *telegram.Update) (err error)
- func TranslateCommand() lib.Command
- func WordReferenceCommand() lib.Command
- type DeeplResponse
- type ParcoursupRecord
- type ParcoursupResponse
- type Translation
Constants ¶
const DeeplUrl = "https://api-free.deepl.com/v2/translate"
DeeplUrl is the endpoint to the translation API
const DefinitionUrl = "https://larousse.fr/dictionnaires/francais/"
DefinitionUrl is the endpoint of the French dictionary used for definitions
const ParcoursupUrl = "https://data.enseignementsup-recherche.gouv.fr/api/records/1.0/search/?dataset=fr-esr-cartographie_formations_parcoursup"
ParcoursupUrl is the endpoint of the OpenData API
const WordReferenceUrl = "https://www.wordreference.com"
WordReferenceUrl is the endpoint to the translation dictionary
Variables ¶
This section is empty.
Functions ¶
func DefinitionCommand ¶
func ExtractTranslationText ¶
ExtractTranslationText navigates deeply into HTML nodes to extract useful text for translations
func ParcoursupCommand ¶
ParcoursupCommand processes an inline query from a user and returns the results for them to choose from
func TranslateCommand ¶
func WordReferenceCommand ¶
Types ¶
type DeeplResponse ¶
type DeeplResponse struct {
Translations []Translation
}
DeeplResponse stores the response from DeepL API
type ParcoursupRecord ¶
type ParcoursupRecord struct { // The unique identifier of the record ID string `json:"recordid"` // Date when the record was published Timestamp string `json:"record_timestamp"` // Specific fields related to the record Fields struct { // Full name of the file Name string `json:"etab_nom"` // The concerned course Course string `json:"nm"` // On what domain the course is specialized Specialization string `json:"fl"` // French city where the course is City string `json:"commune"` // French "département" where the course is Department string `json:"departement"` // French region where the course is Region string `json:"region"` // Longitude and latitude of course's location Coordinates []float64 `json:"etab_gps"` // Web URL to the Parcoursup file File string `json:"fiche"` // Web URL to course's website Website string `json:"etab_url"` // Web URL to last year statistics on this course Statistics string `json:"dataviz"` } }
ParcoursupRecord stores a Parcoursup file
type ParcoursupResponse ¶
type ParcoursupResponse struct { // The list of record retrieved Records []ParcoursupRecord }
ParcoursupResponse stores the result of a call to the OpenData API
func SearchParcoursup ¶
func SearchParcoursup(query string) (result ParcoursupResponse, err error)
SearchParcoursup queries the API to search for courses on Parcoursup
type Translation ¶
type Translation struct { // The language from which the text was translated (usually automatically determined by DeepL) SourceLanguage string `json:"detected_source_language"` // The translated text Text string }
Translation represents the translation of a sentence or more from a certain language