Spaces:
Build error
Build error
fix random.sample error
Browse files
utils.py
CHANGED
|
@@ -114,7 +114,7 @@ def character_replacement(text, num_errors=1):
|
|
| 114 |
|
| 115 |
text = list(text)
|
| 116 |
|
| 117 |
-
indices = random.sample(range(len(text)), num_errors)
|
| 118 |
|
| 119 |
|
| 120 |
for index in indices:
|
|
@@ -172,4 +172,3 @@ def character_insertion(text, num_errors=1):
|
|
| 172 |
|
| 173 |
# Ghép các ký tự lại thành chuỗi văn bản
|
| 174 |
return ''.join(text)
|
| 175 |
-
|
|
|
|
| 114 |
|
| 115 |
text = list(text)
|
| 116 |
|
| 117 |
+
indices = random.sample(range(len(text) - 1), num_errors)
|
| 118 |
|
| 119 |
|
| 120 |
for index in indices:
|
|
|
|
| 172 |
|
| 173 |
# Ghép các ký tự lại thành chuỗi văn bản
|
| 174 |
return ''.join(text)
|
|
|