{ "info": { "author": "Chao-Ming Wang", "author_email": "oujago@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "\n======\nOujago\n======\n\nCoding makes life easier. This is a factory contains commonly used\nalgorithms.\n\n\nInstallation\n============\n\nInstall ``oujago`` using pip:\n\n.. code-block:: bash\n\n $> pip install oujago\n\nInstall from source code:\n\n.. code-block:: bash\n\n $> python setup.py clean --all install\n\n\nDownload data from `BaiDuYun `_:\n\n.. code-block::\n\n https://pan.baidu.com/s/1i57RVLj\n\n\n\nDocumentation\n=============\n\nAvailable online documents: `latest `_,\n`stable `_,\nand `stable `_.\n\n\nNLP Part\n========\n\nHanzi Converter\n---------------\n\n\u7e41\u7b80\u8f6c\u6362\u5668.\n\n.. code-block:: shell\n\n >>> from oujago.nlp import FJConvert\n >>> FJConvert.to_tradition('\u7e41\u7b80\u8f6c\u6362\u5668')\n '\u7e41\u7c21\u8f49\u63db\u5668'\n >>> FJConvert.to_simplify('\u7e41\u7c21\u8f49\u63db\u5668')\n '\u7e41\u7b80\u8f6c\u6362\u5668'\n >>> FJConvert.same('\u7e41\u7b80\u8f6c\u6362\u5668', '\u7e41\u7c21\u8f49\u63db\u5668')\n >>> True\n >>> FJConvert.same('\u7e41\u7b80\u8f6c\u6362\u5668', '\u7e41\u7c21\u8f49\u63db')\n >>> False\n\n\nChinese Segment\n---------------\n\nSupport ``jieba``, ``LTP``, ``thulac``, ``pynlpir`` etc. public segmentation methods.\n\n.. code-block:: shell\n\n >>> from oujago.nlp import seg\n >>>\n >>> sentence = \"\u8fd9\u662f\u4e00\u4e2a\u4f38\u624b\u4e0d\u89c1\u4e94\u6307\u7684\u9ed1\u591c\u3002\u6211\u53eb\u5b59\u609f\u7a7a\uff0c\u6211\u7231\u5317\u4eac\uff0c\u6211\u7231Python\u548cC++\u3002\"\n >>> seg(sentence, mode='ltp')\n ['\u8fd9', '\u662f', '\u4e00\u4e2a', '\u4f38\u624b', '\u4e0d', '\u89c1', '\u4e94', '\u6307', '\u7684', '\u9ed1\u591c', '\u3002', '\u6211', '\u53eb', '\u5b59\u609f\u7a7a',\n '\uff0c', '\u6211', '\u7231', '\u5317\u4eac', '\uff0c', '\u6211', '\u7231', 'Python', '\u548c', 'C', '+', '+', '\u3002']\n >>> seg(sentence, mode='jieba')\n ['\u8fd9\u662f', '\u4e00\u4e2a', '\u4f38\u624b\u4e0d\u89c1\u4e94\u6307', '\u7684', '\u9ed1\u591c', '\u3002', '\u6211', '\u53eb', '\u5b59\u609f\u7a7a', '\uff0c', '\u6211', '\u7231',\n '\u5317\u4eac', '\uff0c', '\u6211', '\u7231', 'Python', '\u548c', 'C++', '\u3002']\n >>> seg(sentence, mode='thulac')\n ['\u8fd9', '\u662f', '\u4e00\u4e2a', '\u4f38\u624b\u4e0d\u89c1\u4e94\u6307', '\u7684', '\u9ed1\u591c', '\u3002', '\u6211', '\u53eb', '\u5b59\u609f\u7a7a', '\uff0c',\n '\u6211', '\u7231', '\u5317\u4eac', '\uff0c', '\u6211', '\u7231', 'Python', '\u548c', 'C', '+', '+', '\u3002']\n >>> seg(sentence, mode='nlpir')\n ['\u8fd9', '\u662f', '\u4e00\u4e2a', '\u4f38\u624b', '\u4e0d\u89c1', '\u4e94\u6307', '\u7684', '\u9ed1\u591c', '\u3002', '\u6211', '\u53eb', '\u5b59\u609f\u7a7a',\n '\uff0c', '\u6211', '\u7231', '\u5317\u4eac', '\uff0c', '\u6211', '\u7231', 'Python', '\u548c', 'C++', '\u3002']\n >>>\n >>> seg(\"\u8fd9\u662f\u4e00\u4e2a\u4f38\u624b\u4e0d\u89c1\u4e94\u6307\u7684\u9ed1\u591c\u3002\")\n ['\u8fd9\u662f', '\u4e00\u4e2a', '\u4f38\u624b\u4e0d\u89c1\u4e94\u6307', '\u7684', '\u9ed1\u591c', '\u3002']\n >>> seg(\"\u8fd9\u662f\u4e00\u4e2a\u4f38\u624b\u4e0d\u89c1\u4e94\u6307\u7684\u9ed1\u591c\u3002\", mode='ltp')\n ['\u8fd9', '\u662f', '\u4e00\u4e2a', '\u4f38\u624b', '\u4e0d', '\u89c1', '\u4e94', '\u6307', '\u7684', '\u9ed1\u591c', '\u3002']\n >>> seg('\u6211\u4e0d\u559c\u6b22\u65e5\u672c\u548c\u670d', mode='jieba')\n ['\u6211', '\u4e0d', '\u559c\u6b22', '\u65e5\u672c', '\u548c\u670d']\n >>> seg('\u6211\u4e0d\u559c\u6b22\u65e5\u672c\u548c\u670d', mode='ltp')\n ['\u6211', '\u4e0d', '\u559c\u6b22', '\u65e5\u672c', '\u548c\u670d']\n\n\nPart-of-Speech\n--------------\n\n.. code-block:: shell\n\n >>> from oujago.nlp.postag import pos\n >>> pos('\u6211\u4e0d\u559c\u6b22\u65e5\u672c\u548c\u670d', mode='jieba')\n ['r', 'd', 'v', 'ns', 'nz']\n >>> pos('\u6211\u4e0d\u559c\u6b22\u65e5\u672c\u548c\u670d', mode='ltp')\n ['r', 'd', 'v', 'ns', 'n']\n\n\nNN Part\n=======\n\nSRU (PyTorch)\n-------------\n\nRequire packages: ``cupy``, ``pynvrtc``, ``pytorch``.\nComes from ` `_ .\n\nThe usage of SRU is similar to ``torch.nn.LSTM``.\n\n.. code-block:: python\n\n import torch\n from torch.autograd import Variable\n from oujago.nn.sru import SRU, SRUCell\n\n # input has length 20, batch size 32 and dimension 128\n x = Variable(torch.FloatTensor(20, 32, 128).cuda())\n\n input_size, hidden_size = 128, 128\n\n rnn = SRU(input_size, hidden_size,\n num_layers = 2, # number of stacking RNN layers\n dropout = 0.0, # dropout applied between RNN layers\n rnn_dropout = 0.0, # variational dropout applied on linear transformation\n use_tanh = 1, # use tanh?\n use_relu = 0, # use ReLU?\n bidirectional = False # bidirectional RNN ?\n )\n rnn.cuda()\n\n output, hidden = rnn(x) # forward pass\n\n # output is (length, batch size, hidden size * number of directions)\n # hidden is (layers, batch size, hidden size * number of directions)\n\n\nSee Language Modeling example: `sru_language_modeling.py `_\n\n\nUtils Part\n==========\n\nCommon Utils\n------------\n\n\nCheck weather this ``object`` is an iterable.\n\n.. code-block:: shell\n\n >>> from oujago.utils.common import is_iterable\n >>> is_iterable([1, 2])\n True\n >>> is_iterable((1, 2))\n True\n >>> is_iterable(\"123\")\n True\n >>> is_iterable(123)\n False\n\n\nTime Utils\n----------\n\nGet current time.\n\n.. code-block:: shell\n\n >>> from oujago.utils.time import now\n >>> now()\n \"2017-04-26-16-44-56\"\n >>>\n >>> from oujago.utils.time import today\n >>> today()\n \"2017-04-26\"\n\nChange the total time into the normal time format.\n\n.. code-block:: shell\n\n >>> from oujago.utils.time import time_format\n >>> time_format(36)\n \"36 s\"\n >>> time_format(90)\n \"1 min 30 s \"\n >>> time_format(5420)\n \"1 h 30 min 20 s\"\n >>> time_format(20.5)\n \"20 s 500 ms\"\n >>> time_format(864023)\n '10 d 23 s'\n\n\n\n\n\nChange Log\n==========\n\n\n0.1.13\n------\n\n* PyTorch alexnet, at `2018.03.30`.\n* PyTorch densenet, at `2018.03.30`.\n* PyTorch inception, at `2018.03.30`.\n* PyTorch resnet, at `2018.03.30`.\n* PyTorch squeezenet, at `2018.03.30`.\n* PyTorch vgg, at `2018.03.30`.\n* keras resnet, at `2018.03.30`.\n\n\n0.1.12\n------\n\n* PyTorch SRU Layer , at `2018.01.21`.\n* Format README , at `2018.01.21`.\n\n0.1.9\n-----\n\n* NLP moran NER , at `2017.07.06`.\n* NLP thulac segment , at `2017.07.06`.\n* NLP thulac postag , at `2017.07.06`.\n\n\n0.1.8\n-----\n\n* NLP moran segment , at `2017.06.26`.\n* NLP moran postag , at `2017.06.26`.\n\n\n0.1.7\n-----\n\n* NLP jieba segment , at `2017.06.20`.\n* NLP LTP segment , at `2017.06.20`.\n* NLP jieba POSTag , at `2017.06.20`.\n* NLP LTP POSTag , at `2017.06.20`.\n* NLP LTP NER , at `2017.06.20`.\n* NLP LTP Dependecy Parse , at `2017.06.20`.\n* NLP LTP Semantic Role Labeling , at `2017.06.20`.\n\n\n0.1.6\n-----\n\n* Hanzi Converter , at `2017.06.19`.\n* Chinese Stopwords , at `2017.06.19`.\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oujago/oujago", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "oujago", "package_url": "https://pypi.org/project/oujago/", "platform": "", "project_url": "https://pypi.org/project/oujago/", "project_urls": { "Homepage": "https://github.com/oujago/oujago" }, "release_url": "https://pypi.org/project/oujago/0.1.14/", "requires_dist": null, "requires_python": "", "summary": "Coding Makes Life Easier", "version": "0.1.14" }, "last_serial": 3721505, "releases": { "0.1.11": [ { "comment_text": "", "digests": { "md5": "6053f629330df075dd47710951a5cdaa", "sha256": "185b955a1d2dfa5d07365e21977617b2b9c1eab62edbefcc3fc12beb3c28d93e" }, "downloads": -1, "filename": "oujago-0.1.11.tar.gz", "has_sig": false, "md5_digest": "6053f629330df075dd47710951a5cdaa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 85202, "upload_time": "2018-01-03T07:43:06", "url": "https://files.pythonhosted.org/packages/40/41/f6049f159c648f2e10c5a086fc7651e8fcece8453032e516c132b7b819e0/oujago-0.1.11.tar.gz" } ], "0.1.13": [ { "comment_text": "", "digests": { "md5": "7564b19c836f498b158a53520d6fe4e1", "sha256": "db4b35595fbf53466e0ddc3dc6a5b30f98cab28bb20aaf8df01df015aeb340ac" }, "downloads": -1, "filename": "oujago-0.1.13.tar.gz", "has_sig": false, "md5_digest": "7564b19c836f498b158a53520d6fe4e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55599, "upload_time": "2018-03-30T13:13:42", "url": "https://files.pythonhosted.org/packages/9f/00/e92407f5db69feeee12952fab767fb1fcf96226caef46d97add1ddc4a5e7/oujago-0.1.13.tar.gz" } ], "0.1.14": [ { "comment_text": "", "digests": { "md5": "f0fea5e093ca2b3cee7a726a46288a33", "sha256": "bff167b9956edd133384561f490a4d0cdb9a08f8919d10a1aabdc9b51078a769" }, "downloads": -1, "filename": "oujago-0.1.14.tar.gz", "has_sig": false, "md5_digest": "f0fea5e093ca2b3cee7a726a46288a33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55970, "upload_time": "2018-03-31T04:02:56", "url": "https://files.pythonhosted.org/packages/49/71/5f1d80decf27b364d45cd9b33a6d5dff3f483c3f0b492efb9a8a2d51fbb9/oujago-0.1.14.tar.gz" } ], "0.1.7": [ { "comment_text": "", "digests": { "md5": "831b138848eb19d0d43d8dd70bbd8df2", "sha256": "35e9a93670bbfc4ba3d61ccaa6712d206bfd7f13440116b795c56f24f5c60f96" }, "downloads": -1, "filename": "oujago-0.1.7.tar.gz", "has_sig": false, "md5_digest": "831b138848eb19d0d43d8dd70bbd8df2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 29859, "upload_time": "2017-06-26T04:36:47", "url": "https://files.pythonhosted.org/packages/04/3e/cf882528d18f0e6e8d4a72ed57e227a5e8ea2be68828f660be2f74bbcb89/oujago-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "3aa3af90366ca81b3148c3fc4446e746", "sha256": "b4f2a4b00b386fb9b85c1f8933913a19a19dd5974243f4a23c6768784d0857e4" }, "downloads": -1, "filename": "oujago-0.1.8.tar.gz", "has_sig": false, "md5_digest": "3aa3af90366ca81b3148c3fc4446e746", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 34899, "upload_time": "2017-06-27T05:43:00", "url": "https://files.pythonhosted.org/packages/38/c9/6d6d6e2aaa9c3710f14a399d4ea75ee314582ca243f824c1878bb5224f48/oujago-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "8ae29ba5bfa3f8031a7ec9cf8eda6d49", "sha256": "c41731976e599b9b829dd64d8ba59e8a386de634b52c03ee478bdc27a644368b" }, "downloads": -1, "filename": "oujago-0.1.9.tar.gz", "has_sig": false, "md5_digest": "8ae29ba5bfa3f8031a7ec9cf8eda6d49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35810, "upload_time": "2017-07-06T09:44:53", "url": "https://files.pythonhosted.org/packages/4a/75/09d0c8ea9b692f95b4bed504524fc2388d384538080bba8e74349f5eda3c/oujago-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f0fea5e093ca2b3cee7a726a46288a33", "sha256": "bff167b9956edd133384561f490a4d0cdb9a08f8919d10a1aabdc9b51078a769" }, "downloads": -1, "filename": "oujago-0.1.14.tar.gz", "has_sig": false, "md5_digest": "f0fea5e093ca2b3cee7a726a46288a33", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55970, "upload_time": "2018-03-31T04:02:56", "url": "https://files.pythonhosted.org/packages/49/71/5f1d80decf27b364d45cd9b33a6d5dff3f483c3f0b492efb9a8a2d51fbb9/oujago-0.1.14.tar.gz" } ] }