• Stars
    star
    182
  • Rank 210,356 (Top 5 %)
  • Language
    PHP
  • Created almost 10 years ago
  • Updated almost 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A Mono/.NET, JAVA, Python and PHP chatter bot API that supports Cleverbot, JabberWacky and Pandorabots.

Chatter Bot API

A Mono/.NET, JAVA, Python and PHP chatter bot API that supports Cleverbot, JabberWacky and Pandorabots.

For a Ruby version, have a look at Gabriele Cirulli cleverbot-api implementation.

If you are planing using the .NET version, maybe this fork by Schumix is worth looking at.

News

2017-02-13: This project's v2 branch is an in progress refactor/cleanup effort. For now I have a working Java version that uses the new Cleverbot official API. No code breaking changes were required, except that you will now need an API Key when calling factory.create(ChatterBotType.CLEVERBOT, "YOURAPIKEY").

2017-01-04: Folks at Existor (the company behind Cleverbot) have concerns because this project goes against their terms of usage. Indeed, their service costs money (to host their huge servers for example) and this project allows users to bypass their ads. I acknowledged that this project does not makes a fair use of their service. I would be the first to be mad if someone would make an unfair use of one of my project, so I understand their positions. We agreed on this: this project will send a parameter on each request that will uniquely identify the project itself. They will collect metrics, and let the project alone if they found that the project usage does not make a big difference for them.

2015-09-21: Thanks to S.R, the python version is now also compatible with python 3.

2014-10-17: Merged a bunch of nicely arranged pull requests sent by Csaba Jakosa. Those include works done by Christian Gärtner (for the PHP version), and Arnaud Aliès (for the Python version).

2014-10-11: Moved to GitHub!

2014-08-04: The Java version is now on The Maven Central Repository. This is a request I get from time to time. I was too lazy to do it until now. But this time a user was kind enough, so I kick myself and did it (thanks Hardik!). Just add this dependency to your pom file.

2014-03-31: Cleverbot seems to stops working from time to time. You should expect it to be really unstable until I find a fix.

2014-02-02: Cleverbot stops working. Thanks to Matthew to let me know.

2013-11-15: Cleverbot stops working, they changed their API again. I am working on this.

2013-08-29: There is a bug with Cleverbot in any language right now. I will fix it as soon as possible. A bug with Cleverbot is now fixed in the new 1.3 revision release. Enjoy! (Kevin, Alienmario, Rai: Thanks to you guys for letting me know)

Download

I encourage you to download a compiled version of the library (TBA), and try the example below in this page. I tried to keep all the libraries free from dependencies, so you do not need to download anything else.

Be sure to always use the latest version of the library, as the Cleverbot/JabberWacky Web Service is changing over time. I suppose it is not meant to be public.

Maven

Just add this dependency to your pom file:

<dependency>
    <groupId>ca.pjer</groupId>
    <artifactId>chatter-bot-api</artifactId>
    <version>1.4.7</version>
</dependency>

Going further

If you like what you see, browse and comment the source code. If you found a bug or something missing, consult the Issues section before posting a new defect or a new enhancement. Also I will gladly accept Pull Requests

Disclaimer

I am not the owner of Cleverbot/JabberWacky nor Pandorabots.

My work (the Cleverbot/JabberWacky part) is based on pycleverbot, a Python bindings for the Cleverbot.

Contact

You can also let me know what you think.

Examples

Mono/.NET C#

using System;

using ChatterBotAPI;

namespace ChatterBotAPITest {
        
        class MainClass {
                
                public static void Main(string[] args) {
                        ChatterBotFactory factory = new ChatterBotFactory();
                        
                        ChatterBot bot1 = factory.Create(ChatterBotType.CLEVERBOT);
                        ChatterBotSession bot1session = bot1.CreateSession();
                        
                        ChatterBot bot2 = factory.Create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
                        ChatterBotSession bot2session = bot2.CreateSession();
                        
                        string s = "Hi";
                        while (true) {
                                
                                Console.WriteLine("bot1> " + s);
                                
                                s = bot2session.Think(s);
                                Console.WriteLine("bot2> " + s);
                                
                                s = bot1session.Think(s);
                        }
                }
        }
}

Mono/.NET VB

Imports ChatterBotAPI

