Skip to main content

MoodBot is a mood adaptive chatbot that calculates moods from an input statement and generates an response. MoodBot was created as a project for Los Altos Hacks VI.

MoodBot works by finding sentence similarities using Cosine Similarity. The sentenced are tokenized using NLTK to plug into the cosine formula. We then compared already trained input and output statements agianst each other to find matches that are within a specified threshold.

MoodBot when imported, has no pre-trained data. To train MoodBot, you can use it's training functions to train data from .json files. MoodBot finds conversations within the raw message files by finding time proximity between messages and checking for repeat message authors. After a conversation with one input statement and one output statement is created, MoodBot can find the best matching input statement to an output statement using self.response.

Basic Example:

from moodbot import discord_trainer
from moodbot import chatbot
import json

trainer = discord_trainer(token)
raw_data = trainer.query_channel(CHANNEL_ID, limit=10000)
data = []
for message in raw_data:
    data.append({
        'content': message.content,
        'author': message.author_id,
        'timestamp': message.timestamp,
    })

# load into json
with open(f'data/CHANNEL_ID.json', 'w') as file:
    file.write(json.dumps(data, indent=4))

client = chatbot()
client.train('data/CHANNEL_ID')

print(client.response('Hello!').content)

Metadata

Release files for moodbot 1.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moodbot 1.2.1
File Size Uploaded Provenance Actions
moodbot-1.2.1.tar.gz 9.2 kB Without provenance Details for moodbot-1.2.1.tar.gz

Release files / moodbot-1.2.1.tar.gz

Download URL moodbot-1.2.1.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
aad7c0b9a8d784f4f3c12f3da6d0dcbf56098dc3931396d2f78a7b0ac67969ff
BLAKE2b-256 checksum
How to use checksums
70f61d2bfd571f80a363f93f01980165ecab361b9856e95d391b77b0715731a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Security for moodbot 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page