{{join(distinct(split("apple banana orange apple grape banana orange apple apple melon orange apple grape banana orange pineapple"; space)); space)}}
It assumes no punctuation though. So apple and apple. would be treated separately.
You could strip out all periods first by replacing them with spaces (if you don’t mind losing punctuation), or first split your string into distinct sentences ({{split("string"; ".")}}) and then run them each through the above function. You could then add a period to the end of each output string and reassemble your string.