nltk wordnet corpus provides a programming interface for the "large lexical database of English words." You can navigate the word schedule based on various relationships. It meets the requirements for displaying “definitions, parts of speech, synonyms, antonyms, quotation marks” and “from a dictionary that is perfectly downloadable”.
- , , ( Python).
Wordnet:
import textwrap
from nltk.corpus import wordnet as wn
POS = {
'v': 'verb', 'a': 'adjective', 's': 'satellite adjective',
'n': 'noun', 'r': 'adverb'}
def info(word, pos=None):
for i, syn in enumerate(wn.synsets(word, pos)):
syns = [n.replace('_', ' ') for n in syn.lemma_names]
ants = [a for m in syn.lemmas for a in m.antonyms()]
ind = ' '*12
defn= textwrap.wrap(syn.definition, 64)
print 'sense %d (%s)' % (i + 1, POS[syn.pos])
print 'definition: ' + ('\n' + ind).join(defn)
print ' synonyms:', ', '.join(syns)
if ants:
print ' antonyms:', ', '.join(a.name for a in ants)
if syn.examples:
print ' examples: ' + ('\n' + ind).join(syn.examples)
print
info('near')
:
sense 1 (verb)
definition: move towards
synonyms: approach, near, come on, go up, draw near, draw close, come near
examples: We were approaching our destination
They are drawing near
The enemy army came nearer and nearer
sense 2 (adjective)
definition: not far distant in time or space or degree or circumstances
synonyms: near, close, nigh
antonyms: far
examples: near neighbors
in the near future
they are near equals
...