Description
Generate caller-based Unicode-code-point strings using bounded feasible insertion/deletion/substitution/adjacent-swap edits and retain edit records, identity labels, and delegated pairwise Levenshtein/optimal-string-alignment matrices plus JSON; edit count is not minimum distance and OSA is not unrestricted Damerau distance.
A parser corpus pairs literal input spellings or structured documents with observable parser results or explicitly constructed expectations. Successful parsing, semantic validity, and exact round-trip preservation are separate properties, so test records retain the relevant evidence.
Generate caller-based Unicode-code-point strings using bounded feasible insertion/deletion/substitution/adjacent-swap edits and retain edit records, identity labels, and delegated pairwise Levenshtein/optimal-string-alignment matrices plus JSON; edit count is not minimum distance and OSA is not unrestricted Damerau distance.
When to use this tool
Use this generator to create reproducible string distance matrix cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.
How to use the tool and how it works
- Supply sourceTexts, alphabet, count, maximumMutations in the field shapes below. Set seed when you need an explicit replay.
- Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
- Read strings, identical, levenshtein, optimalStringAlignment, matricesJson. Use the conventions below and keep answer-bearing fields separate when presenting an exercise.
Apply sampled feasible insertions, deletions, different-character substitutions, and swaps of unequal adjacent characters to the source. Return generated strings and edit records, then compute symmetric pairwise Levenshtein and optimal-string-alignment distance matrices using existing tools.1
Delegated operations used for this result: levenshtein; damerau levenshtein. Their calculation or parsing conventions apply to the corresponding result fields.2, 3
| Input field | Meaning and units | Accepted input |
|---|---|---|
| sourceTexts | Source Texts | Required. Array of Text; maximum UTF-16 length 128.; minimum items 1; maximum items 16. |
| alphabet | Alphabet | Required. Array of Text; minimum UTF-16 length 1; maximum UTF-16 length 2.; minimum items 1; maximum items 64. |
| count | Requested count; the mechanics explain whether one draw expands into several returned records. | Required. Safe integer; minimum 2; maximum 32. |
| maximumMutations | Maximum Mutations | Required. Safe integer; minimum 0; maximum 8. |
| seed | Optional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed. | Optional. Safe integer. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| strings | Strings | Required. Array of Object; no unknown keys.; minimum items 2; maximum items 32. |
| strings[].sourceIndex | Source Index | Required. Safe integer; minimum 0; maximum 15. |
| strings[].sourceText | Source Text | Required. Text; maximum UTF-16 length 128. |
| strings[].text | Text | Required. Text; maximum UTF-16 length 144. |
| strings[].edits | Edits | Required. Array of Object; no unknown keys.; maximum items 8. |
| strings[].edits[].kind | Kind | Required. Text; one of "insert", "delete", "substitute", "transpose". |
| strings[].edits[].index | Index | Required. Safe integer; minimum 0; maximum 72. |
| strings[].edits[].before | Before | Required. Text; maximum UTF-16 length 4. |
| strings[].edits[].after | After | Required. Text; maximum UTF-16 length 4. |
| identical | Identical | Required. Array of Array of Boolean.; minimum items 2; maximum items 32.; minimum items 2; maximum items 32. |
| levenshtein | Levenshtein | Required. Array of Array of Safe integer; minimum 0; maximum 144.; minimum items 2; maximum items 32.; minimum items 2; maximum items 32. |
| optimalStringAlignment | Optimal String Alignment | Required. Array of Array of Safe integer; minimum 0; maximum 144.; minimum items 2; maximum items 32.; minimum items 2; maximum items 32. |
| matricesJson | Matrices Json | Required. Object; no unknown keys. |
| matricesJson.levenshtein | Levenshtein | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 8192. |
| matricesJson.optimalStringAlignment | Optimal String Alignment | Required. Text; minimum UTF-16 length 1; maximum UTF-16 length 8192. |
| randomness | Replay metadata: source is seed or context; seed is the normalized 32-bit seed or null for a context source. | Required. Object; no unknown keys. |
| randomness.seed | Optional numeric replay seed; normalization and precedence are explained below. | Required. Safe integer. or Null. |
| randomness.source | Source | Required. Text; one of "context", "seed". |
An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.
{
"input": {
"sourceTexts": [
"ab"
],
"alphabet": [
"a",
"b",
"c"
],
"count": 4,
"maximumMutations": 2,
"seed": 42
},
"output": {
"strings": [
{
"sourceIndex": 0,
"sourceText": "ab",
"text": "ba",
"edits": [
{
"kind": "transpose",
"index": 0,
"before": "ab",
"after": "ba"
}
]
},
{
"sourceIndex": 0,
"sourceText": "ab",
"text": "a",
"edits": [
{
"kind": "delete",
"index": 1,
"before": "b",
"after": ""
}
]
},
{
"sourceIndex": 0,
"sourceText": "ab",
"text": "abc",
"edits": [
{
"kind": "insert",
"index": 2,
"before": "",
"after": "c"
}
]
},
{
"sourceIndex": 0,
"sourceText": "ab",
"text": "ab",
"edits": []
}
],
"identical": [
[
true,
false,
false,
false
],
[
false,
true,
false,
false
],
[
false,
false,
true,
false
],
[
false,
false,
false,
true
]
],
"levenshtein": [
[
0,
1,
2,
2
],
[
1,
0,
2,
1
],
[
2,
2,
0,
1
],
[
2,
1,
1,
0
]
],
"optimalStringAlignment": [
[
0,
1,
2,
1
],
[
1,
0,
2,
1
],
[
2,
2,
0,
1
],
[
1,
1,
1,
0
]
],
"matricesJson": {
"levenshtein": "[[0,1,2,2],[1,0,2,1],[2,2,0,1],[2,1,1,0]]",
"optimalStringAlignment": "[[0,1,2,1],[1,0,2,1],[2,2,0,1],[1,1,1,0]]"
},
"randomness": {
"seed": 42,
"source": "seed"
}
}
} Limitations and assumptions
- Mutation count need not equal minimum edit distance. Optimal string alignment is the restricted transposition distance, not unrestricted Damerau distance. The alphabet must contain distinct Unicode scalars.
- A replay requires the same complete input and implementation. Randomized construction does not guarantee uniform coverage of every feasible output; finite samples can repeat unless a distinct-selection rule is explicitly stated.
- The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.
Alternative or Complementary methods
For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.
References
Similar or alternative tools
- Random Identifier Transcription Error Corpus Generator
Generate synthetic checksum-valid EAN-13 and 978-prefixed ISBN-13 originals, apply a selected decimal substitution, deletion, or adjacent transposition, and record actual GTIN/ISBN validator outcomes; swaps may be unchanged or remain valid, and checksum validity is not product or publication allocation.
- Random JSON Duplicate ID Dataset Generator
Construct linked records with an exact duplicate insertion count and retain missing, unique and ambiguous reference candidate indices.