GEMBA Quality Scoring
Scores a translation on a continuous 0-100 Scalar Quality Metric (SQM/GEMBA-DA) scale, measuring meaning preservation and grammatical correctness. Optionally calibrated using a human reference translation.
Endpoint: POST /translation/gemba
Request Body
Section titled “Request Body”Sent as JSON.
| Field | Type | Required | Description |
|---|---|---|---|
sourceLang |
string | yes | Source language code |
targetLang |
string | yes | Target language code |
sourceText |
string | yes | The original text in the source language |
translatedText |
string | yes | The translated text to evaluate |
referenceText |
string | no | Human reference translation used to calibrate the score |
Response
Section titled “Response”Success Response (200)
{ "status": "ok", "timestamp": "2025-01-12T22:31:48.856Z", "data": { "score": 87.5 }}score ranges from 0 (no meaning preserved) to 100 (perfect meaning and grammar).
Example Request
Section titled “Example Request”curl -X POST "https://platform.algebras.ai/api/v1/translation/gemba" \ -H "X-Api-Key: your_api_key_here" \ -H "Content-Type: application/json" \ -d '{ "sourceLang": "en", "targetLang": "de", "sourceText": "Hello, World!", "translatedText": "Hallo, Welt!" }'import requests
url = "https://platform.algebras.ai/api/v1/translation/gemba"headers = { "X-Api-Key": "your_api_key_here", "Content-Type": "application/json"}data = { "sourceLang": "en", "targetLang": "de", "sourceText": "Hello, World!", "translatedText": "Hallo, Welt!"}
response = requests.post(url, headers=headers, json=data)
if response.status_code == 200: print("Score:", response.json()["data"]["score"])else: print(f"Error: {response.status_code}") print(response.json())const url = "https://platform.algebras.ai/api/v1/translation/gemba";
const response = await fetch(url, { method: "POST", headers: { "X-Api-Key": "your_api_key_here", "Content-Type": "application/json", }, body: JSON.stringify({ sourceLang: "en", targetLang: "de", sourceText: "Hello, World!", translatedText: "Hallo, Welt!", }),});
if (response.ok) { const result = await response.json(); console.log("Score:", result.data.score);} else { const error = await response.json(); console.error("Error:", response.status, error);}package main
import ( "bytes" "encoding/json" "fmt" "io" "net/http")
func main() { url := "https://platform.algebras.ai/api/v1/translation/gemba"
payload := map[string]interface{}{ "sourceLang": "en", "targetLang": "de", "sourceText": "Hello, World!", "translatedText": "Hallo, Welt!", }
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData)) req.Header.Set("X-Api-Key", "your_api_key_here") req.Header.Set("Content-Type", "application/json")
client := &http.Client{} resp, err := client.Do(req) if err != nil { panic(err) } defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
if resp.StatusCode == 200 { var result map[string]interface{} json.Unmarshal(body, &result) data := result["data"].(map[string]interface{}) fmt.Println("Score:", data["score"]) } else { fmt.Printf("Error: %d\n", resp.StatusCode) fmt.Println(string(body)) }}