{"id":"bleu-brevity-penalty","version":"1.0.0","description":"Compute the BLEU corpus brevity penalty from candidate and reference lengths using closest reference lengths.","supported_operations":["BLEU brevity penalty from token lengths","effective reference length r for a test corpus","best match reference length closest to the candidate","exp(1 - r/c) penalty for short translations","is my translation too short for BLEU","corpus brevity penalty with several references per segment","קנס קיצור לתרגום קצר מדי"],"unsupported_operations":["counting tokens in raw text (lengths must be given as integers)","shortest-reference or average-reference length variants","per-sentence penalties averaged over a corpus","the full BLEU score (use bleu-corpus-compute)"],"semantics":["Each segment gives candidate_length and 1 to 8 reference_lengths. Its best-match length is the reference length closest to candidate_length; ties go to the shorter length (mteval-v13a, NLTK closest_ref_length, sacreBLEU).","candidate_length c and reference_length r are the corpus sums of candidate lengths and best-match lengths (Papineni 2002 section 2.2.2); closest_reference_lengths lists the best-match length per segment in input order.","brevity_penalty = 1 when c > r; 0 when c = 0 (an empty candidate, even when r = 0, as in NLTK brevity_penalty); otherwise exp(1 - r/c), which is 1 when c = r.","decimals (0-15) rounds brevity_penalty with Number.prototype.toFixed (nearest, computed on the exact binary value); omitted means full IEEE-754 double precision."],"limits":{"max_segments":10000,"max_references_per_segment":8,"max_length_value":1000000},"pricing":{"status":"unpriced","charge_usd":null},"input_schema":{"type":"object","additionalProperties":false,"required":["segments"],"properties":{"segments":{"type":"array","minItems":1,"maxItems":10000,"items":{"type":"object","additionalProperties":false,"required":["candidate_length","reference_lengths"],"properties":{"candidate_length":{"type":"integer","minimum":0,"maximum":1000000},"reference_lengths":{"type":"array","minItems":1,"maxItems":8,"items":{"type":"integer","minimum":0,"maximum":1000000}}}}},"decimals":{"type":"integer","minimum":0,"maximum":15}}},"output_schema":{"type":"object","additionalProperties":false,"required":["candidate_length","reference_length","closest_reference_lengths","brevity_penalty"],"properties":{"candidate_length":{"type":"integer","minimum":0},"reference_length":{"type":"integer","minimum":0},"closest_reference_lengths":{"type":"array","minItems":1,"items":{"type":"integer","minimum":0}},"brevity_penalty":{"type":"number","minimum":0,"maximum":1}}},"examples":[{"input":{"segments":[{"candidate_length":12,"reference_lengths":[28,28]}]},"output":{"candidate_length":12,"reference_length":28,"closest_reference_lengths":[28],"brevity_penalty":0.2635971381157267}},{"input":{"segments":[{"candidate_length":6,"reference_lengths":[6,7]},{"candidate_length":4,"reference_lengths":[5,5]},{"candidate_length":7,"reference_lengths":[6,7]}],"decimals":3},"output":{"candidate_length":17,"reference_length":18,"closest_reference_lengths":[6,5,7],"brevity_penalty":0.943}},{"input":{"segments":[{"candidate_length":0,"reference_lengths":[0]}]},"output":{"candidate_length":0,"reference_length":0,"closest_reference_lengths":[0],"brevity_penalty":0}}],"execute_url":"/v1/tools/bleu-brevity-penalty/versions/1.0.0/execute"}