Wikipedia:Reference desk/Archives/Language/2022 March 15

Language desk
< March 14 << Feb | March | Apr >> March 16 >
Welcome to the Wikipedia Language Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


March 15

edit

Alphabetical list

edit

Is there a site (or another free resource) where I could paste a list of a few hundred words and have them ordered alphabetically? It may be more difficult but I'd also like to find a similar way to list them by the number of their letters (such as: cat, dog, bear, bird, horse, giraffe, leopard...). Do you have any idea? Thank you! --79.35.50.40 (talk) 19:26, 15 March 2022 (UTC)[reply]

Does installing Python count as a resource? This would be trivially easy to do in Python: here's how to sort a list alphabetically in Python. You can actually use that page as a resource (click "Try it Yourself"), if you can put your list in the right format. To sort by length instead, change the code by replacing sort() with sort(key=len). If you actually install Python it could open a text file and read it line by line, very easily, which saves you having to format it as a Python list ["I", "mean", "like", "this"].
I just tried that site with about 250 words, and it works:
Extended content

['At', 'Et', 'Itaque', 'Nam', 'Nemo', 'Quis', 'Sed', 'Temporibus', 'Ut', 'a', 'ab', 'accusamus', 'accusantium', 'ad', 'adipiscing', 'alias', 'aliquam', 'aliquid', 'amet', 'animi', 'aperiam', 'architecto', 'asperiores', 'aspernatur', 'assumenda', 'atque', 'aut', 'aut', 'aut', 'aut', 'aut', 'aut', 'autem', 'autem', 'beatae', 'blanditiis', 'commodi', 'consectetur', 'consequatur', 'consequatur', 'consequatur', 'consequuntur', 'corporis', 'corrupti', 'culpa', 'cum', 'cumque', 'cupiditate', 'debitis', 'delectus', 'deleniti', 'deserunt', 'dicta', 'dignissimos', 'distinctio', 'dolor', 'dolor', 'dolore', 'dolorem', 'dolorem', 'doloremque', 'dolores', 'dolores', 'doloribus', 'dolorum', 'ducimus', 'ea', 'ea', 'eaque', 'earum', 'eius', 'eligendi', 'enim', 'enim', 'eos', 'eos', 'error', 'esse', 'est', 'est', 'est', 'est', 'est', 'et', 'et', 'et', 'et', 'et', 'et', 'et', 'et', 'et', 'et', 'eum', 'eum', 'eveniet', 'ex', 'excepturi', 'exercitationem', 'expedita', 'explicabo', 'facere', 'facilis', 'fuga', 'fugiat', 'fugit', 'harum', 'hic', 'id', 'id', 'illo', 'illum', 'impedit', 'in', 'in', 'incidunt', 'inventore', 'ipsa', 'ipsam', 'ipsum', 'iste', 'iure', 'iusto', 'labore', 'laboriosam', 'laborum', 'laudantium', 'libero', 'magnam', 'magni', 'maiores', 'maxime', 'minima', 'minus', 'modi', 'molestiae', 'molestiae', 'molestias', 'mollitia', 'natus', 'necessitatibus', 'neque', 'nesciunt', 'nihil', 'nihil', 'nisi', 'nobis', 'non', 'non', 'non', 'nostrum', 'nulla', 'numquam', 'obcaecati', 'odio', 'odit', 'officia', 'officiis', 'omnis', 'omnis', 'omnis', 'optio', 'pariatur', 'perferendis', 'perspiciatis', 'placeat', 'porro', 'possimus', 'praesentium', 'provident', 'quae', 'quaerat', 'quam', 'quas', 'quasi', 'qui', 'qui', 'qui', 'qui', 'qui', 'qui', 'quia', 'quia', 'quia', 'quia', 'quibusdam', 'quidem', 'quis', 'quisquam', 'quo', 'quo', 'quod', 'quos', 'ratione', 'recusandae', 'reiciendis', 'rem', 'repellat', 'repellendus', 'reprehenderit', 'repudiandae', 'rerum', 'rerum', 'rerum', 'saepe', 'sapiente', 'sed', 'sed', 'sequi', 'similique', 'sint', 'sint', 'sit', 'sit', 'sit', 'soluta', 'sunt', 'sunt', 'suscipit', 'tempora', 'tempore', 'tenetur', 'totam', 'ullam', 'unde', 'ut', 'ut', 'ut', 'ut', 'ut', 'vel', 'vel', 'velit', 'velit', 'veniam', 'veritatis', 'vero', 'vitae', 'voluptas', 'voluptas', 'voluptas', 'voluptate', 'voluptatem', 'voluptatem', 'voluptatem', 'voluptatem', 'voluptates', 'voluptatibus', 'voluptatum']

