/usr/local/lib/python3.6/site-packages/sacremoses/__pycache__
NameSizeModeActions
chinese.cpython-36.pyc147100644editdlrm
cli.cpython-36.pyc65190644editdlrm
corpus.cpython-36.pyc49150644editdlrm
indic.cpython-36.pyc9490644editdlrm
normalize.cpython-36.pyc48290644editdlrm
sent_tokenize.cpython-36.pyc7210644editdlrm
subwords.cpython-36.pyc46500644editdlrm
tokenize.cpython-36.pyc165930644editdlrm
truecase.cpython-36.pyc117780644editdlrm
util.cpython-36.pyc51300644editdlrm
__init__.cpython-36.pyc2990644editdlrm
__main__.cpython-36.pyc2240644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/sacremoses/__pycache__/util.cpython-36.pyc (5130B)
3 Eg! @syddlmZWn ek r0ddlmZYnXddlmZddlmZmZddlm Z m Z ddl m Z Gddde Z d d Zd d Zd dZddZdddZdddZdS)) zip_longest) izip_longest)tee)escapeunescape)Paralleldelayed)tqdmc @sZeZdZdZdZdZdZdZdZd Z d!Z d"Z d#Z d$Z d%Zd&Zeeeeee e e e eeg ZdS)'CJKCharsz An object that enumerates the code points of the CJK characters as listed on http://en.wikipedia.org/wiki/Basic_Multilingual_Plane#Basic_Multilingual_Plane .Ϥ@0Oeoop/pN)r r )r r)rr)rr)rr)rr)rr)rr)rr)rr)rr )r!r")__name__ __module__ __qualname____doc__Z Hangul_JamoZ CJK_RadicalsZPhags_PaZHangul_SyllablesZCJK_Compatibility_IdeographsZCJK_Compatibility_FormsZKatakana_Hangul_HalfwidthZ#Ideographic_Symbols_And_PunctuationZTangutZKana_SupplementZNushuZSupplementary_Ideographic_Planerangesr(r(9/usr/local/lib/python3.6/site-packages/sacremoses/util.pyr s4r cstfddd$DS)%u This checks for CJK character. >>> CJKChars().ranges [(4352, 4607), (11904, 42191), (43072, 43135), (44032, 55215), (63744, 64255), (65072, 65103), (65381, 65500), (94208, 101119), (110592, 110895), (110960, 111359), (131072, 196607)] >>> is_cjk(u'㏾') True >>> is_cjk(u'﹟') False :param character: The character that needs to be checked. :type character: char :return: bool cs,g|]$\}}|tko"|knqSr()ord).0startend) characterr(r) tszis_cjk...Ϥ@0Oep/pr0r1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrE) rFrGrHrIrJrKrLrMrNrOrP)any)r.r()r.r)is_cjkcs rRcCst|dddddddS)a This function transforms the input text into an "escaped" version suitable for well-formed XML formatting. Note that the default xml.sax.saxutils.escape() function don't escape some characters that Moses does so we have to manually add them to the entities dictionary. >>> input_str = ''')| & < > ' " ] [''' >>> expected_output = ''')| & < > ' " ] [''' >>> escape(input_str) == expected_output True >>> xml_escape(input_str) ')| & < > ' " ] [' :param text: The text that needs to be escaped. :type text: str :rtype: str z'z"z|z[z])'"|[])entities)r)textr(r(r) xml_escapesrZcCst|dddddddS)ai This function transforms the "escaped" version suitable for well-formed XML formatting into humanly-readable string. Note that the default xml.sax.saxutils.unescape() function don't unescape some characters that Moses does so we have to manually add them to the entities dictionary. >>> from xml.sax.saxutils import unescape >>> s = ')| & < > ' " ] [' >>> expected = ''')| & < > ' " ] [''' >>> xml_unescape(s) == expected True :param text: The text that needs to be unescaped. :type text: str :rtype: str rSrTrUrVrW)z'z"z|z[z])rX)r)rYr(r(r) xml_unescapesr[cCs t|\}}t|dt||S)zp From https://docs.python.org/3/library/itertools.html#recipes s -> (s0,s1), (s1,s2), (s2, s3), ... N)rnextzip)iterableabr(r(r)pairwises  raNcCst|g|}t|d|iS)ziCollect data into fixed-length chunks or blocks from https://stackoverflow.com/a/16789869/610569 fillvalue)iterr)r^nrbargsr(r(r)groupersrfFcs>|r t|n|}|dkr"t|St|dfdd|DS)N)Zn_jobsc3s|]}t|VqdS)N)r)r+line)funcr(r) sz)parallelize_preprocess..)r mapr)riiterator processes progress_barr()rir)parallelize_preprocesss ro)N)F) itertoolsr ImportErrorrrxml.sax.saxutilsrrZjoblibrrr objectr rRrZr[rarfror(r(r(r)s  S#