prebot
Bot that can respond to someone asking if you are present in the class. It's not that advanced so please use with caution
Requirements
Python
- Only python3 is supported
Virtual audio cable
- VB-Cable
- Virtual Audio Cable (Vac)
- or any other program that forwards audio from input to output
Python libraries
wave
speech_recognition
wit
pydub
pyaudio
Audio files
For bot to operate you have to record yourself and put it in the data folder. For example hello.mp3
file should be placed in data/responses/presence_check/hello.mp3
Audio files should be in .wav format but if you don't know how to convert them make sure that option PREPROCESS_FILES
is set to yes
in config file
How to run the bot
After providing configuration just execute python main.py
Installation
Downloading and installing requirements
- Download and unpack the bot from here or git clone the repo
pip3 install -r requirements.txt
- if you have troubles installing pyaudio check next section
Pyaudio installation
Windows
- check your python version with
python -V
- Download the wheel on this site https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio
- Choose version that matches your python version for example I use python 3.9 so I will select
PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
- Choose
PyAudio‑0.2.11‑cp39‑cp39‑win32.whl
if you use 32 bit, orPyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
for 64 bit - Then go to your downloads folder
- And install it with pip
- For 64 bit
pip install PyAudio‑0.2.11‑cp39‑cp39‑win_amd64.whl
- For 32 bit
pip install PyAudio‑0.2.11‑cp39‑cp39‑win32.whl
Linux
sudo apt-get install python3-pyaudio
Configuration
To configure the bot you have to create config.ini file. If you don't know how you can take a look at example.config.ini
WIT.AI
- ACCESS_TOKEN - Go to your Wit.ai app Management > Settings and obtain the Client Access Token
- CONFIDENCE_TRESHOLD - The higher you set your Confidence Threshold, the more accurate that Predict’s labeling will be. For example, a threshold of
0.05 is equal to a 95%
confidence threshold.
SPEECH_RECOGNITION
- INPUT_DEVICE_INDEX - Is an integer that represents an Virtual audio cable speakers. If
device_index
is unspecified, the default microphone is used as the audio source - OUTPUT_DEVICE_INDEX - Is an integer that represents an Virtual audio cable microphone. If
device_index
is unspecified, the default microphone is used as the audio source - ADJUST_FOR_AMBIENT_NOISE - Intended to calibrate the energy threshold with the ambient energy level
- LANGUAGE - The recognition language is determined by language, an RFC5646 language tag like
en-US
oren-GB
- NAMES - List of names that people call you
OTHER
- DEBUG - Enables debugging options
- NEVER_PREPROCESS_FILES - Convert files from data/responses to
.wav
format. Works with most of the commonly used formats - KEEP_PROCESSED_FILES - Don't delete files after preprocessing
Wit.ai training
- Go to Wit.ai.
- Create a new Wit.ai app:
- Enter a name e.g. Lessons
- Select Your language
- Select Open or Private for visibility
- Click Create.
- Add an utterance:
- Make sure you are on the Train Your App page by selecting Understanding from the left-hand menu.
- Type Are you here Elon? into the Utterance text box.
- Label an entity in the utterance by highlighting Elon with your mouse and select
wit/contact
as the Entity type.
- Add an intent
- Click on the Intent dropdown.
- Enter presence_check as the name of your new Intent.
- Click Create Intent.
- Submit your first utterance by clicking Train and Validate. The training should start within a few seconds - you can see the training status in the top right.
Replace Elon with your name