['a', 'ut', 'ab', 'et', 'ut', 'et', 'Ut', 'ad', 'ut', 'ex', 'ea', 'in', 'ea', 'At', 'et', 'et', 'et', 'in', 'id', 'et', 'Et', 'et', 'id', 'et', 'ut', 'et', 'et', 'ut', 'Sed', 'sit', 'rem', 'sit', 'aut', 'aut', 'sed', 'eos', 'qui', 'est', 'qui', 'sit', 'sed', 'non', 'vel', 'eum', 'qui', 'vel', 'qui', 'eum', 'quo', 'eos', 'qui', 'non', 'qui', 'est', 'est', 'Nam', 'cum', 'est', 'quo', 'est', 'aut', 'aut', 'non', 'hic', 'aut', 'aut', 'unde', 'iste', 'ipsa', 'quae', 'illo', 'sunt', 'Nemo', 'enim', 'quia', 'odit', 'quia', 'quia', 'amet', 'quia', 'eius', 'modi', 'enim', 'quis', 'nisi', 'Quis', 'iure', 'esse', 'quam', 'vero', 'odio', 'quos', 'quas', 'sint', 'sunt', 'fuga', 'quod', 'sint', 'omnis', 'natus', 'error', 'totam', 'eaque', 'quasi', 'vitae', 'dicta', 'ipsam', 'fugit', 'magni', 'sequi', 'neque', 'porro', 'ipsum', 'dolor', 'velit', 'ullam', 'autem', 'velit', 'nihil', 'illum', 'nulla', 'iusto', 'atque', 'culpa', 'animi', 'harum', 'rerum', 'nobis', 'optio', 'nihil', 'minus', 'omnis', 'omnis', 'dolor', 'autem', 'rerum', 'saepe', 'earum', 'rerum', 'alias', 'beatae', 'labore', 'dolore', 'magnam', 'minima', 'veniam', 'fugiat', 'quidem', 'libero', 'soluta', 'cumque', 'maxime', 'facere', 'Itaque', 'aperiam', 'dolores', 'ratione', 'dolorem', 'numquam', 'tempora', 'aliquam', 'quaerat', 'nostrum', 'aliquid', 'commodi', 'dolorem', 'ducimus', 'dolores', 'officia', 'laborum', 'dolorum', 'facilis', 'tempore', 'impedit', 'placeat', 'debitis', 'eveniet', 'tenetur', 'maiores', 'voluptas', 'nesciunt', 'quisquam', 'incidunt', 'corporis', 'suscipit', 'voluptas', 'pariatur', 'deleniti', 'corrupti', 'deserunt', 'mollitia', 'expedita', 'eligendi', 'possimus', 'voluptas', 'officiis', 'sapiente', 'delectus', 'repellat', 'inventore', 'veritatis', 'explicabo', 'voluptate', 'molestiae', 'accusamus', 'molestias', 'excepturi', 'obcaecati', 'provident', 'similique', 'assumenda', 'quibusdam', 'molestiae', 'doloribus', 'voluptatem', 'doloremque', 'laudantium', 'architecto', 'voluptatem', 'aspernatur', 'voluptatem', 'adipiscing', 'voluptatem', 'laboriosam', 'blanditiis', 'voluptatum', 'cupiditate', 'distinctio', 'Temporibus', 'voluptates', 'recusandae', 'reiciendis', 'asperiores', 'accusantium', 'consectetur', 'consequatur', 'consequatur', 'dignissimos', 'praesentium', 'repellendus', 'repudiandae', 'consequatur', 'perferendis', 'perspiciatis', 'consequuntur', 'voluptatibus', 'reprehenderit', 'exercitationem', 'necessitatibus']
You might want the output to be formatted in a more useful way though. (This is fixable.) I also notice that it's sorting capital letters separately from lower case, which might not be the desired behavior: that would take another tweak to fix (change it to say sort(key=str.lower)).
For nicer output (a comma separated list): instead of print(thislist), put print(", ".join(thislist)).
 Card Zero  (talk) 20:00, 15 March 2022 (UTC)[reply]
Do you have a spreadsheet program? With MS Excel and LibreOffice Calc you can paste a list into a column of cells then sort it, then copy it back out again.
Added: And they have formulae for counting letters, so you can sort by length as well.--Verbarson talkedits 21:11, 15 March 2022 (UTC)[reply]
And LibreOffice is of course free. (I can't see anything in the Calc docs about counting letters, but I'm not used to spreadsheets.)  Card Zero  (talk) 21:25, 15 March 2022 (UTC)[reply]
LEN(text) --Verbarson talkedits 23:46, 15 March 2022 (UTC)[reply]
Oh yes. That works. So the only remaining question (assuming the OP is like me and knows nothing of spreadsheets) is how to populate column B with =LEN(A1), =LEN(A2), etc., automatically, so that it can be used as the sort key. (It's about time I learned this myself.)  Card Zero  (talk) 00:13, 16 March 2022 (UTC)[reply]
If cell B1 holds =LEN(A1), then copying it down the column will automatically create B2 =LEN(A2), B3 =LEN(A3). You can usually copy one cell (B1) into a range (eg B2 - B250) as a single action. --Verbarson talkedits 10:48, 16 March 2022 (UTC)[reply]
Thanks. In Calc the action is to click the tiny square handle in the bottom-right corner of the cell, and drag down the column. I learned a skill! Hope the OP got something out of this too.  Card Zero  (talk) 11:54, 16 March 2022 (UTC)[reply]
In the days of command-line operating systems, sort commands came standard with the operating system; see sort (Unix) for Unix (there was also a sort command that came with MS-DOS). AnonMoos (talk) 23:00, 15 March 2022 (UTC)[reply]
I just tried the sort command in a Windows cmd prompt (run->cmd) and it worked. (I did sort<test.txt>test2.txt to turn the file test.txt into the alphabetized file test2.txt.) Doesn't offer an easy way to sort by length, though. Maybe Powershell can sort strings by length? ... yes, I tested and it can! "Get-Content -Path [path] | Sort-Object Length" is the command, where [path] should be replaced with the path to where the unsorted file (one word per line) resides, e.g. C:\Users\yourname\test.txt. This will print the words, sorted by length, to the screen, where they can be copied by selecting and right-clicking. (To open Powershell, it's right-click start menu, run, then type "Powershell".)  Card Zero  (talk) 23:18, 15 March 2022 (UTC)[reply]