i have two list and i want to delete the matching one and keep the different. here is the code:
def check_synonym(text):
tokens=regexp_tokenize(text, r'[،؟!.؛\s+]\s*', gaps=True)
based_text= ' '.join(cursor.execute('SELECT request FROM Male_Conversation_Engine WHERE request REGEXP?',[tokens[0]]).fetchone())
based_tokens=regexp_tokenize(str(based_text), r'[،؟!.؛\s+]\s*', gaps=True)
for w1 in based_tokens:
for w2 in tokens:
if w1 == w2:
based_tokens.remove(w1),tokens.remove(w2)
return list
if the two list are "in Arabic":
tokens = ['هذا','الجهاز','الجميل']
based_tokens = ['هذا','الجهاز','جيد']
the Output should be:
tokens = ['الجميل']
based_tokens = ['جيد']
the actual Output:
tokens = ['الجهاز','جميل']
based_tokens = ['الجهاز','جيد']
the side only delete the first element 'هذا' and return the rest of the list.
(using python3)