I some code that identifies ngrams of interest in a small bit of text, then searches for the ngram in a larger bit of text to provide a snippet of the term used in context. One ngram might be unordered numerical set
. Right now, if I can't find unordered numerical set
, I start trimming the string from the left to see if numerical set
is available in the larger text.
What I would like to do before I trim from the left, is to see if the any of the words have an antonym, like ordered
for unordered
. This is because my ngram might be defined in one way, but used in the opposite.
Is there a known list or other way of finding out if there is a highly correlated antonym I might try for a set of words?
For instance, I think I could write some regexps that look for prefixes, like "un" or "dis" and see if the word that results from removing these prefixes is a valid english word. This seems likely to be already solved, so before I try to create anything, I want to find out what might already exist.
I am currently using Python using Gensim, NLTK, and Word2Vec for the rest of my processing if it matters.