Skip to main content

A Python package for creating chatbot.

Project description

sen-chatbot

Python Package for Chatbot

How to import

from sen_chatbot.ChatBot import ChatBot

How to use

cb = ChatBot()

ChatBot Initialized in cb

reply(user_query_string) function

cb.reply('hi')

gives reply based on the given string and data which is set

'Hi there'

quickReply(user_query_string) function

cb.quickReply('hi')

same as reply(argument) but returns faster. Recommended in case of huge data.

'Hello'

In case of reply(argument) when any of the input strings is found to be a subset of the given argument then it will consider it and show anyone of the matching results randomly. In case of quickReply(argument) it will only show the result which is fully matching with the given argument and it returns a response immediately once it finds a match.

Adding Data

input_list = ['new user','do not have account']

output_list = ['register','create one!']

running addData(input_list,output_list) using input_list and output_list

cb.addData(input_list,output_list)

Two lists must be passed as inputs and respective outputs.

cb.reply('new user')

output

'register'

If any of the inputs matches with the argument of reply(argument) function then it returns a response among the outputs randomly.

Set or Reset Data

data = {'1':{'input':['hi','hello'],'output':['hello']},'2':{'input':['bye'],'output':['goodbye','tata']}}

running setData(data) using data as argument

cb.setData(data)

The data should be in given dictionary format.

cb.showData()

output

{'1': {'input': ['hi', 'hello'], 'output': ['hello']}, '2': {'input': ['bye'], 'output': ['goodbye', 'tata']}}

cb.quickReply('bye')

output

'tata'

In case of adding or setting data try to keep the proper format. Previously some data is set for basic use but we can customize it according to our needs.

Showing data

cb.showData()

output

{'1': {'input': ['hi', 'hello'], 'output': ['hello', 'hi there']}, '2': {'input': ['bye'], 'output': ['goodbye', 'tata']}}

In case of setData(dict_data) you need to pass a dictionary in the above format.

wikipedia feature

cb.reply('Sourav Ganguly')

output

'Sourav Chandidas Ganguly ( (listen); born 8 July 1972), affectionately known as Dada (meaning "elder brother" in Bengali), is an Indian former cricketer, commentator and administrator who played as a left-handed opening batsman and was captain of the Indian national team. He is the 39th and current president of the Board of Control for Cricket in India and President of the Editorial Board with Wisden India...

Wikipedia summery will be shown as a result

It shows wikipedia results as a default output and by default wikipedia feature is enabled. If you want to disable it you can do it this way.

cb.enableWikipedia(False)

If you pass True as an argument then it will be enabled again.

cb.reply('Sourav Ganguly')

output

'Try something else...'

Showing default results

cb.quickReply('Sourav Ganguly')

default output

"I am sorry! I did't understand you"

Developer info

cb.authorName()

'Sourav Sen'

cb.authorEmail()

'bubai666sen@gmail.com'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sen-chatbot-1.0.2.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

sen_chatbot-1.0.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file sen-chatbot-1.0.2.tar.gz.

File metadata

  • Download URL: sen-chatbot-1.0.2.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3

File hashes

Hashes for sen-chatbot-1.0.2.tar.gz
Algorithm Hash digest
SHA256 eccda838964d7da60e6642e417f600264c4da3abca3bb20a232873d530d8f5a3
MD5 0a66f4225fdedbd7c94d4d941f2129ba
BLAKE2b-256 45cb600d0907c9430bac0f6fd535b8a5b286ab9b39127e45eb02f021f3c86692

See more details on using hashes here.

File details

Details for the file sen_chatbot-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: sen_chatbot-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.7.3

File hashes

Hashes for sen_chatbot-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b68060e8a01815f2855c1f3e7fc9c83b8ac84dde613edc5e44d39be7e1c7c256
MD5 2ceeb157c0bb13cd8dc0e299d1d02f68
BLAKE2b-256 a902c079b6629203352f0f04d0fabb4ed9e432a9d7bd28478d96c9355b23a247

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page