Files
old-nlp/venv/lib/python3.7/site-packages/nltk/__pycache__/compat.cpython-37.pyc

117 lines
9.9 KiB
Plaintext
Raw Normal View History

2019-10-20 13:16:49 +02:00
B
D(<28>]<5D>-<00> @s*ddlmZmZddlZddlZddlmZmZddlZddl Z ddl
m Z m Z ej ddkZer<>dd<07>ZddlZejZejZddlmZejZdd lmZn<>d
d<07>Zydd lmZWn ek
r<EFBFBD>dd lmZYnXeZdd lmZmZed<00>Zed d<0E>ZGdd<10>de<1B>Ze<16>ZddlZddl Z ddlZGdd<12>d<12>Z!ddl"Z#ddlZ$ddlm%Z%Gdd<15>de&<26>ZddddgZ'dd<1B>e'D<00>Z(dd<1D>Z)dd<1F>Z*d d!<21>Z+ydd"l,m,Z-WnBek
<EFBFBD>r<>ydd"l.m,Z-Wnek
<EFBFBD>r<>e+Z-YnXYnXd#d$<24>Z/d%d&<26>Z0d'd(<28>Z1d)d*<2A>Z2d+d,<2C>Z3Gd-d.<2E>d.ej4<6A>Z4dS)/<2F>)<02>absolute_import<72>print_functionN)<02>update_wrapper<65>wraps)<02> string_types<65> text_type<70>cCs|jjS)N)<02>__self__<5F> __class__)<01>meth<74>r <00>-/tmp/pip-install-4m6m_5d_/nltk/nltk/compat.py<70> get_im_classsr)<01>timezone)<01>TemporaryDirectorycCs|jS)N)Zim_class)r r r r r(s)<01>StringIO)<02>tzinfo<66> timedelta<74>)<01>hoursc@s(eZdZdZdd<02>Zdd<04>Zdd<06>ZdS)<08>UTCcCstS)N)<01>ZERO)<02>self<6C>dtr r r <00> utcoffset:sz UTC.utcoffsetcCsdS)Nrr )rrr r r <00>tzname=sz
UTC.tznamecCstS)N)r)rrr r r <00>dst@szUTC.dstN)<07>__name__<5F>
__module__<EFBFBD> __qualname__<5F>__doc__rrrr r r r r7src@s2eZdZdZejddfdd<05>Zdd<07>Zdd <09>Zd
S) <0B> UnicodeWriterz<72>
A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding.
see https://docs.python.org/2/library/csv.html
zutf-8<>replacecKsDt<00><01>|_tj|jfd|i|<05><02>|_||_t<06>|<03>}||d<02>|_dS)N<>dialect)<01>errors) <09> cStringIOr<00>queue<75>csv<73>writer<65>stream<61>codecs<63>getincrementalencoder<65>encoder)r<00>fr#<00>encodingr$<00>kwdsZ encoder_clsr r r <00>__init__Ps


zUnicodeWriter.__init__cCst|t<01>r|<01>d<01>S|SdS)Nzutf-8)<03>
isinstancer<00>encode)r<00>datar r r r2Zs

