I have a list with many words (100.000+), and what I\'d like to do is remove all the substrings of every word in the list.
So for simplicity, let\'s imagine that I have
Note that using for
is slow in python in general, (you may use numpy arrays or NLP package), aside from that, how about this:
words = list(set(words))#elimnate dublicates
str_words = str(words)
r=[]
for x in words:
if str_words.find(x)!=str_words.rfind(x):continue
else:r.append(x)
print(r)
as I am answering here, I don't see a reason why c++ wouldn't be an option