Multiset Capped Count Table
Cap each normalized typed multiplicity at an explicit nonnegative integer and omit resulting zeros; no proportional redistribution.
Description
Cap each normalized typed multiplicity at an explicit nonnegative integer and omit resulting zeros; no proportional redistribution.
Capping multiplicities limits how often each distinct value can occur while retaining its identity.
When to use this tool
Cap each normalized typed multiplicity at an explicit nonnegative integer and omit resulting zeros; no proportional redistribution.
- Prepare the supplied countsJson, cap fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter countsJson, cap. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.counts. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Aggregate countsJson records and require cap from zero to one million. Replace every count by min(count,cap) and omit zero-count rows.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| countsJson | JSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file. | Text |
| cap | cap. | Integer from 0 to 1e6 inclusive |
For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.
[
{
"field": "countsJson",
"decoded": [
{
"value": "a",
"count": 3
},
{
"value": "b",
"count": 1
}
]
}
] | Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.counts | The counts list in the ordering and representation described above. |
{
"input": {
"countsJson": "[{\"value\":\"a\",\"count\":3},{\"value\":\"b\",\"count\":1}]",
"cap": 2
},
"output": {
"result": {
"counts": [
{
"value": "a",
"count": 2
},
{
"value": "b",
"count": 1
}
]
}
}
} Limitations and assumptions
- The cap applies per value, not to the total cardinality. No occurrence order or sampling policy is generated.
- All declared input fields are required and unexpected top-level fields are rejected. Numbers must be finite; lists are limited to 128 entries and ordinary text fields to 8,192 UTF-16 code units, with tighter limits where stated.
- JSON text inputs must parse within bounded nesting and size limits. Numeric outputs outside the safe finite range are rejected; large exact integer results use decimal strings. Indexes and half-open spans are zero-based unless a rank is explicitly described as one-based.
Alternative or Complementary methods
Keep occurrence sequences separate from count tables. Choose maximum union, additive concatenation or allocation deliberately, and apply any real inventory changes through a system that controls concurrent updates.
References
Similar or alternative tools
- Multiset Complete Kit Count
Count complete typed kits consumable from an explicit inventory using the limiting required multiplicity; empty kit requirements are rejected.
- Multiset One Kit Consumption
Apply one all-or-nothing typed kit consumption; insufficient inventory remains unchanged rather than partially consumed.