Indeed you are on the right track with copy-pasting the text; the bookmarklet depends on a table "input format", so you have to either make the bookmarklet understand a "list in prose-form input format" (and give it a way to output back to you), or copy-paste the list and use some other tool.
A bookmarklet which will sort a list of words is quite doable, but not very useful in general, so I will just point out the better solution of copy-pasting the text into another programming language:
You will need to:
- import the data into your favorite programming language
- parse the data into a List type
- sort the List
- output the result
You can do this in the browser in the developer console with javascript as follows:
type:
var myList = `very long list of words`.split(' '); //replace ' ' with ', ' perhaps if there are commas
result: ["very", "long", "list", "of", "words"]
Alternatively this might work better in languages without commas:
var myList = `very long list of words`.match(/\S+/g); // match contiguous sequence of non-spaces
Then sort:
myList.sort( (a,b) => a.localeCompare(b, 'mr', {ignorePunctuation: true}));
Then you can either examine the output as-is, print with console.log( myList.join(', ') )
or .join('\n')
, use console.table
(or do something else to let you copy-paste as a table into e.g. a spreadsheet), etc.
You might also consider Python or another programming language. There is no reason to care about efficiency (per the link you wrote) unless you are a developer making this as some sort of tool, in which case you would need to clarify your use case to be more appropriate as a question. Even then, any notion of efficiency in a sorting algorithm is nonsense because they're all O(n log(n)). The entire idea of that Schwartzian transform is when you are sorting a list of large objects according to a key, and the computation of that key takes a long time. A string is not a large datatype. Bringing that up is like saying you need to go buy a jug of milk and thus must pre-perform integral calculations on the terrain topography to optimize the fuel efficiency of the car.