concept OrderedDict in category nlp

appears as: OrderedDict, n OrderedDict
Natural Language Processing in Action: Understanding, analyzing, and generating text with Python

This is an excerpt from Manning's book Natural Language Processing in Action: Understanding, analyzing, and generating text with Python.

>>> from collections import OrderedDict
>>> zero_vector = OrderedDict((token, 0) for token in lexicon)
>>> zero_vector
OrderedDict([(',', 0),
             ('.', 0),
             ('and', 0),
             ('as', 0),
             ('faster', 0),
             ('get', 0),
             ('got', 0),
             ('hairy', 0),
             ('harry', 0),
             ('home', 0),
             ('is', 0),
             ('jill', 0),
             ('not', 0),
             ('store', 0),
             ('than', 0),
             ('the', 0),
             ('to', 0),
             ('would', 0)])
  • dict and OrderedDict