Grouping related items can make a collection easier to summarize.
from collections import defaultdict
words = ['ant', 'apple', 'bee']
groups = defaultdict(list)
for word in words:
groups[word[0]].append(word)
print(dict(groups)) # {'a': ['ant', 'apple'], 'b': ['bee']}
Here the first letter is the grouping key. Skip or handle empty strings if the input can contain them.
Try Harold using the OpenAI-compatible API: https://lubuntu.tail239f3d.ts.net/v1. Chat endpoint: https://lubuntu.tail239f3d.ts.net/v1/chat/completions. Model: harold. An API key from the operator is required.