Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
/telegram_bot/
/rasa_nlu/
__pycache__
.vscode/
logs/
3 changes: 2 additions & 1 deletion NLU_test/nlu_test.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import random
import time
from pathlib import Path

from rasa.nlu.model import Interpreter

def get_model():
model = "/home/sabrina/PycharmProjects/storyteller_DS/rasa_folder/models/nlu"
model = Path(__file__).absolute().parent.joinpath("../rasa_nlu/models/nlu")

interpreter = Interpreter.load(model)
return interpreter
Expand Down
50 changes: 48 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,55 @@ The system is developed and tested using Python 3.7. Some of the libraries requi

## How To

#### Installation
- Create environment with conda/mamba

```bash
conda create -c conda-forge -n storyteller python=3.7
conda activate storyteller
```
- install the requirements `pip install -r requirements.txt`
- reinstall setuptools to avoid an error: `pip install -U pip setuptools`
- set up rasa

```bash
cd storyteller-dialogue-system
rasa init --init-dir rasa_nlu
```

Do not train the default model. Use the specified settings to train the model:

```bash
rasa train nlu --config rasa_nlu/config.yml --nlu rasa_nlu/data/nlu.md --out rasa_nlu/models
```

Untar the trained model under the `rasa_nlu/models`

```bash
cd rasa_nlu/models
tar xvf <model_date-model_time>.tar.gz
```

- download NLTK data. Run in python

```python
import nltk
nltk.download('stopwords')
nltk.download('twitter_samples')
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')
nltk.download('punkt')
```
Move the NLTK data dir under your environment path (optional):

```bash
mv ~/nltk_data /path/to/env/share/nltk_data
```

#### Set up the Telegram interface
- Create a Telegram bot following the steps given by the BotFather bot (you can follow this tutorial: https://core.telegram.org/bots#6-botfather)
- Modify the `credentials.py` file with your bot name and bot token

#### Set up your local machine as server
- Registered to Ngrok from `https://ngrok.com/`
- Go to https://dashboard.ngrok.com/get-started to download the ngrok client
Expand All @@ -26,10 +72,10 @@ The system is developed and tested using Python 3.7. Some of the libraries requi
- Run `./ngrok http 5130`
- If you are using the Telegram web interface, replace the `bot.setWebhook("https://******.ngrok.io/chat")` in `bot_telegram.py` with the https url generated by ngrok (leave the suffix `/chat` at the end)
- If you are using the Alana interface, please follow the Alana instruction on how to send requests to Alana.

#### Set up the application
- Create a virtual environment with Python 3.7
- Install the requirements in `requirements.txt`
- Select which engagement strategy to use: currently the system uses the baseline strategy. To use the Feedback Prompt strategy please comment `line 102` of `bot_telegram.py` and uncomment `line 103` of `bot_telegram.py`

#### Run the application
- Run `bot_telegram.py` to run the system using the Telegram web interface

Expand Down
9 changes: 5 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
rasa~=1.10.1
typing~=3.7.4.1
requests~=2.7.0
rasa~=1.10.26
requests
setuptools~=47.3.1
flask~=1.1.2
flask_restful
Expand All @@ -16,4 +15,6 @@ scikit-learn~=0.22.2.post1
networkx~=2.4
tensorflow~=2.1.1
transformers~=2.11.0
nltk~=3.5
nltk~=3.5
protobuf~=3.20.1
markupsafe~=2.0.1