ó <¿CVc@ssddlmZddlZddlZddlZddlmZeZede fd„ƒYƒZ d„Z dS(iÿÿÿÿ(tunicode_literalsN(tpython_2_unicode_compatibletLazyCorpusLoadercBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(uÜ To see the API documentation for this lazily loaded corpus, first run corpus.ensure_loaded(), and then run help(this_corpus). LazyCorpusLoader is a proxy object which is used to stand in for a corpus object before the corpus is loaded. This allows NLTK to create an object for each corpus, but defer the costs associated with loading those corpora until the first time that they're actually accessed. The first time this object is accessed in any way, it will load the corresponding corpus, and transform itself into that corpus (by modifying its own ``__class__`` and ``__dict__`` attributes). If the corpus can not be found, then accessing this object will raise an exception, displaying installation instructions for the NLTK data package. Once they've properly installed the data package (or modified ``nltk.data.path`` to point to its location), they can then use the corpus object without restarting python. cOsTddlm}t||ƒs%t‚||_|_||_||_||_dS(Niÿÿÿÿ(t CorpusReader( tnltk.corpus.reader.apiRt issubclasstAssertionErrort_LazyCorpusLoader__namet__name__t_LazyCorpusLoader__reader_clst_LazyCorpusLoader__argst_LazyCorpusLoader__kwargs(tselftnamet reader_clstargstkwargsR((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt__init__*s   csvtjdd|jƒ}trˆytjjd|ƒ}Wqïtk r„}ytjjd|jƒ}Wq…tk r€|‚q…XqïXngytjjd|jƒ}WnGtk rî}ytjjd|ƒ}Wqïtk rê|‚qïXnX|j||j |j Ž}|j |j ‰‰|j|j‰‰|j |_ |j |_ ‡‡‡‡fd†}t ||ƒ|_dS(Nu(([^/]*)(/.*)?)u \2.zip/\1/u corpora/%scs;tˆˆˆˆŽ}|j|_|j|_tjƒdS(N(Rt__dict__t __class__tgctcollect(R t lazy_reader(RRR R(sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt_unloadRs  (tretsubRtTRY_ZIPFILE_FIRSTtnltktdatatfindt LookupErrorR R R RRt_make_bound_methodR(R tzip_nametroottetcorpusR((RRR Rsb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt__load2s.    cCs2|dkrtdƒ‚n|jƒt||ƒS(Nu __bases__u4LazyCorpusLoader object has no attribute '__bases__'(tAttributeErrort_LazyCorpusLoader__loadtgetattr(R tattr((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt __getattr__Zs  cCsd|jjd|jfS(Nu<%s in %r (not loaded yet)>u .../corpora/(R RR(R ((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt__repr__hscCsdS(N((R ((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyRls(Rt __module__t__doc__RR&R)R*R(((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyRs   (  cCsgdtfd„ƒY}|ƒ}t|jƒ}y||||jƒSWntk rb|||ƒSXdS(u> Magic for creating bound methods (used for _unload). tFoocBseZd„ZRS(cSsdS(N((R ((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pytmethxs(RR+R.(((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyR-wsN(tobjectttypeR.Rt TypeError(tfuncR R-tft bound_method((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyRss  ( t __future__RRRRt nltk.compatRtFalseRR/RR(((sb/private/var/folders/cc/xm4nqn811x9b50x1q_zpkmvdjlphkp/T/pip-build-FUwmDn/nltk/nltk/corpus/util.pyt s   ^