mskov commited on
Commit
2904831
1 Parent(s): 9aec1b9

Update replace_explitives.py

Browse files
Files changed (1) hide show
  1. replace_explitives.py +2 -2
replace_explitives.py CHANGED
@@ -35,8 +35,8 @@ def sub_explitives(textfile, selection):
35
  print("target word was found, ", target_word)
36
  print(textfile)
37
  for i, line in enumerate(lines):
38
- for target_word in target_words:
39
- pattern = r"\b" + re.escape(target_word) + r"\b"
40
  # textfile = re.sub(target_word, replacetext, textfile, flags=re.IGNORECASE)
41
  lines[i] = re.sub(pattern, replacetext, lines[i], flags=re.IGNORECASE)
42
 
 
35
  print("target word was found, ", target_word)
36
  print(textfile)
37
  for i, line in enumerate(lines):
38
+ for word in target_word:
39
+ pattern = r"\b" + re.escape(word) + r"\b"
40
  # textfile = re.sub(target_word, replacetext, textfile, flags=re.IGNORECASE)
41
  lines[i] = re.sub(pattern, replacetext, lines[i], flags=re.IGNORECASE)
42