zUnicodeWriter.encodecsX<00>j<00><01>fdd<02>|D<00><01><00>j<02><03>}|<02>d<03>}<02>j<05>|d<04>}<02>j<07>|<02><00>j<02> d<05>dS)Ncsg|]}<01><00>|<01><01>qSr )r2)<02>.0<EFBFBD>s)rr r <00>
<listcomp>asz*UnicodeWriter.writerow.<locals>.<listcomp>zutf-8r"r)
r(<00>writerowr&<00>getvalue<75>decoder,r2r)<00>write<74>truncate)r<00>rowr3r )rr r7`s 

 zUnicodeWriter.writerowN) rrrr r'<00>excelr0r2r7r r r r r!Is r!)<01>mkdtempc@s<>eZdZdZddd<06>Zdd<08>Zd d
<EFBFBD>Zdd d <0A>Zdd<0F>Zdd<11>Z e
e j <0C>Z e
e jj<0F>Ze
e jj<11>Ze
e jj<13>Ze
e j<15>Ze
e j<17>ZejZdd<13>ZdS)ra<>Create and return a temporary directory. This has the same
behavior as mkdtemp but can be used as a context manager. For
example:
with TemporaryDirectory() as tmpdir:
...
Upon exiting the context, the directory and everything contained
in it are removed.
http://stackoverflow.com/questions/19296146/tempfile-temporarydirectory-context-manager-in-python-2-7
<20><00>tmpNcCsd|_d|_t|||<03>|_dS)NF)<03>_closed<65>namer>)r<00>suffix<69>prefix<69>dirr r r r0~szTemporaryDirectory.__init__cCsd<01>|jj|j<03>S)Nz <{} {!r}>)<04>formatr
rrB)rr r r <00>__repr__<5F>szTemporaryDirectory.__repr__cCs|jS)N)rB)rr r r <00> __enter__<5F>szTemporaryDirectory.__enter__Fc
Cs<>|jr<>|js<>y|<00>|j<00>WnJttfk
rf}z(dt|<02>kr@<40>td<02>||<00>tj d<03>dSd}~XYnXd|_|r<>|<00>
d<05>|<00>t <0B>dS)N<>Nonez"ERROR: {!r} while cleaning up {!r})<01>fileTzImplicitly cleaning up {!r}) rBrA<00>_rmtree<65> TypeError<6F>AttributeError<6F>str<74>printrF<00>sys<79>stderr<72>_warn<72>Warning)rrR<00>exr r r <00>cleanup<75>s  

zTemporaryDirectory.cleanupcCs |<00><00>dS)N)rU)r<00>exc<78>value<75>tbr r r <00>__exit__<5F>szTemporaryDirectory.__exit__cCs|jdd<02>dS)NT)rR)rU)rr r r <00>__del__<5F>szTemporaryDirectory.__del__c Cs<>x<>|<00>|<01>D]x}|<00>||<02>}y|<00>|<03>o2|<00>|<03> }Wntk
rNd}YnX|r`|<00>|<03>q y|<00>|<03>Wq tk
r<EFBFBD>Yq Xq Wy|<00>|<01>Wntk
r<EFBFBD>YnXdS)NF)<08>_listdir<69>
_path_join<EFBFBD>_isdir<69>_islink<6E>OSErrorrK<00>_remove<76>_rmdir)r<00>pathrB<00>fullname<6D>isdirr r r rK<00>s  
 