Public Class Application

        Public Shared Sub Main()
                Dim factory As ChatterBotFactory = new ChatterBotFactory()
                
                Dim bot1 As ChatterBot = factory.Create(ChatterBotType.CLEVERBOT)
                Dim bot1session As ChatterBotSession = bot1.CreateSession()
                
                Dim bot2 As ChatterBot = factory.Create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477")
                Dim bot2session As ChatterBotSession = bot2.CreateSession()
        
                Dim s As String = "Hi"
                Do While true
                
                        Console.WriteLine("bot1> " + s)
                        
                        s = bot2session.Think(s)
                        Console.WriteLine("bot2> " + s)
                                
                        s = bot1session.Think(s)
                Loop
        End Sub
End Class

JAVA

package com.google.code.chatterbotapi.test;

import com.google.code.chatterbotapi.*;

public class ChatterBotApiTest {
    
    public static void main(String[] args) throws Exception {
        ChatterBotFactory factory = new ChatterBotFactory();

        ChatterBot bot1 = factory.create(ChatterBotType.CLEVERBOT);
        ChatterBotSession bot1session = bot1.createSession();

        ChatterBot bot2 = factory.create(ChatterBotType.PANDORABOTS, "b0dafd24ee35a477");
        ChatterBotSession bot2session = bot2.createSession();

        String s = "Hi";
        while (true) {

            System.out.println("bot1> " + s);

            s = bot2session.think(s);
            System.out.println("bot2> " + s);

            s = bot1session.think(s);
        }
    }
}

Python

from chatterbotapi import ChatterBotFactory, ChatterBotType

factory = ChatterBotFactory()

bot1 = factory.create(ChatterBotType.CLEVERBOT)
bot1session = bot1.create_session()

bot2 = factory.create(ChatterBotType.PANDORABOTS, 'b0dafd24ee35a477')
bot2session = bot2.create_session()

s = 'Hi'
while (1):
    
    print 'bot1> ' + s
    
    s = bot2session.think(s);
    print 'bot2> ' + s
    
    s = bot1session.think(s);

PHP

<?php
    require 'chatterbotapi.php';
    
    $factory = new ChatterBotFactory();
    
    $bot1 = $factory->create(ChatterBotType::CLEVERBOT);
    $bot1session = $bot1->createSession();
    
    $bot2 = $factory->create(ChatterBotType::PANDORABOTS, 'b0dafd24ee35a477');
    $bot2session = $bot2->createSession();
    
    $s = 'Hi';
    while (1) 
    {
        echo "bot1> $s\n";
        
        $s = $bot2session->think($s);
        echo "bot2> $s\n";
        
        $s = $bot1session->think($s);
    }
?>

More Repositories

1

logback-awslogs-appender

An Amazon Web Services (AWS) Logs (CloudWatch) appender for Logback
Java
73
star
2

raftman

A syslog server with integrated full text search via a JSON API and Web UI
Go
45
star
3

ekmeans

A Java K-means Clustering implementation
Java
22
star
4

JsonDB

A simple in process database to store, query and manipulate JSON documents for OS X and iOS
Objective-C
15
star
5

githubappcaster

Publish GitHub repository releases as Sparkle compatible appcast.xml
Java
14
star
6

parseclient

A Parse Java Client
Java
7
star
7

jdbi-spring-boot-starter

This is a Spring Boot Starter for auto creating Jdbi and SqlObject
Java
7
star
8

apparticle

A Mac OS X particle editor for and with Cocos2D
Objective-C
6
star
9

parse-spring-boot

Parse Spring Boot integration
Java
6
star
10

parcel-plugin-appcache

Parcel plugin for generating an appcache manifest
JavaScript
4
star
11

spring-rabbitmq-tutum

Fun with Docker, Java, Spring Boot, Maven, RabbitMQ and Tutum
Java
4
star
12

jesque-cli

A CLI for Jesque, an implementation of Resque in Java
Java
3
star
13

iam-spring-boot-starter

Spring Boot Starter for authentication and authorization
Java
3
star
14

AlgObjc

Objective-C wrapper for xtaci/algorithms's Grid/AStar and Graph/Dijkstra
C
1
star
15

iam

Code repository of useful bits of Go code related to authentication, identification, jwt, session
Go
1
star
16

sqlper

A Java SQL helper library to map POJO to/from PreparedStatement/ResultSet
Java
1
star
17

auto-compose

Auto docker-compose from Consul KV
Shell
1
star
18

basic-auth-forward-proxy

Shell
1
star
19

parcel-html-test

JavaScript
1
star