Skip to content

Commit

Permalink
Use a normal dictionary for caching nltk.data.load() rather than a we…
Browse files Browse the repository at this point in the history
…akref dictionary

svn/trunk@7825
  • Loading branch information
Edward Loper committed Feb 28, 2009
1 parent 182d621 commit 1fcfaca
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions nltk/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,10 @@ def __repr__(self):
# Access Functions
######################################################################

_resource_cache = weakref.WeakValueDictionary()
"""A weakref dictionary used to cache resources so that they won't
# Don't use a weak dictionary, because in the common case this
# causes a lot more reloading that necessary.
_resource_cache = {}
"""A dictionary used to cache resources so that they won't
need to be loaded more than once."""

def find(resource_name):
Expand Down

0 comments on commit 1fcfaca

Please sign in to comment.