Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjacentKey ¶
AdjacentKey returns a random QWERTY neighbor of the given character. If the character has no known neighbors (non-letter), it returns the character itself unchanged.
func IsSentenceEnd ¶
IsSentenceEnd returns true if the chunk ends with sentence-ending punctuation (before any trailing whitespace).
func SplitWordChunks ¶
SplitWordChunks splits text into word-sized chunks, keeping trailing whitespace and punctuation attached to the preceding word. For example, "Hello world. How are you?" becomes:
["Hello ", "world. ", "How ", "are ", "you?"]
Types ¶
type Typo ¶
type Typo struct {
Pos int // Character index in the rune slice
Kind TypoKind // What kind of typo
}
Typo describes a single typo at a position in the text.
func GenerateTypoPositions ¶
GenerateTypoPositions computes typo positions using uniform gap sampling (each gap is uniform on [halfGap, halfGap+avgGap)). O(typos) random calls, not O(chars). Returns a sorted slice of Typo structs.