(
self,
ngram_n=13,
window_to_remove=200,
too_dirty_cutoff=10,
minimum_slice_length=200,
delete_chars=string.punctuation,
)
| 107 | |
| 108 | # FIXME delete_chars: Should anything else go here? Special chars? |
| 109 | def __init__( |
| 110 | self, |
| 111 | ngram_n=13, |
| 112 | window_to_remove=200, |
| 113 | too_dirty_cutoff=10, |
| 114 | minimum_slice_length=200, |
| 115 | delete_chars=string.punctuation, |
| 116 | ): |
| 117 | self.ngram_n = ngram_n |
| 118 | self.window_to_remove = window_to_remove |
| 119 | self.too_dirty_cutoff = too_dirty_cutoff |
| 120 | self.minimum_slice_length = minimum_slice_length |
| 121 | self.delete_chars = delete_chars |
| 122 | |
| 123 | self.dirt_ngrams = set() |
| 124 | |
| 125 | # If in python, we'll translate uppercase to lowercase and delete naughty characters. |
| 126 | # This is fast by python standards |
| 127 | # https://stackoverflow.com/questions/638893/what-is-the-most-efficient-way-in-python-to-convert-a-string-to-all-lowercase-st |
| 128 | self.translation_table = str.maketrans( |
| 129 | string.ascii_lowercase + string.ascii_uppercase, # These characters |
| 130 | string.ascii_lowercase * 2, # Become these characters |
| 131 | self.delete_chars, # These are deleted |
| 132 | ) |
| 133 | |
| 134 | ############## |
| 135 | # I/O for saving contamination ngrams |
nothing calls this directly
no outgoing calls
no test coverage detected