{ "info": { "author": "Danial Alihosseini", "author_email": "danial.alihosseini@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3" ], "description": "# FastBLEU Package\n\nThis is a fast multithreaded C++ implementation of NLTK BLEU; computing BLEU and SelfBLEU score for a fixed reference set.\nIt can return (Self)BLEU for different (max) n-grams simultaneously and efficiently (e.g. BLEU-2, BLEU-3 and etc.).\n\n## Installation\nPyPI latest stable release\n\n~~~~~~~~~~~~~~~~~~~~~~~~\npip install --user FastBLEU\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n## Sample Usage\nHere is an example to compute BLEU-2, BLEU-3, SelfBLEU-2 and SelfBLEU-3:\n\n```python\n>>> from fast_bleu import BLEU, SelfBLEU\n>>> ref1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'that',\n... 'ensures', 'that', 'the', 'military', 'will', 'forever',\n... 'heed', 'Party', 'commands']\n>>> ref2 = ['It', 'is', 'the', 'guiding', 'principle', 'which',\n... 'guarantees', 'the', 'military', 'forces', 'always',\n... 'being', 'under', 'the', 'command', 'of', 'the', 'Party']\n>>> ref3 = ['It', 'is', 'the', 'practical', 'guide', 'for', 'the',\n... 'army', 'always', 'to', 'heed', 'the', 'directions',\n... 'of', 'the', 'party']\n\n>>> hyp1 = ['It', 'is', 'a', 'guide', 'to', 'action', 'which',\n... 'ensures', 'that', 'the', 'military', 'always',\n... 'obeys', 'the', 'commands', 'of', 'the', 'party']\n>>> hyp2 = ['he', 'read', 'the', 'book', 'because', 'he', 'was',\n... 'interested', 'in', 'world', 'history']\n\n>>> list_of_references = [ref1, ref2, ref3]\n>>> hypotheses = [hyp1, hyp2]\n>>> weights = {'bigram': (1/2., 1/2.), 'trigram': (1/3., 1/3., 1/3.)}\n\n>>> bleu = BLEU(list_of_references, weights)\n>>> bleu.get_score(hypotheses)\n{'bigram': [0.7453559924999299, 0.0191380231127159], 'trigram': [0.6240726901657495, 0.013720869575946234]}\n```\n\nwhich means:\n* BLEU-2 for hyp1 is 0.7453559924999299\n* BLEU-2 for hyp2 is 0.0191380231127159\n\n* BLEU-3 for hyp1 is 0.6240726901657495\n* BLEU-3 for hyp2 is 0.013720869575946234\n\n```python\n>>> self_bleu = SelfBLEU(list_of_references, weights)\n>>> self_bleu.get_score()\n{'bigram': [0.25819888974716115, 0.3615507630310936, 0.37080992435478316],\n 'trigram': [0.07808966062765045, 0.20140620205719248, 0.21415334758254043]}\n```\n\nwhich means: \n* SelfBLEU-2 for ref1 is 0.25819888974716115\n* SelfBLEU-2 for ref2 is 0.3615507630310936\n* SelfBLEU-2 for ref3 is 0.37080992435478316\n\n* SelfBLEU-3 for ref1 is 0.07808966062765045\n* SelfBLEU-3 for ref2 is 0.20140620205719248\n* SelfBLEU-3 for ref3 is 0.21415334758254043\n\n**Caution** Each token of reference set is converted to string format during computation.\n\nFor further details, refer to the documentation provided in the source codes.\n\n# Citation\n\nPlease cite our paper if it helps with your research.\n\n* ACL Anthology: https://www.aclweb.org/anthology/W19-2311\n* Arxiv link: https://arxiv.org/abs/1904.03971\n\n```latex\n@article{https://arxiv.org/abs/1904.03971,\n title={Jointly Measuring Diversity and Quality in Text Generation Models},\n author={Montahaei, Ehsan and Alihosseini, Danial and Baghshah, Mahdieh Soleymani},\n journal={NAACL HLT 2019},\n pages={90},\n year={2019}\n}\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/Danial-Alh/FastBLEU", "keywords": "", "license": "OSI Approved :: MIT License", "maintainer": "", "maintainer_email": "", "name": "FastBLEU", "package_url": "https://pypi.org/project/FastBLEU/", "platform": "POSIX :: Linux", "project_url": "https://pypi.org/project/FastBLEU/", "project_urls": { "Homepage": "https://github.com/Danial-Alh/FastBLEU" }, "release_url": "https://pypi.org/project/FastBLEU/0.0.4/", "requires_dist": null, "requires_python": ">=3", "summary": "A fast multithreaded C++ implementation of nltk BLEU.", "version": "0.0.4" }, "last_serial": 5752883, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "ea0f106c1d500d9a16797d260bf630d6", "sha256": "bf5c81cdca0dc5dd967ad6d4a13da189dd152ba7d58d386a934a867b08808bbb" }, "downloads": -1, "filename": "FastBLEU-0.0.1.tar.gz", "has_sig": false, "md5_digest": "ea0f106c1d500d9a16797d260bf630d6", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 7447, "upload_time": "2019-08-27T14:58:11", "url": "https://files.pythonhosted.org/packages/dc/57/c2fcf06e8ca1ea59c8334562ef92b690d1c2f40757e5405722f4f7af8ca8/FastBLEU-0.0.1.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "e64480469abdbe6d95ec1356f9b6f3ea", "sha256": "a886361d22ea664b1525f5d839f64b69294a266a708aaf35570a982c54c964cd" }, "downloads": -1, "filename": "FastBLEU-0.0.3.tar.gz", "has_sig": false, "md5_digest": "e64480469abdbe6d95ec1356f9b6f3ea", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 9277, "upload_time": "2019-08-28T20:59:36", "url": "https://files.pythonhosted.org/packages/ab/51/f286a978d6c50cf63249d6034bf776961c21381bb4f947c99573fbdbb2d6/FastBLEU-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "f96af9f4b2b9fd535fd5a6abb81be4a9", "sha256": "84fd897e1fc6a5f6f1028e386f6ceb1d7ea910ffa4c87045ee3ebc7a6a6c288f" }, "downloads": -1, "filename": "FastBLEU-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f96af9f4b2b9fd535fd5a6abb81be4a9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 9701, "upload_time": "2019-08-29T11:40:27", "url": "https://files.pythonhosted.org/packages/f3/fb/89a08f6132b66635e8ac29a01e6f35d5b8be75b5d73690b3bf72b7813074/FastBLEU-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f96af9f4b2b9fd535fd5a6abb81be4a9", "sha256": "84fd897e1fc6a5f6f1028e386f6ceb1d7ea910ffa4c87045ee3ebc7a6a6c288f" }, "downloads": -1, "filename": "FastBLEU-0.0.4.tar.gz", "has_sig": false, "md5_digest": "f96af9f4b2b9fd535fd5a6abb81be4a9", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3", "size": 9701, "upload_time": "2019-08-29T11:40:27", "url": "https://files.pythonhosted.org/packages/f3/fb/89a08f6132b66635e8ac29a01e6f35d5b8be75b5d73690b3bf72b7813074/FastBLEU-0.0.4.tar.gz" } ] }