Bleu corpus compute

bleu-corpus-compute · version 1.0.0 · Text · free, no key needed

Compute canonical corpus BLEU from pre-tokenized segments: score, brevity penalty, lengths, clipped n-gram counts.

Use when you need to: corpus BLEU score from tokenized segments · system-level BLEU for a machine translation test set · compute BLEU-4 over a whole corpus without smoothing.

Decide before calling

Read the versioned contract and the supported scope below. Reuse bleu-corpus-compute@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-corpus-compute@1.0.0 for corpus BLEU score from tokenized segments. 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:

{
  "hypotheses": [
    [
      "this",
      "is",
      "a",
      "test"
    ]
  ],
  "references": [
    [
      [
        "this",
        "is",
        "a",
        "test"
      ]
    ]
  ]
}

Response:

{
  "result": {
    "bleu": 1,
    "brevity_penalty": 1,
    "candidate_length": 4,
    "reference_length": 4,
    "max_order": 4,
    "matches": [
      4,
      3,
      2,
      1
    ],
    "totals": [
      4,
      3,
      2,
      1
    ]
  }
}

How to call it

MCP

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

{
  "id": "bleu-corpus-compute",
  "version": "1.0.0",
  "input": {
    "hypotheses": [
      [
        "this",
        "is",
        "a",
        "test"
      ]
    ],
    "references": [
      [
        [
          "this",
          "is",
          "a",
          "test"
        ]
      ]
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/bleu-corpus-compute/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"hypotheses":[["this","is","a","test"]],"references":[[["this","is","a","test"]]]}'

The machine-readable contract is at /v1/tools/bleu-corpus-compute/versions/1.0.0.

CLI

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

Get the client at /clients/cli/.