{"id":13407510,"url":"https://github.com/aichaos/rivescript-python","last_synced_at":"2026-01-10T09:07:21.111Z","repository":{"id":3066204,"uuid":"4088871","full_name":"aichaos/rivescript-python","owner":"aichaos","description":"A RiveScript interpreter for Python. RiveScript is a scripting language for chatterbots.","archived":false,"fork":false,"pushed_at":"2021-11-22T09:50:08.000Z","size":2637,"stargazers_count":157,"open_issues_count":35,"forks_count":72,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-10-12T16:53:19.706Z","etag":null,"topics":["ai","artificial-intelligence","bots","chatbot","chatbots","rivescript"],"latest_commit_sha":null,"homepage":"https://www.rivescript.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aichaos.png","metadata":{"files":{"readme":"README.md","changelog":"Changes.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-04-20T16:50:38.000Z","updated_at":"2024-09-24T11:09:36.000Z","dependencies_parsed_at":"2022-08-06T13:15:13.771Z","dependency_job_id":null,"html_url":"https://github.com/aichaos/rivescript-python","commit_stats":null,"previous_names":["kirsle/rivescript-python"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichaos%2Frivescript-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichaos%2Frivescript-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichaos%2Frivescript-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aichaos%2Frivescript-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aichaos","download_url":"https://codeload.github.com/aichaos/rivescript-python/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221467834,"owners_count":16827232,"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":["ai","artificial-intelligence","bots","chatbot","chatbots","rivescript"],"created_at":"2024-07-30T20:00:41.310Z","updated_at":"2024-10-25T22:30:24.098Z","avatar_url":"https://github.com/aichaos.png","language":"Python","readme":"# RiveScript-Python\n\n[![Build Status][1]][2] [![Read the docs][3]][4] [![PyPI][5]][6]\n\n## Introduction\n\nThis is a RiveScript interpreter for the Python programming language. RiveScript\nis a scripting language for chatterbots, making it easy to write\ntrigger/response pairs for building up a bot's intelligence.\n\n### Python 2 EOL Notice\n\nHistorically, this library supported both Python 2 and Python 3 until the\nday that Python 2 entered end-of-life status which happened on\nJanuary 1, 2020.\n\nThe final version with Python 2 support is **v1.14.9** which you may still\ninstall from PyPI if you need to support a Python2 environment. Going\nforward, RiveScript releases will target modern, supported releases of the\nPython 3 language. Today, this means Python 3.6 and newer.\n\n```bash\n# Python2 last supported version of RiveScript is 1.14.9\npip install rivescript==1.14.9\n```\n\n## Documentation\n\nModule documentation is available at \u003chttp://rivescript.readthedocs.org/\u003e\n\nAlso check out the [**RiveScript Community Wiki**](https://github.com/aichaos/rivescript/wiki)\nfor common design patterns and tips \u0026 tricks for RiveScript.\n\n## Installation\n\nThis module is available on [PyPI](https://pypi.python.org/) and can be\ninstalled via pip:\n\n`pip install rivescript`\n\nTo install manually, download or clone the git repository and run\n`python setup.py install`\n\n## Examples\n\nThere are examples available in the\n[eg/](https://github.com/aichaos/rivescript-python/tree/master/eg) directory of\nthis project on GitHub that show how to interface with a RiveScript bot in a\nvariety of ways--such as through the Twilio SMS API--and other code snippets and\nuseful tricks.\n\n## Usage\n\nThe `rivescript` module can be executed as a stand-alone Python script, or\nincluded in other Python code. When executed directly, it launches an\ninteractive chat session:\n\n    python rivescript ./eg/brain\n\nIn case running RiveScript as a script is inconvenient (for example, when it's\ninstalled as a system module) you can use the `shell.py` script as an alias:\n\n    python shell.py eg/brain\n\nWhen used as a library, the synopsis is as follows:\n\n```python\nfrom rivescript import RiveScript\n\nbot = RiveScript()\nbot.load_directory(\"./eg/brain\")\nbot.sort_replies()\n\nwhile True:\n    msg = raw_input('You\u003e ')\n    if msg == '/quit':\n        quit()\n\n    reply = bot.reply(\"localuser\", msg)\n    print 'Bot\u003e', reply\n```\n\nThe scripts `example.py` and `example3.py` provide simple examples for using\nRiveScript as a library for Python 2 and 3, respectively.\n\n## UTF-8 Support\n\nRiveScript supports Unicode but it is not enabled by default. Enable it by\npassing a `True` value for the `utf8` option in the constructor, or by using the\n`--utf8` argument to the standalone interactive mode.\n\nIn UTF-8 mode, most characters in a user's message are left intact, except for\ncertain metacharacters like backslashes and common punctuation characters like\n`/[.,!?;:]/`.\n\nIf you want to override the punctuation regexp, you can provide a new one by\nassigning the `unicode_punctuation` attribute of the bot object after\ninitialization. Example:\n\n```python\nimport re\nbot = RiveScript(utf8=True)\nbot.unicode_punctuation = re.compile(r'[.,!?;:]')\n```\n\nRegardless of whether UTF-8 mode is on, all input messages given to the bot\nare converted (if needed) to Python's `unicode` data type. So, while it's\ngood practice to make sure you're providing Unicode strings to the bot, the\nlibrary will have you covered if you forget.\n\n## JSON Mode\n\nThe `rivescript` package, when run stand-alone, supports \"JSON Mode\", where\nyou communicate with the bot using JSON. This is useful for third-party\nprograms that want to use RiveScript but don't have an interpreter in their\nnative language.\n\nJust run it like: `python rivescript --json /path/to/brain`\n\nPrint a JSON encoded data structure into the standard input. The format should\nlook like this:\n\n  {\n    \"username\": \"localuser\",\n    \"message\": \"Hello bot!\",\n    \"vars\": {\n      \"name\": \"Aiden\"\n    }\n  }\n\nAfter sending this, you can send an `EOF` signal and the bot will respond with\na JSON response and then exit. Or, you can keep the session open, by sending\nthe string `__END__` on a line by itself after your input. The bot will do the\nsame when it responds, so you can reuse the same pipe for multiple\ninteractions.\n\nThe bot's response will be formatted like so:\n\n  {\n    \"status\": \"ok\",\n    \"reply\": \"Hello, human!\",\n    \"vars\": {\n      \"name\": \"Aiden\"\n    }\n  }\n\nThe `status` will be `ok` on success, or `error` if there was an error. The\n`reply` is the bot's response (or an error message on error).\n\n## Contributors\n\n* [Noah Petherbridge](https://github.com/kirsle)\n* [Arash Saidi](https://github.com/arashsa)\n* [Danilo Bargen](https://github.com/dbrgn)\n* [FujiMakoto](https://github.com/FujiMakoto)\n* [Hung Tu Dinh](https://github.com/Dinh-Hung-Tu)\n* [Julien Syx](https://github.com/Seraf)\n* [Pablo](https://github.com/flogiston)\n* [Peixuan (Shawn) Ding](https://github.com/dinever)\n\n## License\n\n```\nThe MIT License (MIT)\n\nCopyright (c) 2020 Noah Petherbridge\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n\nSEE ALSO\n--------\n\nThe official RiveScript website, http://www.rivescript.com/\n\n[1]: https://travis-ci.org/aichaos/rivescript-python.svg?branch=master\n[2]: https://travis-ci.org/aichaos/rivescript-python\n[3]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat\n[4]: http://rivescript.rtfd.io/\n[5]: https://img.shields.io/pypi/v/rivescript.svg\n[6]: https://pypi.python.org/pypi/rivescript/\n","funding_links":[],"categories":["Tools","Python"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichaos%2Frivescript-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faichaos%2Frivescript-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faichaos%2Frivescript-python/lists"}