Saw this post in https://stackoverflow.com/questions/66144666/words-for-pre-post-or-before-after-that-sort-the-same-logically-and-alph and I thought it was criminal that the question was closed.
I wrote a script to help find candidate pairs that satisfy the (entirely objective, and IMO subjectively righteous) criteria.
def the_important_questions_in_life():
"""
https://www.guru99.com/wordnet-nltk.html
https://english.stackexchange.com/questions/560104/good-words-for-before-and-after-that-sort-the-same-both-logically-and-alpha?newreg=acc68d7cb6aa400abed569edbdb4bfab
https://stackoverflow.com/questions/66144666/words-for-pre-post-or-before-after-that-sort-the-same-logically-and-alph
"""
import nltk
nltk.download('wordnet')
from nltk.corpus import wordnet
before_queries = [
'before', 'pre', 'anterior', 'prior', 'first', 'start', 'past',
'earlier', 'predecessor', 'current', 'former',
]
after_queries = [
'after', 'subsequent', 'later', 'next', 'finish', 'successor',
'posterior', 'future',
]
synonyms = []
antonyms = []
for query in before_queries:
syns = wordnet.synsets(query)
for syn in syns:
lems = syn.lemmas()
for lem in lems:
synonyms.append(lem.name())
if lem.antonyms():
antonyms.append(lem.antonyms()[0].name())
for query in after_queries:
syns = wordnet.synsets(query)
for syn in syns:
lems = syn.lemmas()
for lem in lems:
antonyms.append(lem.name())
if lem.antonyms():
synonyms.append(lem.antonyms()[0].name())
print('synonyms = {!r}'.format(sorted(set(synonyms))))
print('antonyms = {!r}'.format(sorted(set(antonyms))))
I wasn't able to get the synonym finder to work exactly like I wanted, so I didn't finish the script, but assuming you have an API that can find good synonyms and antonyms for words, it should be simple enough to find pairs of them that sort alphabetically.
From this programmatic search, I settled on these manually found sets of pairs:
- earlier later
- head tail
- anterior posterior
- first last
- predecessor successor
- current next
- previous subsequent
- before hereafter
- preceding succeeding