Bleu brevity penalty

bleu-brevity-penalty · version 1.0.0 · Text · free, no key needed

Compute the BLEU corpus brevity penalty from candidate and reference lengths using closest reference lengths.

Use when you need to: BLEU brevity penalty from token lengths · effective reference length r for a test corpus · best match reference length closest to the candidate.

Decide before calling

Read the versioned contract and the supported scope below. Reuse bleu-brevity-penalty@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use bleu-brevity-penalty@1.0.0 for BLEU brevity penalty from token lengths. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "segments": [
    {
      "candidate_length": 12,
      "reference_lengths": [
        28,
        28
      ]
    }
  ]
}

Response:

{
  "result": {
    "candidate_length": 12,
    "reference_length": 28,
    "closest_reference_lengths": [
      28
    ],
    "brevity_penalty": 0.2635971381157267
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "bleu-brevity-penalty",
  "version": "1.0.0",
  "input": {
    "segments": [
      {
        "candidate_length": 12,
        "reference_lengths": [
          28,
          28
        ]
      }
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/bleu-brevity-penalty/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"segments":[{"candidate_length":12,"reference_lengths":[28,28]}]}'

The machine-readable contract is at /v1/tools/bleu-brevity-penalty/versions/1.0.0.

CLI

node cli.mjs run bleu-brevity-penalty 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.