Skip to content

ArianeDlns/chatbot-presidentielle2022

Repository files navigation

Chatbot Presidentielle 2022

made-with-python Open in Visual Studio Code GitHub commit GitHub issues

Rasa

Chatbot project @CentraleSupélec for the French presidential election of 2022 made with the framework rasa

Installation

Word2vec embedding

Binary model used : frWac_non_lem_no_postag_no_phrase_500_skip_cut100.bin (bin (298Mb) : skip-gram, dim 500, cut 100)

The .bin file must be downloaded and placed in data/word2vec/.

cd actions/data
mkdir word2vec
cd word2vec 
wget https://embeddings.net/embeddings/frWac_non_lem_no_postag_no_phrase_500_skip_cut100.bin

Update credentials

touch credentials.yml
vim credentials.yml     

Update the new credentials.yml following this example

🐳 Build docker image

sudo docker-compose up --build # Build and run containers 
sudo docker-compose down # Stops containers and removes containers 

💡 Tip: Know which containers are up

sudo docker ps -a 

Local deployment without docker

Launch rasa actions

  1. Change PATH (commented in actions/)
  2. Comment sys.path.append('/app/actions') in actions.py
  3. Change endpoint.yml action_endpoint
cd actions
rasa run actions

Launch ngrok

ngrok http 5005
  1. Change credentials.yml webhook_url according to ngrok

Launch rasa

rasa train 
rasa run (or) rasa shell --debug (or) rasa interactive

Usage

This project is only an experimentation for a school project and has therefore no political use. We try to make it as neutral as possible, if any issue is observed please raise an issue.

Telegram chatbot

Telegram

Rasa Architecture

See the implemented architecture:

Telegram

The user interacts with our chatbot via Telegram, which sends the messages to the Rasa NLU via connectors, where it identifies the intent, and responds to the Rasa Core, according to stories and actions. The models used for the conversation were generated by the trainer module and then transferred to the bot; these models can be versioned and evolved between bots.

Structure

├── Dockerfile
├── README.md
├── actions
│   ├── Dockerfile
│   ├── __init__.py
│   ├── actions.py
│   ├── data
│   │   ├── data_candidates
│   │   │   ├── candidates.json
│   │   │   ├── candidates_infos.json
│   │   │   └── propositions.csv
│   │   ├── images
│   │   │   └── candidates
│   │   └── word2vec
│   │       └── frWac_non_lem_no_postag_no_phrase_500_skip_cut100.bin
│   ├── requirements.txt
│   └── utils
│       ├── __init__.py
│       ├── __pycache__
│       ├── candidate_names.py
│       ├── embed_themes.py
│       ├── get_subthemes.py
│       ├── get_themes.py
│       ├── plot_formatting.py
│       ├── scrapping_program.py
│       └── scrapping_sondages.py
├── certs
├── config.yml
├── data
│   ├── nlu
│   │   ├── candidates.yml
│   │   ├── info.yml
│   │   ├── lookups
│   │   │   ├── candidate_names.yml
│   │   │   └── themes.yml
│   │   ├── nlu.yml
│   │   └── poll.yml
│   ├── rules
│   │   └── rules.yml
│   └── stories
│       ├── candidates.yml
│       ├── info.yml
│       ├── poll.yml
│       └── stories.yml
├── docker-compose.yml
├── domain.yml
├── endpoints.yml
├── img
│   ├── exemple.png
│   └── rasa.png
├── models
│   ├── 20220223-101732.tar.gz
│   └── 20220223-105550.tar.gz
├── nginx
│   └── default.conf
├── references
│   └── README.md
├── requirements.txt
└── tests
    ├── test_candidates_stories.yml
    ├── test_info_stories.yml
    ├── test_nlu_stories.yml
    └── test_poll_stories.yml

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

GNU General Public License v3.0

Project status

In development - project deadline: 📆 13 April 22'

References

[1] Yejin Bang and Nayeon Lee and Etsuko Ishii and Andrea Madotto and Pascale Fung, Assessing Political Prudence of Open-domain Chatbots, arXiv preprint arXiv:2106.06157,2021
[2] Miller, A.~H. and Feng, W. and Fisch, A. and Lu, J. and Batra, D. and Bordes, ParlAI: A Dialog Research Software Platform, arXiv preprint arXiv:1705.06476, 2017

Deployment

[3] https://ttt.studio/blog/rasa-chatbot/ (NGINX)

Sources for the programs

[4] Ifrap