glitchlings 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,42 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*.*.*'
7
+
8
+ jobs:
9
+ build-and-publish:
10
+ name: Build and publish
11
+ runs-on: ubuntu-latest
12
+
13
+ permissions:
14
+ id-token: write # for OIDC
15
+ contents: read
16
+
17
+ steps:
18
+ - name: Checkout
19
+ uses: actions/checkout@v4
20
+
21
+ - name: Set up Python
22
+ uses: actions/setup-python@v5
23
+ with:
24
+ python-version: '3.12'
25
+
26
+ - name: Install build tools
27
+ run: |
28
+ python -m pip install --upgrade pip
29
+ python -m pip install build
30
+
31
+ - name: Build sdist and wheel
32
+ run: |
33
+ python -m build
34
+ working-directory: glitchlings
35
+
36
+ - name: Publish to PyPI
37
+ uses: pypa/gh-action-pypi-publish@release/v1
38
+ with:
39
+ packages-dir: glitchlings/dist
40
+ # Uses OIDC by default if PYPI_API_TOKEN is not provided and the PyPI project is configured for trusted publishing.
41
+ # To use a token secret instead, uncomment the next line and add PYPI_API_TOKEN to repo secrets.
42
+ # password: ${{ secrets.PYPI_API_TOKEN }}
@@ -0,0 +1,38 @@
1
+ name: Publish to TestPyPI
2
+
3
+ on:
4
+ push:
5
+ branches: [ trunk ]
6
+
7
+ jobs:
8
+ build-and-publish-testpypi:
9
+ if: ${{ secrets.TEST_PYPI_API_TOKEN != '' }}
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+
14
+ steps:
15
+ - name: Checkout
16
+ uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: '3.12'
22
+
23
+ - name: Install build tools
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ python -m pip install build twine
27
+
28
+ - name: Build sdist and wheel
29
+ run: |
30
+ python -m build
31
+ working-directory: glitchlings
32
+
33
+ - name: Upload to TestPyPI
34
+ uses: pypa/gh-action-pypi-publish@release/v1
35
+ with:
36
+ packages-dir: glitchlings/dist
37
+ repository-url: https://test.pypi.org/legacy/
38
+ password: ${{ secrets.TEST_PYPI_API_TOKEN }}
.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+ .python-version
12
+ uv.lock
LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 osoleve
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
MONSTER_MANUAL.md ADDED
@@ -0,0 +1,272 @@
1
+ # Glitchling Monster Manual
2
+
3
+ This manual contains the detailed stat blocks and descriptions of the various Glitchlings.
4
+
5
+ ---
6
+
7
+ ## Scannequin
8
+
9
+ _How can a computer need reading glasses?_
10
+
11
+ > Small Construct (squinting), Neutral
12
+ >
13
+ > ---
14
+ >
15
+ > _**OCR Artifacts.**_ Scannequin mimics optical character recognition errors by swapping visually similar character sequences (e.g., rn↔m, cl↔d, O↔0, l/I/1).
16
+ >
17
+ > ### Scannequin Args
18
+ >
19
+ > - `error_rate (float)`: The maximum proportion of eligible confusion spans to replace (default: 0.02, 2%).
20
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
21
+ >
22
+ > ```python
23
+ > >>> from glitchlings import scannequin
24
+ > >>> print(scannequin(sample_text))
25
+ > ```
26
+ >
27
+ > > One moming, when Gregor Samsa woke from troub1ed dreams, he found himse1f transf0rmed in his bed into a horribIe vermin. He lay on his armour-1ike back, and if he lifted his head a 1ittle he couId see his brown bel1y, sIightIy domed and divided by arches into stiff sections.
28
+ >
29
+ > ---
30
+ >
31
+ > - **Armor Class** 12 (paper)
32
+ > - **Hit Points** 9 (2d8)
33
+ > - **Speed** 15 ft., 40 ppm
34
+ >
35
+ > ---
36
+ >
37
+ > |STR|DEX|CON|INT|WIS|CHA|
38
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
39
+ > |4 |10 |8 |11 |9 |6 |
40
+ >
41
+ > ---
42
+ >
43
+ > - **Skills** Investigation +2
44
+ > - **Damage Vulnerabilities** coffee, humidity
45
+ > - **Languages** Cornmon
46
+ > - **Challenge** 0 (50 XP)
47
+ >
48
+ > ---
49
+
50
+ ## Typogre
51
+
52
+ _What a nice word, would be a shame if something happened to it._
53
+
54
+ > Tiny Giant (Dyskinetic), Chaotic Neutral
55
+ >
56
+ > ---
57
+ >
58
+ > _**Fatfinger.**_ Typogre introduces character-level errors (duplicating, dropping, adding, or swapping)
59
+ > based on the layout of a (currently QWERTY) keyboard.
60
+ >
61
+ > ### Typogre Args
62
+ >
63
+ > - `max_change_rate (float)`: The maximum number of edits to make as a percentage of the length (default: 0.02, 2%).
64
+ > - `preserve_first_last (bool)`: Avoid editing the first and last character of a word (default: False).
65
+ > - `keyboard (str)`: Keyboard layout key-neighbor map to use (default: "CURATOR_QWERTY").
66
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
67
+ >
68
+ > ```python
69
+ > >>> from glitchlings import typogre
70
+ > >>> typogre(sample_text)
71
+ > ```
72
+ >
73
+ > > One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on hisarmour-like back, and if he lifted his head a little he could see his brown belly, slightly romed and divided by arches int stiff sections. The bedding was hrly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplesly ass he looked.
74
+ >
75
+ > ---
76
+ >
77
+ > - **Armor Class** 7 (mittens)
78
+ > - **Hit Points** 17 (7d4)
79
+ > - **Speed** 60 wpm
80
+ >
81
+ > ---
82
+ >
83
+ > |STR|DEX|CON|INT|WIS|CHA|
84
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
85
+ > |15 |1 |11 |2 |2 |9 |
86
+ >
87
+ > ---
88
+ >
89
+ > - **Skills** Sleight of Hand -3
90
+ > - **Condition Immunities** blinded
91
+ > - **Languages** understands English but can't read
92
+ > - **Challenge** 1 (200 XP)
93
+ >
94
+ > ---
95
+
96
+ ## Mim1c
97
+
98
+ _Wait, was that...?_
99
+
100
+ > Tiny Monstrosity (capgras), chaotic evil
101
+ >
102
+ > ---
103
+ >
104
+ > _**Confusion.**_ Mim1c replaces non-space characters with Unicode Confusables, characters that are distinct but would not usually confuse a human reader.
105
+ >
106
+ > ### Mim1c Args
107
+ >
108
+ > - `replacement_rate (float)`: The maximum proportion of characters to replace (default: 0.02, 2%).
109
+ > - `classes (list[str] | "all")`: Restrict replacements to these Unicode script classes (default: ["LATIN", "GREEK", "CYRILLIC"]).
110
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
111
+ >
112
+ > ```python
113
+ > >>> from glitchlings import mim1c
114
+ > >>> print(mim1c(sample_text))
115
+ > ```
116
+ >
117
+ > > On𝗲 moꭈning‎؍‎ when Gregor S𝛼m𝑠𝚊 woke from troub‎𞸀‎ed dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it t and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
118
+ >
119
+ > ---
120
+ >
121
+ > - **Armor Class** 14 (hide)
122
+ > - **Hit Points** 1 (9d4 - 36)
123
+ > - **Speed** 7O wpm
124
+ >
125
+ > ---
126
+ >
127
+ > |STR|DEX|CON|INT|WIS|CHA|
128
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
129
+ > |3 |15 |3 |13 |3 |7 |
130
+ >
131
+ > ---
132
+ >
133
+ > - **Skills** Deception +3, Stealth +6
134
+ > - **Damage Immunities** memorization
135
+ > - **Senses** truesight 30 ft.
136
+ > - **Languages** Abyssal Unicode
137
+ > - **Challenge** 2 (450 XP)
138
+ >
139
+ > ---
140
+
141
+ ## Jargoyle
142
+
143
+ _Uh oh. The worst person you know just bought a thesaurus._
144
+
145
+ > Medium Monstrosity (academic), Lawful Evil
146
+ >
147
+ > ---
148
+ >
149
+ > _**Sesquipedalianism.**_ Jargoyle, the insufferable `Glitchling`, replaces nouns with synonyms at random, without regard for connotational or denotational differences.
150
+ >
151
+ > ### Jargoyle Args
152
+ >
153
+ > - `replacement_rate (float)`: The maximum proportion of words to replace (default: 0.1, 10%).
154
+ > - `part_of_speech`: The WordNet part of speech to target (default: nouns). Accepts `wn.NOUN`, `wn.VERB`, `wn.ADJ`, or `wn.ADV`.
155
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
156
+ >
157
+ > ```python
158
+ > >>> from glitchlings import jargoyle
159
+ > >>> print(jargoyle(sample_text))
160
+ > ```
161
+ >
162
+ > > One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible varmint. He lay on his armor-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arch into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
163
+ >
164
+ > ---
165
+ >
166
+ > - **Armor Class** 5 (thin skin)
167
+ > - **Hit Points** 52 (8d8 + 16)
168
+ > - **Speed** 30 ft. fly, 0 ft. socially
169
+ >
170
+ > ---
171
+ >
172
+ > |STR|DEX|CON|INT|WIS|CHA|
173
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
174
+ > |13 |5 |16 |19 |4 |17 |
175
+ >
176
+ > ---
177
+ >
178
+ > - **Skills** Deception +6, Persuasion +6
179
+ > - **Damage Immunities** plain language
180
+ > - **Condition Immunities** charmed
181
+ > - **Senses** darkvision 60 ft.
182
+ > - **Languages** understands all, but only speaks in overwrought synonyms
183
+ > - **Challenge** 3 (700 XP)
184
+ >
185
+ > ---
186
+
187
+ ## Reduple
188
+
189
+ _Did you say that or did I?_
190
+
191
+ > Small Fey (echolalic), Chaotic Neutral
192
+ >
193
+ > ---
194
+ >
195
+ > _**Broken Record.**_ Reduple stutters through text by randomly reduplicating words. Like a nervous speaker, it creates natural repetitions that test a model's ability to handle redundancy without losing the thread.
196
+ >
197
+ > ### Reduple Args
198
+ >
199
+ > - `reduplication_rate (float)`: The maximum proportion of words to reduplicate (default: 0.05, 5%).
200
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
201
+ >
202
+ > ```python
203
+ > >>> from glitchlings import reduple
204
+ > >>> print(reduple(sample_text))
205
+ > ```
206
+ >
207
+ > > One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and and seemed ready to to slide off any moment. His many legs, pitifully thin compared with the size of the the rest of him, waved waved about helplessly as he looked looked.
208
+ >
209
+ > ---
210
+ >
211
+ > - **Armor Class** 14
212
+ > - **Hit Points** 13 (3d6 + 3)
213
+ > - **Speed** 40 ft.
214
+ >
215
+ > ---
216
+ >
217
+ > |STR|DEX|CON|INT|WIS|CHA|
218
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
219
+ > |6 |18 |10 |7 |11 |14 |
220
+ >
221
+ > ---
222
+ >
223
+ > - **Skills** Performance +4, Stealth +6
224
+ > - **Condition Immunities** silenced
225
+ > - **Languages** Sylvan, Common (with an endearing stutter)
226
+ > - **Challenge** 1/2 (100 XP)
227
+ >
228
+ > ---
229
+
230
+ ## Rushmore
231
+
232
+ _I accidentally an entire word._
233
+
234
+ > Tiny Aberration (kinetic), Chaotic Neutral
235
+ >
236
+ > ---
237
+ >
238
+ > _**Hasty Omission.**_ The evil (?) twin of `reduple`, Rushmore moves with such frantic speed that it causes words to simply vanish from existence as it passes.
239
+ >
240
+ > ### Rushmore Args
241
+ >
242
+ > - `max_deletion_rate (float)`: The maximum proportion of words to delete (default: 0.01, 1%).
243
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
244
+ >
245
+ > ```python
246
+ > >>> from glitchlings import rushmore
247
+ > >>> print(rushmore(sample_text))
248
+ > ```
249
+ >
250
+ > > One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked.
251
+ >
252
+ > ---
253
+ >
254
+ > - **Armor Class** 16
255
+ > - **Hit Points** 7 (2d4 + 2)
256
+ > - **Speed** 60 ft.
257
+ >
258
+ > ---
259
+ >
260
+ > |STR|DEX|CON|INT|WIS|CHA|
261
+ > |:---:|:---:|:---:|:---:|:---:|:---:|
262
+ > |2 |22 |8 |5 |7 |6 |
263
+ >
264
+ > ---
265
+ >
266
+ > - **Skills** Acrobatics +8, Stealth +8
267
+ > - **Damage Vulnerabilities** effects that cause slowness
268
+ > - **Senses** blindsight 10 ft.
269
+ > - **Languages** --
270
+ > - **Challenge** 1 (200 XP)
271
+ >
272
+ > ---
PKG-INFO ADDED
@@ -0,0 +1,244 @@
1
+ Metadata-Version: 2.4
2
+ Name: glitchlings
3
+ Version: 0.1.0
4
+ Summary: Monsters for your language games.
5
+ Project-URL: Homepage, https://github.com/osoleve/glitchlings
6
+ Project-URL: Repository, https://github.com/osoleve/glitchlings.git
7
+ Project-URL: Issues, https://github.com/osoleve/glitchlings/issues
8
+ Project-URL: Changelog, https://github.com/osoleve/glitchlings/releases
9
+ Author: osoleve
10
+ License: MIT License
11
+
12
+ Copyright (c) 2025 osoleve
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: adversarial,data,evaluation,glitch,nlp,text
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Intended Audience :: Developers
35
+ Classifier: License :: OSI Approved :: MIT License
36
+ Classifier: Operating System :: OS Independent
37
+ Classifier: Programming Language :: Python
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.12
40
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
41
+ Classifier: Topic :: Software Development :: Testing
42
+ Requires-Python: >=3.12
43
+ Requires-Dist: confusable-homoglyphs>=3.3.1
44
+ Requires-Dist: datasets>=4.0.0
45
+ Requires-Dist: jellyfish>=1.2.0
46
+ Requires-Dist: nltk>=3.9.1
47
+ Provides-Extra: dev
48
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
49
+ Provides-Extra: prime
50
+ Requires-Dist: verifiers>=0.1.3.post0; extra == 'prime'
51
+ Description-Content-Type: text/markdown
52
+
53
+ #
54
+
55
+ ```plaintext
56
+ .─') _ .─') _
57
+ ( OO) ) ( OO ) )
58
+ ░██████ ░██ ░██ ░██ ░██ ░██ ░██
59
+ ░██ ░██ ░██ ░██ ░██ ░██
60
+ ░██ ░██ ░██░████████ ░███████ ░████████ ░██ ░██░████████ ░████████ ░███████
61
+ ░██ █████ ░██ ░██ ░██ ░██('─.░██ ░██ ░██ ░██ ░██░██ ░██ ░██.─')░██ ░██
62
+ ░██ ██ ░██ ░██ ░██ ░██( OO ) ╱░██ ░██ ░██ ░██░██ ░██ ░██(OO)░██ ░███████
63
+ ░██ ░███ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██ ░██░██ ░██ ░██ o░███ ░██
64
+ ░█████░█ ░██ ░██ ░████ ░███████ ░██ ░██ ░██ ░██░██ ░██ ░█████░██ ░███████
65
+ ░██
66
+ ░███████
67
+
68
+ Every language game breeds monsters.
69
+ ```
70
+
71
+ `Glitchlings` are **utilities for corrupting the text inputs to your language models in deterministic, _linguistically principled_** ways.
72
+ Each embodies a different way that documents can be compromised in the wild.
73
+
74
+ If reinforcement learning environments are games, then `Glitchling`s are enemies to breathe new life into old challenges.
75
+
76
+ They do this by breaking surface patterns in the input while keeping the target output intact.
77
+
78
+ Some `Glitchling`s are petty nuisances. Some `Glitchling`s are eldritch horrors.
79
+ Together, they create truly nightmarish scenarios for your language models.
80
+
81
+ After all, what good is general intelligence if it can't handle a little chaos?
82
+
83
+ -_The Curator_
84
+
85
+ ## Quickstart
86
+
87
+ ```python
88
+ from glitchlings import summon, SAMPLE_TEXT
89
+
90
+ gaggle = summon(["reduple", "mim1c", "typogre", "rushmore"])
91
+ gaggle(SAMPLE_TEXT)
92
+ ```
93
+
94
+ > Onҽ m‎ھ‎rning, wһen Gregor Samƽa woke from trouble𝐝 𝑑reams, he found himself transformed in his bed into a horrible vermin‎٠‎ He l lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightlh domed and divided by arches ino stiff sections. The bedding was adly able to cover it and and seemed ready to slide off any moment. His many legxs, pitifully thin compared with the size of the the rest of him, waved about helplessly ashe looked looked.
95
+
96
+ ## Motivation
97
+
98
+ If your model performs well on a particular task, but not when `Glitchling`s are present, it's a sign that it hasn't actually generalized to the problem.
99
+
100
+ Conversely, training a model to perform well in the presence of the types of perturbations introduced by `Glitchling`s should help it generalize better.
101
+
102
+ ## Your First Battle
103
+
104
+ Summon your chosen `Glitchling` (_or a few, if ya nasty_) and call it on your text or slot it into `Dataset.map(...)`, supplying a seed if desired.
105
+ Some `Glitchling`s may have additional keyword arguments but they will always be optional with what I decide are "reasonable defaults".
106
+ Seed defaults to 151, obviously.
107
+
108
+ Calling a `Glitchling` on a `str` transparently calls `.corrupt(str, ...) -> str`.
109
+ This means that as long as your glitchlings get along logically, they play nicely with one another.
110
+
111
+ When summoned as a `Gaggle`, the `Glitchling`s will automatically order themselves into attack waves, based on the scope of the change they make:
112
+
113
+ 1. Document
114
+ 2. Paragraph
115
+ 3. Sentence
116
+ 4. Word
117
+ 5. Character
118
+
119
+ They're horrible little gremlins, but they're not _unreasonable_.
120
+
121
+ ## Starter 'lings
122
+
123
+ For maintainability reasons, all `Glitchling` have consented to be given nicknames once they're in your care. See the [Monster Manual](MONSTER_MANUAL.md) for a complete bestiary.
124
+
125
+ ### Typogre
126
+
127
+ _What a nice word, would be a shame if something happened to it._
128
+
129
+ > _**Fatfinger.**_ Typogre introduces character-level errors (duplicating, dropping, adding, or swapping) based on the layout of a (currently QWERTY) keyboard.
130
+ >
131
+ > Args
132
+ >
133
+ > - `max_change_rate (float)`: The maximum number of edits to make as a percentage of the length (default: 0.02, 2%).
134
+ > - `preserve_first_last (bool)`: Avoid editing the first and last character of a word (default: False).
135
+ > - `keyboard (str)`: Keyboard layout key-neighbor map to use (default: "CURATOR_QWERTY").
136
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
137
+
138
+ ### Mim1c
139
+
140
+ _Wait, was that...?_
141
+
142
+ > _**Confusion.**_ Mim1c replaces non-space characters with Unicode Confusables, characters that are distinct but would not usually confuse a human reader.
143
+ >
144
+ > Args
145
+ >
146
+ > - `replacement_rate (float)`: The maximum proportion of characters to replace (default: 0.02, 2%).
147
+ > - `classes (list[str] | "all")`: Restrict replacements to these Unicode script classes (default: ["LATIN", "GREEK", "CYRILLIC"]).
148
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
149
+
150
+ ### Scannequin
151
+
152
+ _How can a computer need reading glasses?_
153
+
154
+ > _**OCR Artifacts.**_ Scannequin mimics optical character recognition errors by swapping visually similar character sequences (like rn↔m, cl↔d, O↔0, l/I/1).
155
+ >
156
+ > Args
157
+ >
158
+ > - `error_rate (float)`: The maximum proportion of eligible confusion spans to replace (default: 0.02, 2%).
159
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
160
+
161
+ ### Jargoyle
162
+
163
+ _Uh oh. The worst person you know just bought a thesaurus._
164
+
165
+ > _**Sesquipedalianism.**_ Jargoyle, the insufferable `Glitchling`, replaces nouns with synonyms at random, without regard for connotational or denotational differences.
166
+ >
167
+ > Args
168
+ >
169
+ > - `replacement_rate (float)`: The maximum proportion of words to replace (default: 0.1, 10%).
170
+ > - `part_of_speech`: The WordNet part of speech to target (default: nouns). Accepts `wn.NOUN`, `wn.VERB`, `wn.ADJ`, or `wn.ADV`.
171
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
172
+
173
+ ### Reduple
174
+
175
+ _Did you say that or did I?_
176
+
177
+ > _**Broken Record.**_ Reduple stutters through text by randomly reduplicating words. Like a nervous speaker, it creates natural repetitions that test a model's ability to handle redundancy without losing the thread.
178
+ >
179
+ > Args
180
+ >
181
+ > - `reduplication_rate (float)`: The maximum proportion of words to reduplicate (default: 0.05, 5%).
182
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
183
+
184
+ ### Rushmore
185
+
186
+ _I accidentally an entire word._
187
+
188
+ > _**Hasty Omission.**_ The evil (?) twin of `reduple`, Rushmore moves with such frantic speed that it causes words to simply vanish from existence as it passes.
189
+ >
190
+ > Args
191
+ >
192
+ > - `max_deletion_rate (float)`: The maximum proportion of words to delete (default: 0.01, 1%).
193
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
194
+
195
+ ### Redactyl
196
+
197
+ _Oops, that was my black highlighter._
198
+
199
+ > _**FOIA Reply.**_ Redactyl obscures random words in your document like an NSA analyst with a bad sense of humor.
200
+ >
201
+ > ### Args
202
+ >
203
+ > - `replacement_char (str)`: The character to use for redaction (default: █).
204
+ > - `redaction_rate (float)`: The maximum proportion of words to redact (default: 0.05, 5%).
205
+ > - `merge_adjacent (bool)`: Whether to redact the space between adjacent redacted words (default: False).
206
+ > - `seed (int)`: The random seed for reproducibility (default: 151).
207
+
208
+ ## Field Report: Uncontained Specimens
209
+
210
+ ### _Containment procedures pending_
211
+
212
+ - `ekkokin` substitutes words with homophones (phonetic equivalents).
213
+ - `nylingual` backtranslates portions of text.
214
+ - `glothopper` introduces code-switching effects, blending languages or dialects.
215
+ - `palimpsest` rewrites, but leaves accidental traces of the past.
216
+ - `vesuvius` is an apocryphal `Glitchling` with ties to _[Nosy, aren't we? -The Curator]_
217
+
218
+ ## Apocrypha
219
+
220
+ Cave paintings and oral tradition contain many depictions of strange, otherworldly `Glitchling`s.
221
+ These _Apocryphal `Glitchling`_ are said to possess unique abilities or behaviors.
222
+ If you encounter one of these elusive beings, please document your findings and share them with _The Curator_.
223
+
224
+ ### Reproducible Corruption
225
+
226
+ Every `Glitchling` owns its own independent `random.Random` instance. That means:
227
+
228
+ - No `random.seed(...)` calls touch Python's global RNG.
229
+ - Supplying a `seed` when you construct a `Glitchling` (or when you `summon(...)`) makes its behavior reproducible.
230
+ - Re-running a `Gaggle` with the same master seed and the same input text (_and same external data!_) yields identical corruption output.
231
+ - Corruption functions are written to accept an `rng` parameter internally so that all randomness is centralized and testable.
232
+
233
+ #### Caveats
234
+
235
+ - If you mutate a glitchling's parameters after you've used it (e.g. `typogre.set_param(...)`) the outputs may not be the same as before the change. So don't do that.
236
+
237
+ #### At Wits' End?
238
+
239
+ If you're trying to add a new glitchling and can't seem to make it deterministic, here are some places to look for determinism-breaking code:
240
+
241
+ 1. Search for any direct calls to `random.choice`, `random.shuffle`, or `set(...)` ordering without going through the provided `rng`.
242
+ 2. Ensure you sort collections before shuffling or sampling.
243
+ 3. Make sure indices are chosen from a stable reference (e.g., original text) when applying length‑changing edits.
244
+ 4. Make sure there are enough sort keys to maintain stability.