duck-dynasty / duckbot

A Discord bot for personal friend group
GNU General Public License v3.0
9 stars 10 forks source link

Have duckbot mimic a given user #119

Open twentylemon opened 3 years ago

twentylemon commented 3 years ago

We have a database now. Let's use it.

For each user, we can break down messages as they come in to build their transition matrix over time, storing the matrix in the database. So, if a human says I like food very much, we could store the n-grams I like food, like food very and food very much, or whatever n we want. Naturally larger n builds better sentences, but our data is likely to be fewer words in general, plus we do have to store it all.

Then, with those transition tables, we could have a command to mimic a given user.

Human: !markov @AnotherHuman DuckBot: Some markov chain nonsense using AnotherHuman data!

We could also have additional arguments to !markov, like a starting point for the sentence to generate, or how many words to generate.

Chippers255 commented 3 years ago

I would also like to see the idea of seeding the markov chain with the !markov command. Such as !markov @human guys, today I learned that...

twentylemon commented 3 years ago

nltk has ngrams which we can use, we already use nltk as a dependency

http://www.nltk.org/api/nltk.html#nltk.util.ngrams

twentylemon commented 3 years ago

Also relevant reading: https://softwareengineering.stackexchange.com/questions/64288/storing-n-gram-data

twentylemon commented 3 years ago

https://github.com/Chippers255/channel_police/blob/main/extract.py is some code to fetch channel history, for the initial building of the markov transition matrices

twentylemon commented 1 year ago

See #701 for a preferable approach to markov chains

Chippers255 commented 1 year ago

This has a lot of potential. image