Skip to main content

Provide information for related metadata

Project description

Ingest corpuses of text and output a sentence generated from markov chains

Installation

After installing and configuring helga, use:

pip install helga-markovify

Add markovify to your settings and restart helga. To use twitter timelines, you must also add the following to settings (with your credentials):

TWITTER_CONSUMER_KEY = 'asad'
TWITTER_CONSUMER_SECRET = 'sdfs'
TWITTER_ACCESS_TOKEN = 'fghf'
TWITTER_ACCESS_SECRET = 'ghjg'

Usage

Note: Please use punctuation in your text. This is a tough sticking point in practice, but it is important to be able to differentiate sentences.

Command syntax:

ingest <topic> <learning_type> <learning_type_source>
generate <topic>
drop <topic>

Arguments:

topic: like tagging, so helga can respond in different ways
learning_type: how helga is going to ingest. Can be text, a url to raw data,
a url to dpaste, or a twitter account.
learning_type_source: the corresponding data e.g. plaintext if learning_type
is "text", a url if "url", twitter screen name if "twitter"

The ingest command teaches the bot about the topic from the referenced corpus. You may teach the bot from any number of sources, it can be twitter or text. Mix and matching is fine.

The generate command generates a sentence from the corpus.

The drop command drops a particular topic from storage. If a corpus becomes corrupt for whatever reason, a user may drop it and re-ingest data to populate it again.

Examples

The following are different ways you may usage helga-markovify. Most are different ways to ingest/learn data.

URL

!markovify ingest zen url https://hg.python.org/peps/raw-file/tip/pep-0020.txt
!markovify generate zen
helga> Sparse is better than ugly.

Text

!markovify ingest hitler text "Mein Kampf is the best Kampf."
!markovify ingest hitler text "Don't be stupid, be a smarty. Come and join the nazi party."
!markovify ingest hitler text "Make America hate again."
!markovify ingest hitler text "Kampf America is hate nazi smarty. Hate party again filler sentence. America is the best at being terrible."
!markovify generate hitler
helga> Mein Kampf is the best at being terrible.

dpaste

!markovify ingest zen dpaste http://dpaste.com/1JF2P4S
!markovify generate zen
helga> If the implementation is hard to explain, it may be a good idea.

Twitter

!markovify ingest narf twitter narfman0
!markovify generate narf
helga> You won't believe this one weird trick to get the target populace hooked.
!markovify generate narf
helga> FOSS: it only takes one highly incentivized dealer to get 4057$ a month doing nothing!

Drop corpus

If you have somehow screwed up or broken a corpus, you may drop it completely:

!markovify drop zen

TODO

  • Generate default data from channel

  • Add settings for max corpus count, max corpus length

  • Travis

  • Talk about specific topics

  • Keep history aka conversations

  • Weighted round-robin type conversation, e.g. trump vs jesus vs samuel l jackson vs kim jong un

License

Copyright (c) 2016 Jon Robison

See included LICENSE for licensing information

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

helga-markovify-1.0.9.tar.gz (67.5 kB view hashes)

Uploaded source

Supported by

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