ShynBui commited on
Commit
53c34d4
·
1 Parent(s): e941c48

fix random.sample error

Browse files
Files changed (1) hide show
  1. utils.py +1 -2
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)