Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
Hailo is a Markov chatterbot inspired by MegaHAL.
It is actually a port of the eponymous Hailo Perl module.
The difference being that this one's written in Crystal, consists of less code, runs faster, and uses less memory. It also drops support for multiple storage engines, sticking with SQLite only.
First, install Crystal along with
libsqlite3-dev
and libreadline-dev
. Then do:
git clone https://github.com/hailo/hailo.cr.git
cd hailo.cr
shards install
crystal build bin/hailo-cr.cr --release
This gives you a hailo-cr
binary that you can run.
Use the command line interface (hailo-cr
), or use Hailo in your code:
require "hailo"
hailo = Hailo.new("test.sqlite")
puts hailo.learn_and_reply("oh hi there")
See the API documentation for more information.
Running the tests is simple:
crystal spec
If you've saved a brain file with hailo-cr --brain whatever.brain
, you can
easily inspect it since it's just a SQLite file:
sqlite3 whatever.brain
sqlite> .schema
sqlite> select * from token limit 10;
You can ask a question in the issue tracker, email me at hinrik.sig@gmail.com, or hit me up on FreeNode (#hailo).
Pull requests are welcome.
hailo.cr is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
hailo.cr is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
See COPYING
for the complete license.