{ "info": { "author": "Zelenyak Aleksander aka ZZZ", "author_email": "zzz.sochi@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "====================\nThe **trans** module\n====================\n\nThis module translates national characters into similar sounding\nlatin characters (transliteration).\nAt the moment, Czech, Greek, Latvian, Polish, Turkish, Russian, Ukrainian,\nKazakh and Farsi alphabets are supported (it covers 99% of needs).\n\n.. contents::\n\nSimple usage\n------------\nIt's very easy to use\n~~~~~~~~~~~~~~~~~~~~~\n\nPython 3:\n\n >>> from trans import trans\n >>> trans('\u041f\u0440\u0438\u0432\u0435\u0442, \u041c\u0438\u0440!')\n\nPython 2:\n\n >>> import trans\n >>> u'\u041f\u0440\u0438\u0432\u0435\u0442, \u041c\u0438\u0440!'.encode('trans')\n u'Privet, Mir!'\n >>> trans.trans(u'\u041f\u0440\u0438\u0432\u0435\u0442, \u041c\u0438\u0440!')\n u'Privet, Mir!'\n\nWork only with unicode strings\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n >>> 'Hello World!'.encode('trans')\n Traceback (most recent call last):\n ...\n TypeError: trans codec support only unicode string, given.\n\nThis is readability\n~~~~~~~~~~~~~~~~~~~\n >>> s = u'''\\\n ... -- \u0420\u0430\u0441\u043a\u0443\u0434\u0440\u0438\u0442\u044c \u0442\u0432\u043e\u044e \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0440\u043e\u043c\u044b\u0441\u043b\u043e \u0432 \u0431\u043e\u0433\u0430 \u0434\u0443\u0448\u0443 \u043c\u0430\u0442\u044c\n ... \u0442\u0440\u0438\u0441\u0442\u0430 \u0442\u044b\u0441\u044f\u0447 \u0440\u0430\u0437 \u0435\u0434\u0440\u0435\u043d\u0443 \u0432\u043e\u0448\u044c \u0442\u0435\u0431\u0435 \u0432 \u043a\u0440\u044b\u043b\u043e\n ... \u0438 \u043a\u0430\u043a\u0442\u0443\u0441 \u0432 \u0433\u043b\u043e\u0442\u043a\u0443! -- \u0432\u0437\u0440\u0435\u0432\u0435\u043b \u0440\u0430\u0437\u044a\u044f\u0440\u0435\u043d\u043d\u044b\u0439 \u041d\u0438\u043a\u043e\u0434\u0438\u043c.\n ... -- \u0410\u043c\u0438\u043d\u044c, -- \u0440\u043e\u0431\u043a\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0438\u0437 \u0441\u043a\u043b\u0435\u043f\u0430 \u043f\u0430\u043f\u0430 \u041f\u0438\u0439.\n ... (c) \u0413. \u041b. \u041e\u043b\u0434\u0438, \"\u0421\u043a\u0430\u0437\u043a\u0438 \u0434\u0435\u0434\u0443\u0448\u043a\u0438 \u0432\u0430\u043c\u043f\u0438\u0440\u0430\".'''\n >>>\n >>> print s.encode('trans')\n -- Raskudrit tvoyu cherez koromyslo v boga dushu mat\n trista tysyach raz edrenu vosh tebe v krylo\n i kaktus v glotku! -- vzrevel razyarennyy Nikodim.\n -- Amin, -- robko dobavil iz sklepa papa Piy.\n (c) G. L. Oldi, \"Skazki dedushki vampira\".\n\nTable \"**slug**\"\n~~~~~~~~~~~~~~~~\nUse the table \"slug\", leaving only the Latin characters, digits and underscores:\n\n >>> print u'1 2 3 4 5 \\n6 7 8 9 0'.encode('trans')\n 1 2 3 4 5\n 6 7 8 9 0\n >>> print u'1 2 3 4 5 \\n6 7 8 9 0'.encode('trans/slug')\n 1_2_3_4_5__6_7_8_9_0\n >>> s.encode('trans/slug')[-42:-1]\n u'_c__G__L__Oldi___Skazki_dedushki_vampira_'\n\nTable \"**id**\"\n~~~~~~~~~~~~~~\nTable **id** is deprecated and renamed to **slug**.\nOld name also available, but not recommended.\n\nDefine user tables\n------------------\nSimple variant\n~~~~~~~~~~~~~~\n >>> u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')\n Traceback (most recent call last):\n ...\n ValueError: Table \"my\" not found in tables!\n >>> trans.tables['my'] = {u'1': u'A', u'2': u'B'};\n >>> u'1 2 3 4 5 6 7 8 9 0'.encode('trans/my')\n u'A_B________________'\n >>>\n\nA little harder\n~~~~~~~~~~~~~~~\nTable can consist of two parts - the map of diphthongs and the map of characters.\nDiphthongs are processed first by simple replacement in the substring.\nThen each character of the received string is replaced according to the map of\ncharacters. If character is absent in the map of characters, key **None** are checked.\nIf key **None** is not present, the default character **u'_'** is used.\n\n\n >>> diphthongs = {u'11': u'AA', u'22': u'BB'}\n >>> characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-',\n ... u'A': u'A', u'B': u'B'} # See below...\n >>> trans.tables['test'] = (diphthongs, characters)\n >>> u'11abc22cbaCC'.encode('trans/test')\n u'AAzyxBBxyz--'\n\n**The characters are created by processing of diphthongs also processed\nby the map of the symbols:**\n\n >>> diphthongs = {u'11': u'AA', u'22': u'BB'}\n >>> characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-'}\n >>> trans.tables['test'] = (diphthongs, characters)\n >>> u'11abc22cbaCC'.encode('trans/test')\n u'--zyx--xyz--'\n\nWithout the diphthongs\n~~~~~~~~~~~~~~~~~~~~~~\nThese two tables are equivalent:\n\n >>> characters = {u'a': u'z', u'b': u'y', u'c': u'x', None: u'-'}\n >>> trans.tables['t1'] = characters\n >>> trans.tables['t2'] = ({}, characters)\n >>> u'11abc22cbaCC'.encode('trans/t1') == u'11abc22cbaCC'.encode('trans/t2')\n True\n\nChangeLog\n---------\n\n2.1 2016-09-19\n\n * Add Farsi alphabet (thx rodgar-nvkz)\n * Use pytest\n * Some code style refactoring\n\n\n2.0 2013-04-01\n\n * Python 3 support\n * class Trans for create different tables spaces\n\n1.5 2012-09-12\n\n * Add support of kazakh alphabet.\n\n1.4 2011-11-29\n\n * Change license to BSD.\n\n1.3 2010-05-18\n\n * Table \"id\" renamed to \"slug\". Old name also available.\n * Some speed optimizations (thx to AndyLegkiy ).\n\n1.2 2010-01-10\n\n * First public release.\n * Translate documentation to English.\n\n\n\nFinally\n-------\n+ *Special thanks to Yuri Yurevich aka j2a for the kick in the right direction.*\n - http://python.su/forum/viewtopic.php?pid=28965\n - http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/media/js/urlify.js\n+ *I ask forgiveness for my bad English. I promise to be corrected.*", "description_content_type": null, "docs_url": "https://pythonhosted.org/trans/", "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zzzsochi/trans", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "trans", "package_url": "https://pypi.org/project/trans/", "platform": "any", "project_url": "https://pypi.org/project/trans/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/zzzsochi/trans" }, "release_url": "https://pypi.org/project/trans/2.1.0/", "requires_dist": null, "requires_python": null, "summary": "National characters transcription module.", "version": "2.1.0" }, "last_serial": 2291050, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "9541c56b3ffe27adff3c93072caf9d81", "sha256": "e6e17d4f217fbd626b9ab4e1d938755a9fabf4402fe3ee6a7cc63ec9ff3137b4" }, "downloads": -1, "filename": "trans-1.2.tar.bz2", "has_sig": false, "md5_digest": "9541c56b3ffe27adff3c93072caf9d81", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9036, "upload_time": "2010-01-10T18:33:37", "url": "https://files.pythonhosted.org/packages/27/13/8189dc06fa2e8d6f8a535ad73c9b3baa4a6c46dc4a4e64ea0d98be62b9ad/trans-1.2.tar.bz2" } ], "1.3": [ { "comment_text": "", "digests": { "md5": "e9216b17487222de89572d7664e5408e", "sha256": "b8eb3479248d4349713b592292b4be5ed4f15ef27a2dabbb3d7b32687fc3b69a" }, "downloads": -1, "filename": "trans-1.3.tar.bz2", "has_sig": false, "md5_digest": "e9216b17487222de89572d7664e5408e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9321, "upload_time": "2010-05-19T14:49:13", "url": "https://files.pythonhosted.org/packages/68/ea/f2683bec9657091a4bf368e10e8c680b9530deb3fe9e0dfc56cedf81ef63/trans-1.3.tar.bz2" } ], "1.4.1": [ { "comment_text": "", "digests": { "md5": "f0e31c8df05707a29693e60f97d9d7cf", "sha256": "50448f60795d81093bdd77d381364dbf5811af476987ac6e3087423d1876c564" }, "downloads": -1, "filename": "trans-1.4.1.tar.gz", "has_sig": false, "md5_digest": "f0e31c8df05707a29693e60f97d9d7cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5182, "upload_time": "2011-11-29T08:36:16", "url": "https://files.pythonhosted.org/packages/94/4a/60a6fdf38e8702b386114350aa2ff770b570d7c9ac5b104f3291e9f03b1d/trans-1.4.1.tar.gz" } ], "1.4.2": [ { "comment_text": "", "digests": { "md5": "10f5484aecfefb5c2be5c16cd82f3678", "sha256": "b48124969b07dfa1b21c1d3424f9de78cf388da317b7328c2e8333c7b11a1c1b" }, "downloads": -1, "filename": "trans-1.4.2.tar.gz", "has_sig": false, "md5_digest": "10f5484aecfefb5c2be5c16cd82f3678", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5582, "upload_time": "2011-11-29T23:08:31", "url": "https://files.pythonhosted.org/packages/c9/6b/c2f44d85662f1f87d3c7a6579253851a7d703b84a2244dd374f02abfd24d/trans-1.4.2.tar.gz" } ], "1.5": [ { "comment_text": "", "digests": { "md5": "ead02585830096eb6ef0cfcb3d316bec", "sha256": "940a5335899ecb27bfaa940558aecf2a44a04a36af11f5544a3e772dec2fba21" }, "downloads": -1, "filename": "trans-1.5.tar.bz2", "has_sig": false, "md5_digest": "ead02585830096eb6ef0cfcb3d316bec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5010, "upload_time": "2012-09-12T07:28:29", "url": "https://files.pythonhosted.org/packages/e6/88/0873f2b92231cb51cbc1fdaaafd40acaefb8652dbdec28741805324f6e7a/trans-1.5.tar.bz2" } ], "1.5.1": [ { "comment_text": "", "digests": { "md5": "1393dc0ca76e144d70216eb8a7ccaeee", "sha256": "f2fc01ceeefb4372df6f2c8e0f7a7548bb02c440203e0e8f70385ced9fe509da" }, "downloads": -1, "filename": "trans-1.5.1.tar.bz2", "has_sig": false, "md5_digest": "1393dc0ca76e144d70216eb8a7ccaeee", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6409, "upload_time": "2012-09-18T12:08:36", "url": "https://files.pythonhosted.org/packages/78/c4/bb40211025ba97eb400843200cb6cb51980de23e6b252f4bf07bfb32d111/trans-1.5.1.tar.bz2" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "9c6ac5bd69abebdc8af8a9c3e5b5e157", "sha256": "77e444e908b4553c4c084d51357647f65398039f447ec8bb7cf90fa34fb1509d" }, "downloads": -1, "filename": "trans-2.0.tar.bz2", "has_sig": false, "md5_digest": "9c6ac5bd69abebdc8af8a9c3e5b5e157", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7396, "upload_time": "2014-01-19T19:57:45", "url": "https://files.pythonhosted.org/packages/d7/cf/2091a2dc9a47262224a285aed547bd0fc5d7c2c3ff0e50140199eba2afb5/trans-2.0.tar.bz2" } ], "2.0.1": [ { "comment_text": "", "digests": { "md5": "2121cbec1b8ae3bb4679e236ab0509a1", "sha256": "be3402c1274735a7b8383d30c9ddce2d8d650c1dd03359e966197a86fd7e9129" }, "downloads": -1, "filename": "trans-2.0.1.tar.bz2", "has_sig": false, "md5_digest": "2121cbec1b8ae3bb4679e236ab0509a1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7420, "upload_time": "2014-02-01T11:24:07", "url": "https://files.pythonhosted.org/packages/b2/dd/61a975889cf99e3e5b6d08f166dae6d35ecff3f2e859d9178ee7710e6b57/trans-2.0.1.tar.bz2" } ], "2.0.2": [ { "comment_text": "", "digests": { "md5": "fd2d8033f3c23e3410419ff0cc1b5bcc", "sha256": "5fd9ef4ce115465e587c8909cf8c521e71a57c676d5d9ed5fdf68ae308239b6f" }, "downloads": -1, "filename": "trans-2.0.2.tar.bz2", "has_sig": false, "md5_digest": "fd2d8033f3c23e3410419ff0cc1b5bcc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7443, "upload_time": "2015-11-04T12:30:56", "url": "https://files.pythonhosted.org/packages/56/21/a1556b4ff18e31c7bd1305b7b1400048ca0715842dae73f3316206ffcc10/trans-2.0.2.tar.bz2" } ], "2.1.0": [ { "comment_text": "", "digests": { "md5": "ad37b092be2d41f49dee4662bd9982d7", "sha256": "417d8f7862a4a01470bdf0ab2a96b60983e459d202c1b12e8df3fa563146b71f" }, "downloads": -1, "filename": "trans-2.1.0.tar.bz2", "has_sig": false, "md5_digest": "ad37b092be2d41f49dee4662bd9982d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6864, "upload_time": "2016-08-19T15:28:32", "url": "https://files.pythonhosted.org/packages/3e/c1/368daee29d1c9b081c8c1eeda2335879c484021d795b12bd116bd134d98f/trans-2.1.0.tar.bz2" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ad37b092be2d41f49dee4662bd9982d7", "sha256": "417d8f7862a4a01470bdf0ab2a96b60983e459d202c1b12e8df3fa563146b71f" }, "downloads": -1, "filename": "trans-2.1.0.tar.bz2", "has_sig": false, "md5_digest": "ad37b092be2d41f49dee4662bd9982d7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6864, "upload_time": "2016-08-19T15:28:32", "url": "https://files.pythonhosted.org/packages/3e/c1/368daee29d1c9b081c8c1eeda2335879c484021d795b12bd116bd134d98f/trans-2.1.0.tar.bz2" } ] }