{ "info": { "author": "Benjamin Heinzerling, Anders Johannsen", "author_email": "benjamin.heinzerling@h-its.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Topic :: Text Processing :: Linguistic" ], "description": "pyrouge\r\n=======\r\n\r\npyrouge is a Python wrapper for the ROUGE summarization evaluation\r\npackage. Getting ROUGE to work can require quite a bit of time. pyrouge\r\nis designed to make getting ROUGE scores easier by automatically\r\nconverting your summaries into a format ROUGE understands, and\r\nautomatically generating the ROUGE configuration file.\r\n\r\nUsage Examples\r\n--------------\r\n\r\nI have summarizations in plain text format and want to get the ROUGE scores\r\n===========================================================================\r\n\r\nYou can evaluate your plain text summaries like this:\r\n\r\n::\r\n\r\n from pyrouge import Rouge155\r\n\r\n r = Rouge155()\r\n r.system_dir = 'path/to/system_summaries'\r\n r.model_dir = 'path/to/model_summaries'\r\n r.system_filename_pattern = 'some_name.(\\d+).txt'\r\n r.model_filename_pattern = 'some_name.[A-Z].#ID#.txt'\r\n\r\n output = r.convert_and_evaluate()\r\n print(output)\r\n output_dict = r.output_to_dict(output)\r\n\r\nIn order to evaluate summaries, ROUGE needs to know where your summaries\r\nand the gold standard summaries are, and how to match them. In ROUGE\r\nparlance, your summaries are 'system' summaries and the gold standard\r\nsummaries are 'model' summaries. The summaries should be in separate\r\nfolders, whose paths are set with the ``system_dir`` and ``model_dir``\r\nvariables. All summaries should contain one sentence per line.\r\n\r\nTo automatically match a system summary with the corresponding model\r\nsummaries, pyrouge uses regular expressions. For example, let's assume\r\nyour system summaries are named with a combination of a fixed name and a\r\nvariable numeric ID like this:\r\n\r\n| some\\_name.001.txt\r\n| some\\_name.002.txt\r\n| some\\_name.003.txt\r\n| ...\r\n\r\nand the model summaries like this, with uppercase letters identifying\r\nmultiple model summaries for a given document:\r\n\r\n| some\\_name.A.001.txt\r\n| some\\_name.B.001.txt\r\n| some\\_name.C.001.txt\r\n| some\\_name.A.002.txt\r\n| some\\_name.B.002.txt\r\n| ...\r\n\r\nThe group in the ``system_filename_pattern`` tells pyrouge which part of\r\nthe filename is the ID -- in this case ``(\\d+)``. You have to use round\r\nbrackets to indicate a group, or else pyrouge won't be able to tell\r\napart the ID from the rest of the filename. pyrouge then uses that ID to\r\nfind all matching model summaries. The special placeholder ``#ID#``\r\ntells pyrouge where it should expect the ID in the\r\n``model_filename_pattern``. The ``[A-Z]`` part matches multiple model\r\nsummaries for that ID.\r\n\r\nWith the configuration done, invoking ``convert_and_evaluate()`` gets\r\nyou the ROUGE scores as a string. If you want to further process the\r\nscores, you can parse the output into a dict with\r\n``output_to_dict(output)``.\r\n\r\nI only want to preprocess my summaries and then run ROUGE on my own\r\n===================================================================\r\n\r\nTo convert plain text summaries into a format ROUGE understands, do:\r\n\r\n::\r\n\r\n from pyrouge import Rouge155\r\n\r\n Rouge155.convert_summaries_to_rouge_format(system_input_dir, system_output_dir)\r\n Rouge155.convert_summaries_to_rouge_format(model_input_dir, model_output_dir)\r\n\r\nThis will convert all summaries in ``system_input_dir`` and\r\n``model_input_dir``, and save them to their respective output\r\ndirectories.\r\n\r\nTo generate the configuration file that ROUGE uses to match system and\r\nmodel summaries, do:\r\n\r\n::\r\n\r\n from pyrouge import Rouge155\r\n\r\n Rouge155.write_config_static(\r\n system_dir, system_filename_pattern,\r\n model_dir, model_filename_pattern,\r\n config_file_path)\r\n\r\nThe first four arguments are explained above. ``config_file_path``\r\nspecifies where to save the configuration file.\r\n\r\nUsing pyrouge from the command line\r\n===================================\r\n\r\nIf you prefer the command line to Python and the pyrouge module, you can\r\nuse the following scripts, which are automatically installed and should\r\nbe runnable from anywhere on your system:\r\n\r\n- **pyrouge\\_evaluate\\_plain\\_text\\_files** gets you ROUGE scores\r\n for your plain text summaries. Example:\r\n\r\n::\r\n\r\n pyrouge_evaluate_plain_text_files -s systems_plain/ -sfp \"some_name.(\\d+).txt\" -m models_plain/ -mfp some_name.[A-Z].#ID#.txt\r\n\r\n- **pyrouge\\_evaluate\\_rouge\\_format\\_files** gets you ROUGE scores\r\n for summaries already converted to ROUGE format. Example usage for\r\n the ``sample-test/SL2003`` data that comes with ROUGE:\r\n\r\n::\r\n\r\n pyrouge_evaluate_rouge_format_files -s systems -sfp \"SL.P.10.R.11.SL062003-(\\d+).html\" -m models -mfp SL.P.10.R.[A-Z].SL062003-#ID#.html\r\n\r\nNote that the system filename pattern is enclosed in quotation marks\r\nbecause it contains special characters.\r\n\r\n- **pyrouge\\_convert\\_plain\\_text\\_to\\_rouge\\_format** converts\r\n plain text files into a format ROUGE understands. If your plain text\r\n files do not contain one sentence per line, this script can also\r\n split sentences, provided you have nltk and its Punkt sentence\r\n splitter installed. Example:\r\n\r\n::\r\n\r\n pyrouge_convert_plain_text_to_rouge_format -i models_plain/ -o models_rouge\r\n\r\n- **pyrouge\\_write\\_config\\_file** creates a configuration file you\r\n can use to run ROUGE on your own. Example:\r\n\r\n::\r\n\r\n pyrouge_write_config_file -s systems -sfp \"SL.P.10.R.11.SL062003-(\\d+).html\" -m models -mfp SL.P.10.R.[A-Z].SL062003-#ID#.html -c sl2003_config.xml\r\n\r\nRunning any of these with the ``-h`` option will display a usage message\r\nexplaining the various command line options.\r\n\r\nInstallation\r\n------------\r\n\r\nInstruction on installing ROUGE can be found\r\n`here `__.\r\n\r\nDepending on your system, you might have to run the following commands\r\nas root.\r\n\r\nTo install pyrouge, run:\r\n\r\n::\r\n\r\n pip install pyrouge\r\n\r\nAssuming a working ROUGE-1.5.5. installation, tell pyrouge the ROUGE\r\npath with this command:\r\n\r\n::\r\n\r\n pyrouge_set_rouge_path /absolute/path/to/ROUGE-1.5.5/directory\r\n\r\nTo test if everything is installed correctly, run:\r\n\r\n::\r\n\r\n python -m pyrouge.test\r\n\r\nIf everything works, you should see something like:\r\n\r\n::\r\n\r\n Ran 10 tests in 18.055s\r\n\r\n OK\r\n\r\nIf you want to uninstall pyrouge:\r\n\r\n::\r\n\r\n pip uninstall pyrouge", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/noutenki/pyrouge", "keywords": "", "license": "LICENSE.txt", "maintainer": "", "maintainer_email": "", "name": "pyrouge", "package_url": "https://pypi.org/project/pyrouge/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pyrouge/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/noutenki/pyrouge" }, "release_url": "https://pypi.org/project/pyrouge/0.1.3/", "requires_dist": null, "requires_python": null, "summary": "A Python wrapper for the ROUGE summarization evaluation package.", "version": "0.1.3" }, "last_serial": 2388559, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "01256183afc7462f3680e884e1ce749f", "sha256": "09479057ad056d954fa5912340f9361e22fee2346f4b7dbeae57f3fdf45b8dc8" }, "downloads": -1, "filename": "pyrouge-0.1.0.tar.gz", "has_sig": false, "md5_digest": "01256183afc7462f3680e884e1ce749f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55256, "upload_time": "2014-01-25T13:55:21", "url": "https://files.pythonhosted.org/packages/87/82/b02e669132dfa97b99c741de26f4d69d0f57d9dfa58480a34075786f751c/pyrouge-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "eca386bed42a0270f8012e45ca88573f", "sha256": "945f7b04f261c34d14f5221c3596b73128dcbe9b8a24808d58edbd00ca85d281" }, "downloads": -1, "filename": "pyrouge-0.1.1.tar.gz", "has_sig": false, "md5_digest": "eca386bed42a0270f8012e45ca88573f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 55580, "upload_time": "2014-02-01T19:19:12", "url": "https://files.pythonhosted.org/packages/c5/8b/b5d5673ecef510e97559d2f186a94b958023bbef59c0603572513db92274/pyrouge-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "f2bc5545f974165939a4daec7b91ac6e", "sha256": "364f1dd65a5aabeb40eb4cdf967bc0cb495073885c75eaf09c960fc9ea1696a3" }, "downloads": -1, "filename": "pyrouge-0.1.3.tar.gz", "has_sig": false, "md5_digest": "f2bc5545f974165939a4daec7b91ac6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 60506, "upload_time": "2016-10-08T18:37:10", "url": "https://files.pythonhosted.org/packages/11/85/e522dd6b36880ca19dcf7f262b22365748f56edc6f455e7b6a37d0382c32/pyrouge-0.1.3.tar.gz" } ], "0.1.3": [] }, "urls": [] }