All Projects → aichaos → Rivescript Python

aichaos / Rivescript Python

Licence: mit
A RiveScript interpreter for Python. RiveScript is a scripting language for chatterbots.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Rivescript Python

Rivescript Js
A RiveScript interpreter for JavaScript. RiveScript is a scripting language for chatterbots.
Stars: ✭ 350 (+146.48%)
Mutual labels:  artificial-intelligence, ai, chatbot, bots, chatbots
Intelligo
🤖 Chatbot Framework for Node.js.
Stars: ✭ 347 (+144.37%)
Mutual labels:  artificial-intelligence, ai, chatbot, bots
Olivia
💁‍♀️Your new best friend powered by an artificial neural network
Stars: ✭ 3,114 (+2092.96%)
Mutual labels:  artificial-intelligence, ai, chatbot
Facemoji
😆 A voice chatbot that can imitate your expression. OpenCV+Dlib+Live2D+Moments Recorder+Turing Robot+Iflytek IAT+Iflytek TTS
Stars: ✭ 320 (+125.35%)
Mutual labels:  ai, chatbot, chatbots
Lazy
Lazy, AI chatbot service.
Stars: ✭ 141 (-0.7%)
Mutual labels:  artificial-intelligence, ai, chatbot
Ai Chatbot Framework
A python chatbot framework with Natural Language Understanding and Artificial Intelligence.
Stars: ✭ 1,564 (+1001.41%)
Mutual labels:  ai, chatbot, chatbots
intelligo-generator
🛠️ Chatbot generator for Intelligo Framework.
Stars: ✭ 31 (-78.17%)
Mutual labels:  bots, chatbot, chatbots
Eddi
Scalable Open Source Chatbot Platform. Build multiple Chatbots with NLP, Behavior Rules, API Connector, Templating. Developed in Java, provided with Docker, orchestrated with Kubernetes or Openshift.
Stars: ✭ 171 (+20.42%)
Mutual labels:  ai, chatbot, bots
Botlibre
An open platform for artificial intelligence, chat bots, virtual agents, social media automation, and live chat automation.
Stars: ✭ 412 (+190.14%)
Mutual labels:  artificial-intelligence, chatbot, bots
Deeppavlov
An open source library for deep learning end-to-end dialog systems and chatbots.
Stars: ✭ 5,525 (+3790.85%)
Mutual labels:  artificial-intelligence, ai, chatbot
Bot Context
Easy, powerful, functional way to maintain conversational context in chat bots.
Stars: ✭ 44 (-69.01%)
Mutual labels:  ai, bots, chatbots
intelligo.js.org
The official website for Intelligo chatbot framework.
Stars: ✭ 18 (-87.32%)
Mutual labels:  bots, chatbot, chatbots
rivescript-java
A RiveScript interpreter for Java. RiveScript is a scripting language for chatterbots.
Stars: ✭ 60 (-57.75%)
Mutual labels:  bots, chatbot, chatbots
Chat-Bot
Chatbot – is a computer program that simulates a natural human conversation. Users communicate with a chatbot via the chat interface or by voice, like how they would talk to a real person.
Stars: ✭ 26 (-81.69%)
Mutual labels:  bots, chatbot, chatbots
Delbot
It understands your voice commands, searches news and knowledge sources, and summarizes and reads out content to you.
Stars: ✭ 191 (+34.51%)
Mutual labels:  ai, chatbot, bots
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+6580.28%)
Mutual labels:  chatbot, bots, chatbots
Awesome Bots
The most awesome list about bots ⭐️🤖
Stars: ✭ 2,864 (+1916.9%)
Mutual labels:  chatbot, bots, chatbots
Chatbot
Python ChatBot 💬
Stars: ✭ 250 (+76.06%)
Mutual labels:  chatbot, bots, chatbots
Poshbot
Powershell-based bot framework
Stars: ✭ 410 (+188.73%)
Mutual labels:  chatbot, bots, chatbots
Convai Bot 1337
NIPS Conversational Intelligence Challenge 2017 Winner System: Skill-based Conversational Agent with Supervised Dialog Manager
Stars: ✭ 65 (-54.23%)
Mutual labels:  ai, chatbot, chatbots

