Have a list with lot of word in the list

Please
I have a list with lot of word in the list
Please i need a shortcut that
Like in exeal
Wil delete the duplicating word

This question has been asked on the Shortcuts Subreddit several times, hereā€™s one of the recent posts:

Iā€™m going to offer up something a little different. :nerd_face:

The algorithms we have reasonably available in Shortcuts are somewhat less optimised than on other solution platforms. This is one instance where it can make a big difference if we just think outside the box a little bit.

This example shortcut has two options for generating the unique entries.

One is using a comparative loop, like the solutions generally proposed on Reddit. It takes each value in turn from the original list, and an initially empty list. Whenever an entry in the original list is not found to be in the new list, it adds it. By the time you get to the end of the original list, you have a new list with all of the unique values in it.

The other option passes over to webkit (the ā€˜engineā€™ behind the Safari web browser) to use its JavaScript processing to do the sorting. Now, webkit has had a lot of optimisation for JavaScript operations, so we can maybe tap into a bit of a speed boost.

The result is that as the size of the original data set (list of text items) increases, the greater the difference in performance.

At the bottom end of the scale thereā€™s for all practical purposes no difference in performance. Both algorithms will return the results in almost a blink of an eye ā€¦ but I will caveat this with noting Iā€™m running this on an old iPad Pro; less powerful hardware might reveal more difference (favouring either algorithm) at this lower end.

At what Iā€™ll broadly term ā€œthe upper endsā€, well, it would be very hard not to notice the difference in speed.

Download and run the shortcut above. Iā€™d recommend running it from the Shortcuts Library page to give the looping inside of Shortcuts approach a chance on the larger data sets; otherwise it gets very slow thanks to the user interface updating/scrolling.

3 Likes

This was neat. I really like the use of Set here and passing it to Get contents of webpage. I wouldnā€™t have thought to do that. Nice work, man.