How can I replace words that have written 'or something' in the parenthesis?
Example:
string = "acısı içine (or yüreğine) çökmek (or işlemek)"
Expected Output:
'acısı içine çökmek' , 'acısı yüreğine çökmek' , 'acısı içine işlemek' , 'acısı yüreğine çökmek'
I am trying to write something like below but it does not work if more than one parenthesis exist.
import re
word='abat etmek (or eylemek)'
item1=re.sub("\([^)]+\)","",word)
parenthesis=re.search('\(([^)]+)', word).group(1)
par=parenthesis.split('or')
item2=item1.replace(item1.split()[-1],par[1])