Saltearse al contenido

POST /exercises/evaluate

Evalua la respuesta de un usuario a un ejercicio. Devuelve score 0-10, resultado y feedback.

Campos del body

CampoTipoRequeridoDescripcion
exerciseIdstringSiIdentificador del ejercicio (max 128 chars)
areastringSilistening, reading, writing, vocabulary, grammar
typestringSiVer tabla de tipos
answerstringSiRespuesta del usuario (max 2000 chars)
correctAnswerstring o string[]CondicionalRequerido para multiple_choice y fill_blank. Opcional para open_answer.
contentobjectCondicionalRequerido para drag_and_drop, match, word_search, crossword. Sin el retorna 400.
difficultynumberNoNivel de dificultad 1-5

Tipos soportados

typeEstrategiaScore
multiple_choiceCase-insensitive + trim0 o 10
fill_blankCase-insensitive + trim, multiples alternativas0 o 10
completeIgual que fill_blank — el usuario escribe la palabra0 o 10
open_answerLevenshtein >= 0.8 o longitud minima0-10
drag_and_dropItems en zona correcta / total0-10
matchPares correctos / total0-10
word_searchPalabras encontradas / total0-10
crosswordRespuestas por pista / total, case-insensitive0-10

Estructura de respuesta

{
"correct": true,
"score": 10,
"feedback": "Correct!",
"metadata": {
"area": "vocabulary",
"type": "multiple_choice"
}
}

Ejemplos por tipo

multiple_choice

{
"exerciseId": "ex_001",
"area": "vocabulary",
"type": "multiple_choice",
"answer": "B",
"correctAnswer": "b"
}

“B” y “b” son equivalentes (case-insensitive).

fill_blank - multiples alternativas

{
"exerciseId": "ex_002",
"area": "grammar",
"type": "fill_blank",
"answer": "goes",
"correctAnswer": ["went", "go", "goes"]
}

complete

Identico a fill_blank. Usar cuando el ejercicio pide al usuario que escriba la palabra en un espacio en blanco dentro de un texto.

{
"exerciseId": "ex_002b",
"area": "vocabulary",
"type": "complete",
"answer": "She",
"correctAnswer": "She"
}

Acepta correctAnswer como string o array de alternativas.

open_answer

{
"exerciseId": "ex_003",
"area": "writing",
"type": "open_answer",
"answer": "The cat is sleeping on the couch",
"correctAnswer": "The cat sleeps on the sofa"
}

Feedback segun score: "Good answer!" (>= 0.8), "Your answer is partially correct." (0.5-0.8), "Incorrect. Review the topic and try again." (< 0.5).

drag_and_drop

answer = JSON.stringify({ item_id: zone_id })

{
"exerciseId": "ex_004",
"area": "vocabulary",
"type": "drag_and_drop",
"answer": "{\"1\":\"fruit\",\"2\":\"vegetable\"}",
"content": {
"items": [
{ "id": "1", "text": "Apple", "correctZoneId": "fruit" },
{ "id": "2", "text": "Carrot", "correctZoneId": "vegetable" }
],
"zones": [
{ "id": "fruit", "label": "Fruits" },
{ "id": "vegetable", "label": "Vegetables" }
]
}
}

match

answer = JSON.stringify({ left: right })

{
"exerciseId": "ex_005",
"area": "vocabulary",
"type": "match",
"answer": "{\"Dog\":\"A loyal pet\",\"Cat\":\"A small animal\"}",
"content": {
"pairs": [
{ "left": "Dog", "right": "A loyal pet" },
{ "left": "Cat", "right": "A small animal" }
]
}
}

answer = JSON.stringify({ found: string[] })

{
"exerciseId": "ex_006",
"area": "vocabulary",
"type": "word_search",
"answer": "{\"found\":[\"CAT\",\"DOG\"]}",
"content": {
"words": ["CAT", "DOG", "BIRD"]
}
}

content.words acepta string[] o { word, clue }[].

crossword

answer = JSON.stringify({ "1": "WORD", "2": "WORD" }) - claves son el numero de pista (1-based).

{
"exerciseId": "ex_007",
"area": "vocabulary",
"type": "crossword",
"answer": "{\"1\":\"cat\",\"2\":\"dog\",\"3\":\"act\"}",
"content": {
"words": [
{ "answer": "CAT", "clue": { "type": "TEXT", "value": "A small animal" } },
{ "answer": "DOG", "clue": { "type": "TEXT", "value": "A loyal pet" } },
{ "answer": "ACT", "clue": { "type": "TEXT", "value": "To do something" } }
]
}
}

La comparacion es case-insensitive: “cat” === “CAT”.