info

package
v0.0.0-...-6de9b76 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DeeplUrl = "https://api-free.deepl.com/v2/translate"

DeeplUrl is the endpoint to the translation API

View Source
const DefinitionUrl = "https://larousse.fr/dictionnaires/francais/"

DefinitionUrl is the endpoint of the French dictionary used for definitions

View Source
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

View Source
const WordReferenceUrl = "https://www.wordreference.com"

WordReferenceUrl is the endpoint to the translation dictionary

Variables

This section is empty.

Functions

func DefinitionCommand

func DefinitionCommand() lib.Command

func ExtractTranslationText

func ExtractTranslationText(node *html.Node) (text, pronouns string)

ExtractTranslationText navigates deeply into HTML nodes to extract useful text for translations

func ParcoursupCommand

func ParcoursupCommand(bot *lib.Bot, update *telegram.Update) (err error)

ParcoursupCommand processes an inline query from a user and returns the results for them to choose from

func TranslateCommand

func TranslateCommand() lib.Command

func WordReferenceCommand

func WordReferenceCommand() lib.Command

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

Jump to

Keyboard shortcuts

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