I'm trying to find all duplicated words in text, each duplicate contained in a tulpes and save all tuples in a list. it needs to colclude cases with punctuation between the words like "so, so"
I tried to use the pattern:
/(\b\S+\b)\s+\b\1\b/
but it doesnt return what im looking for, and got trouble with saving the results in the form i need
example of what im looking for:
the text = "i went to to a party, party at my uncle's house"
Output at the end of the function:
[(to ,to), (party, party)]