Check this out (This only works if the language in question can be broken on spaces, but that hasn't been clarified – Thanks to Oso) :
import numpy as np
your_stop_words = ['something','sth_else','and ...']
new_string = input()
words = np.array(new_string.split())
is_stop_word = np.isin(words,your_stop_words)
filtered_words = words[~is_stop_word]
clean_text = ' '.join(filtered_words)
If the language in question can not be broken to spaces, you can use this solution :
your_stop_words = ['something','sth_else','and ...']
new_string = input()
clean_text = new_string
for stop_word in your_stop_words :
clean_text = clean_text.replace(stop_word,"")
In this case, you need to ensure that a stop word can not be a part of another word. you can do it based on your language. for example you can use spaces around your stop words.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…