Bleu ngrams count

bleu-ngrams-count · version 1.0.0 · Text · free, no key needed

Count BLEU clipped n-gram matches and totals per order for tokenized segments, with optional clipping tables.

Use when you need to: modified n-gram precision numerator and denominator · clipped n-gram match counts against several references · BLEU sufficient statistics per n-gram order.

Decide before calling

Read the versioned contract and the supported scope below. Reuse bleu-ngrams-count@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-ngrams-count@1.0.0 for modified n-gram precision numerator and denominator. 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": [
    [
      "of",
      "the"
    ]
  ],
  "references": [
    [
      [
        "It",
        "is",
        "a",
        "guide",
        "to",
        "action",
        "that",
        "ensures",
        "that",
        "the",
        "military",
        "will",
        "forever",
        "heed",
        "Party",
        "commands"
      ],
      [
        "It",
        "is",
        "the",
        "guiding",
        "principle",
        "which",
        "guarantees",
        "the",
        "military",
        "forces",
        "always",
        "being",
        "under",
        "the",
        "command",
        "of",
        "the",
        "Party"
      ],
      [
        "It",
        "is",
        "the",
        "practical",
        "guide",
        "for",
        "the",
        "army",
        "always",
        "to",
        "heed",
        "the",
        "directions",
        "of",
        "the",
        "party"
      ]
    ]
  ],
  "max_order": 2
}

Response:

{
  "result": {
    "max_order": 2,
    "matches": [
      2,
      1
    ],
    "totals": [
      2,
      1
    ]
  }
}

How to call it

MCP

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

{
  "id": "bleu-ngrams-count",
  "version": "1.0.0",
  "input": {
    "hypotheses": [
      [
        "of",
        "the"
      ]
    ],
    "references": [
      [
        [
          "It",
          "is",
          "a",
          "guide",
          "to",
          "action",
          "that",
          "ensures",
          "that",
          "the",
          "military",
          "will",
          "forever",
          "heed",
          "Party",
          "commands"
        ],
        [
          "It",
          "is",
          "the",
          "guiding",
          "principle",
          "which",
          "guarantees",
          "the",
          "military",
          "forces",
          "always",
          "being",
          "under",
          "the",
          "command",
          "of",
          "the",
          "Party"
        ],
        [
          "It",
          "is",
          "the",
          "practical",
          "guide",
          "for",
          "the",
          "army",
          "always",
          "to",
          "heed",
          "the",
          "directions",
          "of",
          "the",
          "party"
        ]
      ]
    ],
    "max_order": 2
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/bleu-ngrams-count/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"hypotheses":[["of","the"]],"references":[[["It","is","a","guide","to","action","that","ensures","that","the","military","will","forever","heed","Party","commands"],["It","is","the","guiding","principle","which","guarantees","the","military","forces","always","being","under","the","command","of","the","Party"],["It","is","the","practical","guide","for","the","army","always","to","heed","the","directions","of","the","party"]]],"max_order":2}'

The machine-readable contract is at /v1/tools/bleu-ngrams-count/versions/1.0.0.

CLI

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

Get the client at /clients/cli/.