tommeagher / heroku_ebooks

An archive of a script to generate Markov chains and to post to an _ebooks account on Twitter using Heroku. No longer actively supported.
264 stars 163 forks source link

Adapting the code for tweets in other languages. #71

Closed monpragodev closed 1 year ago

monpragodev commented 4 years ago

Hello! I created a bot following the steps and it's working flawlessly, but the 99,9% of the time it tweets nonsense. I think it's because the tweets I'm using are in spanish, and the code is intended for text in english and its grammar. I want to adapt my bot to my needs. I know about programming, but not enough to know what files I need to retouch in this case. What should I change in my side of the code to make my bot full adapted to spanish?

tommeagher commented 4 years ago

Mónica, I'm glad you're interested in this. The tweets are supposed to be nonsense, but I think I know what you mean. :) I hadn't thought about how Markov chains would work in other languages. Most of what you'll want to tinker with is in here: https://github.com/tommeagher/heroku_ebooks/blob/master/markov.py If I remember correctly, it basically makes a list of every word in the corpus and then every word that immediately follows it. It picks a random word, then picks a random second word associated with it and then a random second word associated with that and on and on. Take a look and give it a try and let me know if I can help. If you get it working, I'd be open to merging a PR with support for Spanish.

monpragodev commented 4 years ago

Thank you for the response! I know the bot is mostly nonsense, but I thought it could be have a little more sense tuning the code specifically for a language, because each language have its own rules in terms of grammar. Every now and then it tweets something grammarly correct, but it's very rare. Maybe it can be improved a bit knowing how the code works. I'll investigate further and let you know if I achieve something!

tommeagher commented 4 years ago

That'd be great. Would love to see what you come up with. Good luck!

tommeagher commented 1 year ago

Archiving this repo and closing this issue