typos
            LeetSpeakGenerator
    
              Bases: TyposGenerator
Source code in badgers/generators/text/typos.py
                | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |  | 
            __init__(random_generator=default_rng(seed=0))
    Initialize the LeetSpeakGenerator with a given random number generator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| random_generator | numpy.random.Generator, default=default_rng(seed=0) | A random number generator used to introduce randomness in leetspeak transformation. | default_rng(seed=0) | 
Source code in badgers/generators/text/typos.py
              | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |  | 
            generate(X, y, replacement_proba=0.1)
    Apply leet speak transformation to a list of words.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | A list of words where leet speak transformation is applied. | required | |
| y | The labels associated with the words, which remain unchanged. | required | |
| replacement_proba | float | The probability of replacing a letter with its leet counterpart. This probability applies to each letter in each word independently. | 0.1 | 
Returns:
| Type | Description | 
|---|---|
| Tuple | A tuple containing the transformed list of words and the original labels  | 
Source code in badgers/generators/text/typos.py
              | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |  | 
            randomly_replace_letter(letter, replacement_proba)
    Randomly replace a letter with its leet counterpart based on the provided probability.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| letter | str | The letter to potentially replace. | required | 
| replacement_proba | float | The probability of replacing the letter with its leet counterpart. | required | 
Returns:
| Type | Description | 
|---|---|
| str | The replaced letter if a random draw is less than or equal to the replacement_proba, otherwise the original letter. | 
Source code in badgers/generators/text/typos.py
              | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |  | 
            SwapCaseGenerator
    
              Bases: TyposGenerator
Source code in badgers/generators/text/typos.py
                | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |  | 
            __init__(random_generator=default_rng(seed=0))
    Initialize the SwapCaseGenerator with a given random number generator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| random_generator | numpy.random.Generator, default=default_rng(seed=0) | A random number generator used to introduce randomness in case swapping. | default_rng(seed=0) | 
Source code in badgers/generators/text/typos.py
              | 154 155 156 157 158 159 160 161 |  | 
            generate(X, y, swapcase_proba=0.1)
    Apply random case swapping to each letter in a list of words.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | A list of words where random case swapping is applied. | required | |
| y | The labels associated with the words, which remain unchanged. | required | |
| swapcase_proba | float | The probability of swapping the case of each letter. This probability applies to each letter in each word independently. | 0.1 | 
Returns:
| Type | Description | 
|---|---|
| Tuple | A tuple containing the transformed list of words and the original labels  | 
Source code in badgers/generators/text/typos.py
              | 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |  | 
            randomly_swapcase_letter(letter, swapcase_proba)
    Randomly swap the case of a letter based on the provided probability.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| letter | str | The letter whose case may be swapped. | required | 
| swapcase_proba | float | The probability of swapping the case of the letter. | required | 
Returns:
| Type | Description | 
|---|---|
| str | The letter with swapped case if a random draw is less than or equal to the swapcase_proba, otherwise the original letter. | 
Source code in badgers/generators/text/typos.py
              | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |  | 
            SwapLettersGenerator
    
              Bases: TyposGenerator
Swap adjacent letters in words randomly except for the first and the last letters. Example: 'kilogram' --> 'kilogarm'
Source code in badgers/generators/text/typos.py
                | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |  | 
            __init__(random_generator=default_rng(seed=0))
    Initialize the SwapLettersGenerator with a given random number generator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| random_generator | numpy.random.Generator, default=default_rng(seed=0) | A random number generator used to introduce randomness in letter swapping. | default_rng(seed=0) | 
Source code in badgers/generators/text/typos.py
              | 34 35 36 37 38 39 40 41 |  | 
            generate(X, y, swap_proba=0.1)
    For each word with a length greater than 3, apply a single swap with probability swap_proba.
The position of the swap is chosen randomly among possible adjacent pairs of letters,
excluding the first and last letters of the word.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| X | A list of words where typos are introduced. | required | |
| y | Not used in this method. | required | |
| swap_proba | float | Probability that a word with more than 3 characters will have one adjacent pair of letters swapped. This probability applies to each eligible word independently. | 0.1 | 
Returns:
| Type | Description | 
|---|---|
| Tuple | A tuple containing the transformed list of words and the original labels  | 
Source code in badgers/generators/text/typos.py
              | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |  | 
            TyposGenerator
    
              Bases: GeneratorMixin
Base class for transformers creating typos in a list of words
Source code in badgers/generators/text/typos.py
                | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |  | 
            __init__(random_generator=default_rng(seed=0))
    Initialize the TyposGenerator with a given random number generator.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
| random_generator | numpy.random.Generator, default=default_rng(seed=0) | A random number generator used to introduce randomness in typo generation. | default_rng(seed=0) | 
Source code in badgers/generators/text/typos.py
              | 14 15 16 17 18 19 20 21 |  |