zTemporaryDirectory._rmtree)r?r@N)F)rrrr r0rGrHrUrYrZ<00> staticmethod<6F>_os<6F>listdirr[rb<00>joinr\rdr]<00>islinkr^<00>remover`<00>rmdirra<00> _warnings<67>warnrRrKr r r r rps 


   

r)ZchunkersZmaxent_ne_chunker)<02>helpZtagsets)ZtaggersZmaxent_treebank_pos_tagger)Z
tokenizersZpunktcCsg|]}tjj|<01><00>qSr )<03>osrbrh)r4<00> path_listr r r r6<00>sr6cCsztrvxptD]h}|t|<00>kr
dt|<00>kr
|<00>|<01>t|<01>}|||d<00>dkrT|d7}|d|<02>d||d<00>}Pq
W|S)Nz/PY3<59>z.zip)<05>PY3<59>_PY3_DATA_UPDATESrN<00>index<65>len)rb<00>item<65>posr r r <00> add_py3_data<74>s
rxcs<00>fdd<02>}t<00><00>|<01>S)Ncs*|dt|d<00>f|dd<00>}<00>||<01>S)Nrr<00>)rx)<02>args<67>kwargs)<01> init_funcr r <00>
_decorator<EFBFBD>s zpy3_data.<locals>._decorator)r)r|r}r )r|r <00>py3_data<74>s r~cs:t|t<01>r|<00>d<01>}tj<04>d<02><05>fdd<04>t<03>d|<00>D<00><01>S)N<>asciir?c3s|]}<01>|<01>dkr|VqdS)ZMnNr )r4<00>c)<01>categoryr r <00> <genexpr><3E>sz!remove_accents.<locals>.<genexpr>ZNFKD)r1<00>bytesr9<00> unicodedatar<61>rh<00> normalize)<01>textr )r<>r <00>remove_accents<74>s


r<>)<01> unidecodecCs^t|t<01>std<01><01>t|j<04>s8|j|_ts8tt|j<05><01>|_t|j <09>sZ|j |_
tsZt|j
<EFBFBD>|_ |S)a<>
This decorator defines __unicode__ method and fixes
__repr__ and __str__ methods under Python 2.
To support Python 2 and 3 with a single code base,
define __str__ and __repr__ methods returning unicode
text and apply this decorator to the class.
Original __repr__ and __str__ would be available
as unicode_repr and __unicode__ (under both Python 2
and Python 3).
z1This decorator doesn't work for old-style classes) <0B>
issubclass<EFBFBD>object<63>
ValueError<EFBFBD>
_was_fixed<EFBFBD>__str__<5F> __unicode__rr<00>_7bit<69>_transliteratedrG<00> unicode_repr)<01>klassr r r <00>python_2_unicode_compatibles


 r<>cCs@tr t|<00>St|d<01>r|<00><03>St|t<05>r8t|<00>dd<03>St|<00>S)a0
For classes that was fixed with @python_2_unicode_compatible
``unicode_repr`` returns ``obj.unicode_repr()``; for unicode strings
the result is returned without "u" letter (to make output the
same under Python 2.x and Python 3.x); for other variables
it is the same as ``repr``.
r<>rN)rr<00>repr<70>hasattrr<72>r1r)<01>objr r r r<>*s

r<>cs8<00>fdd<02>}t|<01>ddg<02>t<01>d<05>r.<2E>j|_d|_|S)Ncs t<00>|<00><01>S)N)<01> transliterate)r)<01>methodr r <00>wrapper@sz _transliterated.<locals>.wrapperrr <00>_nltk_compat_7bitT)rr<>r<><00>_nltk_compat_transliterated)r<>r<>r )r<>r r<>?s  
r<>cs8<00>fdd<02>}t|<01>ddg<02>t<01>d<05>r.<2E>j|_d|_|S)Ncs<00>|<00><01>dd<02>S)Nr<00>backslashreplace)r2)r)r<>r r r<>Lsz_7bit.<locals>.wrapperrr r<>T)rr<>r<>r<>)r<>r<>r )r<>r r<>Ks  
r<>cCst|dd<02>pt|dd<02>S)Nr<4E>Fr<46>)<01>getattr)r<>r r r r<>Xsr<>cs"eZdZdZd<07>fdd<06> Z<04>ZS)<08>Fractiona<6E>
This is a simplified backwards compatible version of fractions.Fraction
from Python >=3.5. It adds the `_normalize` parameter such that it does
not normalize the denominator to the Greatest Common Divisor (gcd) when
the numerator is 0.
This is most probably only used by the nltk.translate.bleu_score.py where
numerator and denominator of the different ngram precisions are mutable.
But the idea of "mutable" fraction might not be applicable to other usages,
See http://stackoverflow.com/questions/34561265
This objects should be deprecated once NLTK stops supporting Python < 3.5
See https://github.com/nltk/nltk/issues/1330
rNTcs8tt|<00><02>|||<02>}|s4t|<01>tkr4|r4||_||_|S)N)<07>superr<72><00>__new__<5F>type<70>intZ
_numeratorZ _denominator)<04>cls<6C> numerator<6F> denominator<6F>
_normalize)r
r r r<>ns
zFraction.__new__)rNT)rrrr r<><00> __classcell__r r )r
r r<>^sr<>)5<>
__future__rrrorP<00> functoolsrrZ fractionsr<73><00>sixrr<00> version_inforrr<00>ior<00>BytesIO<49>datetimer<00>utcr<00>tempfilerr%<00> ImportErrorrrrZHOURr'r*r!<00>warningsrlrfr>r<>Z DATA_UPDATESrsrxr~r<>r<>r<>Ztext_unidecoder<65>r<>r<>r<>r<>r<>r r r r <00><module> sn 
 # Z  %