RiveScript-Python

Build Status Read the docs PyPI

Introduction

This is a RiveScript interpreter for the Python programming language. RiveScript is a scripting language for chatterbots, making it easy to write trigger/response pairs for building up a bot's intelligence.

Python 2 EOL Notice

Historically, this library supported both Python 2 and Python 3 until the day that Python 2 entered end-of-life status which happened on January 1, 2020.

The final version with Python 2 support is v1.14.9 which you may still install from PyPI if you need to support a Python2 environment. Going forward, RiveScript releases will target modern, supported releases of the Python 3 language. Today, this means Python 3.6 and newer.

# Python2 last supported version of RiveScript is 1.14.9
pip install rivescript==1.14.9

Documentation

Module documentation is available at http://rivescript.readthedocs.org/

Also check out the RiveScript Community Wiki for common design patterns and tips & tricks for RiveScript.

Installation

This module is available on PyPI and can be installed via pip:

pip install rivescript

To install manually, download or clone the git repository and run python setup.py install

Examples

There are examples available in the eg/ directory of this project on GitHub that show how to interface with a RiveScript bot in a variety of ways--such as through the Twilio SMS API--and other code snippets and useful tricks.

Usage

The rivescript module can be executed as a stand-alone Python script, or included in other Python code. When executed directly, it launches an interactive chat session:

python rivescript ./eg/brain

In case running RiveScript as a script is inconvenient (for example, when it's installed as a system module) you can use the shell.py script as an alias:

python shell.py eg/brain

When used as a library, the synopsis is as follows:

from rivescript import RiveScript

bot = RiveScript()
bot.load_directory("./eg/brain")
bot.sort_replies()

while True:
    msg = raw_input('You> ')
    if msg == '/quit':
        quit()

    reply = bot.reply("localuser", msg)
    print 'Bot>', reply

The scripts example.py and example3.py provide simple examples for using RiveScript as a library for Python 2 and 3, respectively.

UTF-8 Support

RiveScript supports Unicode but it is not enabled by default. Enable it by passing a True value for the utf8 option in the constructor, or by using the --utf8 argument to the standalone interactive mode.

In UTF-8 mode, most characters in a user's message are left intact, except for certain metacharacters like backslashes and common punctuation characters like /[.,!?;:]/.

If you want to override the punctuation regexp, you can provide a new one by assigning the unicode_punctuation attribute of the bot object after initialization. Example:

import re
bot = RiveScript(utf8=True)
bot.unicode_punctuation = re.compile(r'[.,!?;:]')

Regardless of whether UTF-8 mode is on, all input messages given to the bot are converted (if needed) to Python's unicode data type. So, while it's good practice to make sure you're providing Unicode strings to the bot, the library will have you covered if you forget.

JSON Mode

The rivescript package, when run stand-alone, supports "JSON Mode", where you communicate with the bot using JSON. This is useful for third-party programs that want to use RiveScript but don't have an interpreter in their native language.

Just run it like: python rivescript --json /path/to/brain

Print a JSON encoded data structure into the standard input. The format should look like this:

{ "username": "localuser", "message": "Hello bot!", "vars": { "name": "Aiden" } }

After sending this, you can send an EOF signal and the bot will respond with a JSON response and then exit. Or, you can keep the session open, by sending the string __END__ on a line by itself after your input. The bot will do the same when it responds, so you can reuse the same pipe for multiple interactions.

The bot's response will be formatted like so:

{ "status": "ok", "reply": "Hello, human!", "vars": { "name": "Aiden" } }

The status will be ok on success, or error if there was an error. The reply is the bot's response (or an error message on error).

Contributors

License

The MIT License (MIT)

Copyright (c) 2020 Noah Petherbridge

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

SEE ALSO

The official RiveScript website, http://www.rivescript.com/

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].