Spaces:
Runtime error
Runtime error
Update replace_explitives.py
Browse files- 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
|
| 39 |
-
pattern = r"\b" + re.escape(
|
| 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 |
|