{"uid":"cap_2c4FdGZkrgJWx4UctplUZ","slug":"bleu-and-rouge-metrics-calculator-0beb6647","name":"BLEU and ROUGE Metrics Calculator","description":"Sentence BLEU (1-4 gram, brevity penalty, optional smoothing) and ROUGE-1, ROUGE-2, ROUGE-L F1 for text against references.","url":"https://ml-metrics.x402tookit.com/bleu-rouge?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["candidate","references"],"properties":{"maxn":{"type":"integer","description":"Highest BLEU n-gram order, 1 to 4, default 4"},"candidate":{"type":"string","description":"Generated text, up to 5000 characters"},"smoothing":{"type":"string","description":"none (default), add1 (add one to n>1 counts), or epsilon (0.1 for zero matches)"},"tokenizer":{"type":"string","description":"whitespace (default, text is split on spaces as given) or words (lowercase, punctuation removed)"},"references":{"type":"string","description":"One or more reference texts separated by a line break or |||, up to 20 references, 5000 characters each"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"bleu":{"type":["null","number"]},"rouge1":{"type":["null","object"],"properties":{"f1":{"type":["null","number"]},"recall":{"type":["null","number"]},"precision":{"type":["null","number"]}}},"rouge2":{"type":["null","object"],"properties":{"f1":{"type":["null","number"]},"recall":{"type":["null","number"]},"precision":{"type":["null","number"]}}},"rougeL":{"type":["null","object"],"properties":{"f1":{"type":["null","number"]},"recall":{"type":["null","number"]},"precision":{"type":["null","number"]}}},"source":{"type":["null","string"]},"reasons":{"type":["array","null"]},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"bleuOrder":{"type":["null","number"]},"rougeNote":{"type":["null","string"]},"smoothing":{"type":["null","string"]},"tokenizer":{"type":["null","string"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"brevityPenalty":{"type":["null","number"]},"referenceCount":{"type":["null","number"]},"candidateTokens":{"type":["null","number"]},"ngramPrecisions":{"type":["array","null"],"items":{"type":"object","properties":{"n":{"type":["null","number"]},"total":{"type":["null","number"]},"matches":{"type":["null","number"]},"precision":{"type":["null","number"]}}}},"closestReferenceTokens":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_SZb6FVszRT_tZhzjxi9K9","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Computes sentence BLEU (1–4 gram with brevity penalty and optional smoothing) and ROUGE-1, ROUGE-2, ROUGE-L F1/precision/recall scores for a candidate text against one or more reference texts.","exampleAgentPrompt":"Score my model's output against these two reference sentences using BLEU up to 4-gram with epsilon smoothing and also give me ROUGE-1, ROUGE-2, and ROUGE-L — candidate: 'The cat sat on the mat', references: 'The cat is on the mat' and 'A cat was sitting on the mat'.","exampleUseCases":[{"title":"Evaluating machine translation output","prompt":"I have a machine-translated sentence — 'The quick brown fox leaps over the lazy dog' — and two reference translations: 'The fast brown fox jumps over the lazy dog' and 'A quick brown fox jumped over a lazy dog'. Can you give me its BLEU score up to 4-gram with add1 smoothing plus all ROUGE scores?"},{"title":"Benchmarking LLM summarization quality","prompt":"My LLM generated this summary: 'Scientists discovered a new species of deep-sea fish near the Pacific trench.' The gold reference is: 'Researchers have found a previously unknown deep-sea fish species in the Pacific Ocean.' Please compute the BLEU and ROUGE-1, ROUGE-2, and ROUGE-L F1 scores using whitespace tokenization."},{"title":"Grading student-generated answers against rubric","prompt":"I need to score this student answer: 'Photosynthesis converts light energy into glucose using carbon dioxide and water.' against the model answer: 'Photosynthesis is the process by which plants use sunlight, water, and CO2 to produce glucose and oxygen.' Give me BLEU with 4-gram and epsilon smoothing, plus ROUGE scores so I can see how close they are."}],"resultDescription":"Returns a JSON object containing the BLEU score and its n-gram order, ROUGE-1, ROUGE-2, and ROUGE-L each with precision, recall, and F1, along with metadata such as smoothing method used, tokenizer, an optional summary/verdict, and any degraded-mode or disclaimer notes.","failureModes":["Missing required 'candidate' or 'references' query parameter — returns 400 validation error","Candidate or reference text exceeds 5000-character limit — returns 400 or truncation error","More than 20 reference texts provided — exceeds limit, returns 400","Invalid 'smoothing' or 'tokenizer' enum value — returns 400 with description","Empty candidate or reference string — may return null BLEU or ROUGE values with a rougeNote","Payment not provided or insufficient — returns 402 Payment Required"],"whenToPreferThis":"Choose this endpoint when you need standard NLP evaluation metrics (BLEU and ROUGE) in a single call without setting up NLTK, sacrebleu, or rouge-score locally. Ideal for agents evaluating summarization, translation, or generation quality in real time, especially when infrastructure-free computation is needed. Prefer it over rolling your own when you need brevity-penalty-correct BLEU with configurable n-gram order and smoothing alongside ROUGE-L simultaneously.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-11-02T12:31:05.802Z","isFirstParty":false,"canonicalSlug":"bleu-and-rouge-metrics-calculator-0beb6647"}