B
BerlinBrown
if I have an array of "stop" words, and I want to replace those values
with something else; in a string, how would I go about doing this. I
have this code that splits the string and then does a difference but I
think there is an easier approach:
E.g.
mystr =
kljsldkfjksjdfjsdjflkdjslkf[BAD]Kkjkkkkjkkjk[BAD]LSKJFKSFJKSJF;L[BAD2]kjsldfsd;
if I have an array stop_list = [ "[BAD]", "[BAD2]" ]
I want to replace the values in that list with a zero length string.
I had this before, but I don't want to use this approach; I don't want
to use the split.
line_list = line.lower().split()
res = list(set(keywords_list).difference(set(ENTITY_IGNORE_LIST)))
with something else; in a string, how would I go about doing this. I
have this code that splits the string and then does a difference but I
think there is an easier approach:
E.g.
mystr =
kljsldkfjksjdfjsdjflkdjslkf[BAD]Kkjkkkkjkkjk[BAD]LSKJFKSFJKSJF;L[BAD2]kjsldfsd;
if I have an array stop_list = [ "[BAD]", "[BAD2]" ]
I want to replace the values in that list with a zero length string.
I had this before, but I don't want to use this approach; I don't want
to use the split.
line_list = line.lower().split()
res = list(set(keywords_list).difference(set(ENTITY_IGNORE_LIST)))