{"id":13564255,"url":"https://github.com/chakki-works/sumeval","last_synced_at":"2025-05-16T07:04:01.973Z","repository":{"id":27091629,"uuid":"112440145","full_name":"chakki-works/sumeval","owner":"chakki-works","description":"Well tested \u0026 Multi-language evaluation framework for text summarization.","archived":false,"fork":false,"pushed_at":"2022-07-15T18:41:18.000Z","size":111,"stargazers_count":623,"open_issues_count":7,"forks_count":58,"subscribers_count":17,"default_branch":"master","last_synced_at":"2025-05-11T08:37:55.832Z","etag":null,"topics":["bleu","machine-learning","rouge","text-summarization"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chakki-works.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-29T07:11:02.000Z","updated_at":"2025-04-23T06:49:03.000Z","dependencies_parsed_at":"2022-07-27T09:02:58.207Z","dependency_job_id":null,"html_url":"https://github.com/chakki-works/sumeval","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chakki-works%2Fsumeval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chakki-works%2Fsumeval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chakki-works%2Fsumeval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chakki-works%2Fsumeval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chakki-works","download_url":"https://codeload.github.com/chakki-works/sumeval/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485053,"owners_count":22078767,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bleu","machine-learning","rouge","text-summarization"],"created_at":"2024-08-01T13:01:28.729Z","updated_at":"2025-05-16T07:04:01.953Z","avatar_url":"https://github.com/chakki-works.png","language":"Python","funding_links":[],"categories":["Python","Resources"],"sub_categories":["Libraries"],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://github.com/chakki-works/sumeval/raw/master/doc/top.png\" width=\"300px\"\u003e\n\n  \u003ch4 align=\"center\"\u003e\n    Well tested \u0026 Multi-language\u003cbr/\u003e\n    evaluation framework for Text Summarization.\n  \u003c/h4\u003e\n\u003c/p\u003e\n\n[![PyPI version](https://badge.fury.io/py/sumeval.svg)](https://badge.fury.io/py/sumeval)\n[![Build Status](https://travis-ci.org/chakki-works/sumeval.svg?branch=master)](https://travis-ci.org/chakki-works/sumeval)\n[![codecov](https://codecov.io/gh/chakki-works/sumeval/branch/master/graph/badge.svg)](https://codecov.io/gh/chakki-works/sumeval)\n\n\n* Well tested\n  * The ROUGE-X scores are tested compare with [original Perl script (ROUGE-1.5.5.pl)](https://github.com/summanlp/evaluation).\n  * The BLEU score is calculated by [SacréBLEU](https://github.com/mjpost/sacrebleu), that produces the same values as official script (`mteval-v13a.pl`) used by WMT.\n* Multi-language\n  * Not only English, Japanese and Chinese are also supported. The other language is extensible [easily](https://github.com/chakki-works/sumeval#welcome-contribution-tada).\n\nOf course, implementation is Pure Python!\n\n## How to use\n\n```py\nfrom sumeval.metrics.rouge import RougeCalculator\n\n\nrouge = RougeCalculator(stopwords=True, lang=\"en\")\n\nrouge_1 = rouge.rouge_n(\n            summary=\"I went to the Mars from my living town.\",\n            references=\"I went to Mars\",\n            n=1)\n\nrouge_2 = rouge.rouge_n(\n            summary=\"I went to the Mars from my living town.\",\n            references=[\"I went to Mars\", \"It's my living town\"],\n            n=2)\n\nrouge_l = rouge.rouge_l(\n            summary=\"I went to the Mars from my living town.\",\n            references=[\"I went to Mars\", \"It's my living town\"])\n\n# You need spaCy to calculate ROUGE-BE\n\nrouge_be = rouge.rouge_be(\n            summary=\"I went to the Mars from my living town.\",\n            references=[\"I went to Mars\", \"It's my living town\"])\n\nprint(\"ROUGE-1: {}, ROUGE-2: {}, ROUGE-L: {}, ROUGE-BE: {}\".format(\n    rouge_1, rouge_2, rouge_l, rouge_be\n).replace(\", \", \"\\n\"))\n```\n\n```py\nfrom sumeval.metrics.bleu import BLEUCalculator\n\n\nbleu = BLEUCalculator()\nscore = bleu.bleu(\"I am waiting on the beach\",\n                  \"He is walking on the beach\")\n\nbleu_ja = BLEUCalculator(lang=\"ja\")\nscore_ja = bleu_ja.bleu(\"私はビーチで待ってる\", \"彼がベンチで待ってる\")\n```\n\n### From the command line\n\n```\nsumeval r-nlb \"I'm living New York its my home town so awesome\" \"My home town is awesome\"\n```\n\noutput.\n\n```\n{\n  \"options\": {\n    \"stopwords\": true,\n    \"stemming\": false,\n    \"word_limit\": -1,\n    \"length_limit\": -1,\n    \"alpha\": 0.5,\n    \"input-summary\": \"I'm living New York its my home town so awesome\",\n    \"input-references\": [\n      \"My home town is awesome\"\n    ]\n  },\n  \"averages\": {\n    \"ROUGE-1\": 0.7499999999999999,\n    \"ROUGE-2\": 0.6666666666666666,\n    \"ROUGE-L\": 0.7499999999999999,\n    \"ROUGE-BE\": 0\n  },\n  \"scores\": [\n    {\n      \"ROUGE-1\": 0.7499999999999999,\n      \"ROUGE-2\": 0.6666666666666666,\n      \"ROUGE-L\": 0.7499999999999999,\n      \"ROUGE-BE\": 0\n    }\n  ]\n}\n```\n\nUndoubtedly you can use file input. Please see more detail by `sumeval -h`.\n\n## Install\n\n```\npip install sumeval\n```\n\n## Dependencies\n\n* BLEU is depends on [SacréBLEU](https://github.com/mjpost/sacrebleu)\n* To calculate `ROUGE-BE`, [`spaCy`](https://github.com/explosion/spaCy) is required.\n* To use lang `ja`, [`janome`](https://github.com/mocobeta/janome) or [`MeCab`](https://github.com/taku910/mecab) is required.\n  * Especially to get score of `ROUGE-BE`, [`GiNZA`](https://github.com/megagonlabs/ginza) is needed additionally.\n* To use lang `zh`, [`jieba`](https://github.com/fxsjy/jieba) is required.\n  * Especially to get score of `ROUGE-BE`, [`pyhanlp`](https://github.com/hankcs/pyhanlp) is needed additionally.\n\n## Test\n\n`sumeval` uses two packages to test the score.\n\n* [pythonrouge](https://github.com/tagucci/pythonrouge)\n  * It calls original perl script\n  * `pip install git+https://github.com/tagucci/pythonrouge.git`\n* [rougescore](https://github.com/bdusell/rougescore)\n  * It's simple python implementation for rouge score\n  * `pip install git+git://github.com/bdusell/rougescore.git`\n\n## Welcome Contribution :tada:\n\n### Add supported language\n\nThe tokenization and dependency parse process for each language is located on `sumeval/metrics/lang`.\n\nYou can make language class by inheriting [`BaseLang`](https://github.com/chakki-works/sumeval/blob/master/sumeval/metrics/lang/base_lang.py).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchakki-works%2Fsumeval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchakki-works%2Fsumeval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchakki-works%2Fsumeval/lists"}