{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# fastBPE\n\nC++ implementation of [Neural Machine Translation of Rare Words with Subword Units](https://arxiv.org/abs/1508.07909), with Python API.\n\n## Installation\n\nCompile with:\n```\ng++ -std=c++11 -pthread -O3 fastBPE/main.cc -IfastBPE -o fast\n```\n\n## Usage:\n\n### List commands\n```\n./fast\nusage: fastbpe \n\nThe commands supported by fastBPE are:\n\ngetvocab input1 [input2] extract the vocabulary from one or two text files\nlearnbpe nCodes input1 [input2] learn BPE codes from one or two text files\napplybpe output input codes [vocab] apply BPE codes to a text file\napplybpe_stream codes [vocab] apply BPE codes to stdin and outputs to stdout\n```\n\nfastBPE also supports stdin inputs. For instance, these two commands are equivalent:\n```\n./fast getvocab text > vocab\ncat text | ./fast getvocab - > vocab\n```\nBut the first one will memory map the input file to read it efficiently, which can be more than twice faster than stdin on very large files. Similarly, these two commands are equivalent:\n```\n./fast applybpe output input codes vocab\ncat input | ./fast applybpe_stream codes vocab > output\n```\nAlthough the first one will be significantly faster on large datasets, as it uses multi-threading to pre-compute the BPE splits of all words in the input file.\n\n### Learn codes\n```\n./fast learnbpe 40000 train.de train.en > codes\n```\n\n### Apply codes to train\n```\n./fast applybpe train.de.40000 train.de codes\n./fast applybpe train.en.40000 train.en codes\n```\n\n### Get train vocabulary\n```\n./fast getvocab train.de.40000 > vocab.de.40000\n./fast getvocab train.en.40000 > vocab.en.40000\n```\n\n### Apply codes to valid and test\n```\n./fast applybpe valid.de.40000 valid.de codes vocab.de.40000\n./fast applybpe valid.en.40000 valid.en codes vocab.en.40000\n./fast applybpe test.de.40000 test.de codes vocab.de.40000\n./fast applybpe test.en.40000 test.en codes vocab.en.40000\n```\n\n## Python API\n\nTo install the Python API, simply run:\n```bash\npython setup.py install\n```\n\n**Note:** For Mac OSX Users, add `export MACOSX_DEPLOYMENT_TARGET=10.x` (x=9 or 10, depending on your version) or `-stdlib=libc++` to the `extra_compile_args` of `setup.py` before/during the above install command, as appropriate.\n\nCall the API using:\n\n```python\nimport fastBPE\n\nbpe = fastBPE.fastBPE(codes_path, vocab_path)\nbpe.apply([\"Roasted barramundi fish\", \"Centrally managed over a client-server architecture\"])\n\n>> ['Ro@@ asted barr@@ am@@ un@@ di fish', 'Centr@@ ally managed over a cli@@ ent-@@ server architecture']\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/glample/fastBPE", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "fastBPE", "package_url": "https://pypi.org/project/fastBPE/", "platform": "", "project_url": "https://pypi.org/project/fastBPE/", "project_urls": { "Homepage": "https://github.com/glample/fastBPE" }, "release_url": "https://pypi.org/project/fastBPE/0.1.0/", "requires_dist": null, "requires_python": "", "summary": "C++ implementation of Neural Machine Translation of Rare Words with Subword Units, with Python API.", "version": "0.1.0" }, "last_serial": 5623909, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "16726028b89cd8970dc244ab38f1bdab", "sha256": "95eef4be2689e822a918ac4eae3349cd78ca3f28af591afa421f8fac6d4cd889" }, "downloads": -1, "filename": "fastBPE-0.1.0.tar.gz", "has_sig": false, "md5_digest": "16726028b89cd8970dc244ab38f1bdab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35103, "upload_time": "2019-08-02T12:18:15", "url": "https://files.pythonhosted.org/packages/e1/37/f97181428a5d151501b90b2cebedf97c81b034ace753606a3cda5ad4e6e2/fastBPE-0.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "16726028b89cd8970dc244ab38f1bdab", "sha256": "95eef4be2689e822a918ac4eae3349cd78ca3f28af591afa421f8fac6d4cd889" }, "downloads": -1, "filename": "fastBPE-0.1.0.tar.gz", "has_sig": false, "md5_digest": "16726028b89cd8970dc244ab38f1bdab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 35103, "upload_time": "2019-08-02T12:18:15", "url": "https://files.pythonhosted.org/packages/e1/37/f97181428a5d151501b90b2cebedf97c81b034ace753606a3cda5ad4e6e2/fastBPE-0.1.0.tar.gz" } ] }