From eb904aaa7406fb4c47db05db459623ca3b907d6a Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Sat, 6 Feb 2021 16:44:16 +0100 Subject: [PATCH 01/29] Added conversation_simple.svg --- assets/conversation_simple.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/conversation_simple.svg diff --git a/assets/conversation_simple.svg b/assets/conversation_simple.svg new file mode 100644 index 0000000..728d233 --- /dev/null +++ b/assets/conversation_simple.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 9c216b81f2c40dab8c710a3114c9be6a7750cc45 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Sat, 6 Feb 2021 16:46:23 +0100 Subject: [PATCH 02/29] Update conversation_simple.svg --- assets/conversation_simple.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/conversation_simple.svg b/assets/conversation_simple.svg index 728d233..4bc7af6 100644 --- a/assets/conversation_simple.svg +++ b/assets/conversation_simple.svg @@ -1,3 +1,3 @@ - \ No newline at end of file +
Bonjour, je voudrais réserver une chambre
Bonjour, je voudrais réserver une chambre
Bonjour, combien de personnes ?
Bonjour, combien de personnes ?
3
3
Combien de nuits ?
Combien de nuits ?
2
2
Reservation effectuée, bonne journée !
Reservation effectuée, bonne journée !
Viewer does not support full SVG 1.1
\ No newline at end of file From 9bf6b516ad06481cc2109faa33abdb8517b82c2e Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Sun, 7 Feb 2021 02:56:59 +0100 Subject: [PATCH 03/29] Deployment files added back --- .travis.yml | 26 +++++++++++++++++ Dockerfile | 29 +++++++++++++++++++ LICENSE | 21 ++++++++++++++ README.md | 80 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 .travis.yml create mode 100644 Dockerfile create mode 100644 LICENSE create mode 100644 README.md diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..505ebf2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,26 @@ +branches: + only: + - master + - frontend + +language: python +python: + - 3.8 +services: + - docker + +install: + - pip install -r requirements.txt + +before_script: + - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin + +script: + - docker build -t joffreybvn/resa-chatbot:latest . + +deploy: + provider: script + script: + docker push joffreybvn/resa-chatbot:latest; + on: + branch: master \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4c3fa87 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ + +FROM python:3.8-slim-buster + +# Install the security updates. +RUN apt-get update +RUN apt-get -y upgrade + +# Dependencies to build requires packages +RUN apt-get -y install gcc + +# Remove all cached file. Get a smaller image. +RUN apt-get clean +RUN rm -rf /var/lib/apt/lists/* + +EXPOSE 3978 + +# Copy the application. +COPY . /opt/app +WORKDIR /opt/app + +# Install the app librairies. +RUN pip install -r requirements.txt + +# Install SpaCy small model +RUN python -m spacy download en_core_web_sm + +# Start the app. +ENTRYPOINT [ "python" ] +CMD [ "main.py" ] \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..69d5e44 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2021 Joffrey Bienvenu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..63a9fee --- /dev/null +++ b/README.md @@ -0,0 +1,80 @@ +# chatbot + + + + + +## Cross-plateforme implementation + + +## fonctionnalités du Bot : + +### Traitement des inputs "utilisateurs" + +- Bert ? + +### Possible réponses + +- Accueillire + - Décrire les fonctionnalités du bot + - Répondre +- Donner les heures d'ouvertures +- Afficher une liste d'objet, de produit + +### Nice to have + +- Réserver un service / un produit + - Gérer un agenda + - vérifier la disponibilité + - +- + + "**In English**, the bot should be able to :\n", + "\n", + "- Understand phrases related to a room reservation.\n", + "Example that the bot will have to understand: \n", + "\n", + "\t\t> I wish to reserve a room for 2 people.\n", + "\t\t> I wish to reserve a room for 4 days\n", + "\t\t> Do you have rooms available from July 23rd?\n", + "\t\t> I would like to reserve a room for two days and for two people\n", + "\n", + "- Understand phrases related to a table reservation for the restaurant. \n", + "\n", + "\t\t> I would like to make a reservation for tonight.\n", + "\t\t> I'd like to reserve a table for four people.\n", + "\n", + "- Must ensure a continuous and ongoing conversation. Example of a complete conversation : \n", + "\n", + "\t\t> Customer : Hello !\n", + "\t\t> Bot : Hello, how can I help you? \n", + "\t\t> Customer: I would like to reserve a table for 4 people ? \n", + "\t\t> Bot : For which date would you like to reserve your table?\n", + "\t\t> Customer : Today at 7:00 pm\n", + "\t\t> Bot : What name should I make the reservation under?\n", + "\t\t> Customer : My name is Mr. Dupont! \n", + "\t\t> Bot : Very well Mr Dupont, I confirm you the reservation of a table for 4 people tonight at 7:00 pm. \n", + "\t\t> Bot : Can I help you with something else?\n", + "\t\t> Customer : No thanks\n", + "\t\t> Bot: Have a nice day. \n", + "\n", + "- Understand when the client is angry. In this case, the bot will indicate that it is transmitting the conversation to a human. \n", + "\n", + "\t\t> You're incompetent!\n", + "\t\t> My room is dirty! This is outrageous!\n", + "\t\t> I want to talk to a human. \n", + "\n", + "### Nice-to-have features\n", + "- Create an API of your bot to make it cross-platform \n", + "- Use Docker\n", + + + + +## Hébergement du Bot + +Timeline: +- Etablir l'objectif (déployer bot cross-plateforme + créer propre modele) +- Trouver un framework >> MSBotFramework +- Créer un dataset +- Deployer dummy bot \ No newline at end of file From 6fb97a1555bc191f7da84755bbfe34aaf05faaa0 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 11:07:41 +0100 Subject: [PATCH 04/29] Added project_timeline.svg --- assets/project_timeline.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/project_timeline.svg diff --git a/assets/project_timeline.svg b/assets/project_timeline.svg new file mode 100644 index 0000000..0d4eb93 --- /dev/null +++ b/assets/project_timeline.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From e4896a6bdd8499e8dcb73c6a9748f6aea74ed65e Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 12:57:59 +0100 Subject: [PATCH 05/29] Update project_timeline.svg --- assets/project_timeline.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/project_timeline.svg b/assets/project_timeline.svg index 0d4eb93..aa75ad0 100644 --- a/assets/project_timeline.svg +++ b/assets/project_timeline.svg @@ -1,3 +1,3 @@ - \ No newline at end of file +
Day 1
Day 1
Day 2
Day 2
Day 3
Day 3
Day 4
Day 4
Advanced dialog
implementation
Advanced dialog...
Definition of the objectives
Definition of th...
Search for libraries
 and experimentation
Search for libraries...
Dataset
creation
Dataset...
Dummy bot
deployment
Dummy bot...
Fine-tuning
BERT model
Fine-tuning...
Simple dialog
implementation
Simple dialog...
NLU preprocess
pipeline
implementation
NLU preprocess...
Viewer does not support full SVG 1.1
\ No newline at end of file From b672cc8ab1216133e0a51288a2bd1b0637d62367 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 13:03:13 +0100 Subject: [PATCH 06/29] Update project_timeline.svg --- assets/project_timeline.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/project_timeline.svg b/assets/project_timeline.svg index aa75ad0..5cfb102 100644 --- a/assets/project_timeline.svg +++ b/assets/project_timeline.svg @@ -1,3 +1,3 @@ -
Day 1
Day 1
Day 2
Day 2
Day 3
Day 3
Day 4
Day 4
Advanced dialog
implementation
Advanced dialog...
Definition of the objectives
Definition of th...
Search for libraries
 and experimentation
Search for libraries...
Dataset
creation
Dataset...
Dummy bot
deployment
Dummy bot...
Fine-tuning
BERT model
Fine-tuning...
Simple dialog
implementation
Simple dialog...
NLU preprocess
pipeline
implementation
NLU preprocess...
Viewer does not support full SVG 1.1
\ No newline at end of file +
Day 1
Day 1
Day 2
Day 2
Day 3
Day 3
Day 4
Day 4
Advanced dialog
implementation
Advanced dialog...
Definition of the objectives
Definition of th...
Search for libraries
 and experimentation
Search for libraries...
Dataset
creation
Dataset...
Dummy bot
deployment
Dummy bot...
Fine-tuning
BERT model
Fine-tuning...
Simple dialog
implementation
Simple dialog...
NLU preprocess
pipeline
implementation
NLU preprocess...
Final deployment
Final deploym...
Day 5
Day 5
Viewer does not support full SVG 1.1
\ No newline at end of file From 0ab75c18bcc7ff67b311b0c5a2d7231b0490dbf6 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 13:18:59 +0100 Subject: [PATCH 07/29] Update project_timeline.svg --- assets/project_timeline.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/project_timeline.svg b/assets/project_timeline.svg index 5cfb102..c15f1c0 100644 --- a/assets/project_timeline.svg +++ b/assets/project_timeline.svg @@ -1,3 +1,3 @@ -
Day 1
Day 1
Day 2
Day 2
Day 3
Day 3
Day 4
Day 4
Advanced dialog
implementation
Advanced dialog...
Definition of the objectives
Definition of th...
Search for libraries
 and experimentation
Search for libraries...
Dataset
creation
Dataset...
Dummy bot
deployment
Dummy bot...
Fine-tuning
BERT model
Fine-tuning...
Simple dialog
implementation
Simple dialog...
NLU preprocess
pipeline
implementation
NLU preprocess...
Final deployment
Final deploym...
Day 5
Day 5
Viewer does not support full SVG 1.1
\ No newline at end of file +
Day 1
Day 1
Day 2
Day 2
Day 3
Day 3
Day 4
Day 4
Advanced dialog
implementation
Advanced dialog...
Definition of the objectives
Definition of th...
Search for libraries
 and experimentation
Search for libraries...
Dataset
creation
Dataset...
Dummy bot
deployment
Dummy bot...
Fine-tuning
BERT model
Fine-tuning...
Simple dialog
implementation
Simple dialog...
NLU preprocess
pipeline
implementation
NLU preprocess...
Final deployment
Final deploym...
Day 5
Day 5
Viewer does not support full SVG 1.1
\ No newline at end of file From 56bd31ee3ddb3a3af6dccddfb9af831b28dddf73 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 13:26:01 +0100 Subject: [PATCH 08/29] Added bot_dialogflow.svg --- assets/bot_dialogflow.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/bot_dialogflow.svg diff --git a/assets/bot_dialogflow.svg b/assets/bot_dialogflow.svg new file mode 100644 index 0000000..f0d8632 --- /dev/null +++ b/assets/bot_dialogflow.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 3cdadfc34dfa20018090bdbd9a574738b410c1ca Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 13:50:08 +0100 Subject: [PATCH 09/29] Update bot_dialogflow.svg --- assets/bot_dialogflow.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/bot_dialogflow.svg b/assets/bot_dialogflow.svg index f0d8632..743d120 100644 --- a/assets/bot_dialogflow.svg +++ b/assets/bot_dialogflow.svg @@ -1,3 +1,3 @@ - \ No newline at end of file +
I want to book a
room for tonight
I want to book a...
Azure
API
Azure...
Intent + keywords
Intent + keywords
NLU
NLU
Preprocessing
Preprocessing
Classifying
Classifying
Matching
Matching
Dispatch to
dialog
Dispatch to...
Return pre-written
response
Return pre-written...
How many people ?
How many people ?
Viewer does not support full SVG 1.1
\ No newline at end of file From 2de2fc2167ab34c738564422aa21d5c806f61d71 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 14:00:40 +0100 Subject: [PATCH 10/29] Update bot_dialogflow.svg --- assets/bot_dialogflow.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/bot_dialogflow.svg b/assets/bot_dialogflow.svg index 743d120..b346524 100644 --- a/assets/bot_dialogflow.svg +++ b/assets/bot_dialogflow.svg @@ -1,3 +1,3 @@ -
I want to book a
room for tonight
I want to book a...
Azure
API
Azure...
Intent + keywords
Intent + keywords
NLU
NLU
Preprocessing
Preprocessing
Classifying
Classifying
Matching
Matching
Dispatch to
dialog
Dispatch to...
Return pre-written
response
Return pre-written...
How many people ?
How many people ?
Viewer does not support full SVG 1.1
\ No newline at end of file +
I want to book a
room for tonight
I want to book a...
Azure
API
Azure...
Intent + keywords
Intent + keywords
NLU
NLU
Preprocessing
Preprocessing
Classifying
Classifying
Matching
Matching
Dispatch to
dialog
Dispatch to...
Return pre-written
response
Return pre-written...
How many people ?
How many people ?
Viewer does not support full SVG 1.1
\ No newline at end of file From 2ca847f57d7e35c940495d9138fc1d18d699d9ac Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 14:00:44 +0100 Subject: [PATCH 11/29] Update bot_dialogflow.svg --- assets/bot_dialogflow.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/bot_dialogflow.svg b/assets/bot_dialogflow.svg index b346524..997708b 100644 --- a/assets/bot_dialogflow.svg +++ b/assets/bot_dialogflow.svg @@ -1,3 +1,3 @@ -
I want to book a
room for tonight
I want to book a...
Azure
API
Azure...
Intent + keywords
Intent + keywords
NLU
NLU
Preprocessing
Preprocessing
Classifying
Classifying
Matching
Matching
Dispatch to
dialog
Dispatch to...
Return pre-written
response
Return pre-written...
How many people ?
How many people ?
Viewer does not support full SVG 1.1
\ No newline at end of file +
I want to book a
room for tonight
I want to book a...
Azure
API
Azure...
Intent + keywords
Intent + keywords
NLU
NLU
Preprocessing
Preprocessing
Classifying
Classifying
Matching
Matching
Dispatch to
dialog
Dispatch to...
Return pre-written
response
Return pre-written...
How many people ?
How many people ?
Viewer does not support full SVG 1.1
\ No newline at end of file From 355ef88f603937fa08823243ee993c1cb4b8e408 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 14:03:26 +0100 Subject: [PATCH 12/29] Added cross_platform.svg --- assets/cross_platform.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/cross_platform.svg diff --git a/assets/cross_platform.svg b/assets/cross_platform.svg new file mode 100644 index 0000000..fb62e7a --- /dev/null +++ b/assets/cross_platform.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From b3f1471f3a6e76687751ed34c37acc09858d2c4b Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 14:13:44 +0100 Subject: [PATCH 13/29] Update cross_platform.svg --- assets/cross_platform.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/cross_platform.svg b/assets/cross_platform.svg index fb62e7a..b14fe7f 100644 --- a/assets/cross_platform.svg +++ b/assets/cross_platform.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + \ No newline at end of file From b4fe122f3e3365b6d31ed2fe4fbdf8f734793fc9 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 14:15:08 +0100 Subject: [PATCH 14/29] Update cross_platform.svg --- assets/cross_platform.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/cross_platform.svg b/assets/cross_platform.svg index b14fe7f..c6ffcd1 100644 --- a/assets/cross_platform.svg +++ b/assets/cross_platform.svg @@ -1,3 +1,3 @@ - \ No newline at end of file + \ No newline at end of file From 117fa344c968f27afb1dbca1b6f440685d64113f Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 18:03:44 +0100 Subject: [PATCH 15/29] README.md updated --- README.md | 16 +++++++++++++++- assets/{ => images}/bot_dialogflow.svg | 0 assets/{ => images}/conversation_simple.svg | 0 assets/{ => images}/cross_platform.svg | 0 assets/{ => images}/project_timeline.svg | 0 5 files changed, 15 insertions(+), 1 deletion(-) rename assets/{ => images}/bot_dialogflow.svg (100%) rename assets/{ => images}/conversation_simple.svg (100%) rename assets/{ => images}/cross_platform.svg (100%) rename assets/{ => images}/project_timeline.svg (100%) diff --git a/README.md b/README.md index 63a9fee..c02a556 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,20 @@ -# chatbot +# Resa Chatbot +A cross-platform chatbot based on MS Bot Framework and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be) ! +### Project timeline + +

+ +

+ +This project was completed in 5 days by two Machine Learning students from BeCode: + - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) + - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) + +### Techs and libraries used + +The efficient implementation of our solution relies on a plethora of solid libraries: diff --git a/assets/bot_dialogflow.svg b/assets/images/bot_dialogflow.svg similarity index 100% rename from assets/bot_dialogflow.svg rename to assets/images/bot_dialogflow.svg diff --git a/assets/conversation_simple.svg b/assets/images/conversation_simple.svg similarity index 100% rename from assets/conversation_simple.svg rename to assets/images/conversation_simple.svg diff --git a/assets/cross_platform.svg b/assets/images/cross_platform.svg similarity index 100% rename from assets/cross_platform.svg rename to assets/images/cross_platform.svg diff --git a/assets/project_timeline.svg b/assets/images/project_timeline.svg similarity index 100% rename from assets/project_timeline.svg rename to assets/images/project_timeline.svg From af855256b4bc7133d4dee57d33f62d8287473436 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 19:31:30 +0100 Subject: [PATCH 16/29] Preprocessing libs added to README.md --- README.md | 10 ++++++++++ src/bot/dialog.py | 49 ----------------------------------------------- 2 files changed, 10 insertions(+), 49 deletions(-) delete mode 100644 src/bot/dialog.py diff --git a/README.md b/README.md index c02a556..8dd3d55 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,17 @@ This project was completed in 5 days by two Machine Learning students from BeCod The efficient implementation of our solution relies on a plethora of solid libraries: +#### Inputs preprocessing +| Library | Used for | +|---|---| +| BeautifulSoup | Preventing and removing tags and other HTML elements | +| Unidecode | Removing all accents | +| SpaCy | Lemmatize and detect numbers written in letters | +| word2number | Replace the numbers written in letters, into digits | +| contractions | Detecting and replacing contracted forms of language | + +The pre-processing is done in the [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) object. ## Cross-plateforme implementation diff --git a/src/bot/dialog.py b/src/bot/dialog.py deleted file mode 100644 index 0efb20c..0000000 --- a/src/bot/dialog.py +++ /dev/null @@ -1,49 +0,0 @@ - -from botbuilder.core import ActivityHandler, ConversationState, TurnContext, UserState -from botbuilder.dialogs import Dialog -from helpers.dialog_helper import DialogHelper - - -class DialogBot(ActivityHandler): - """ - This Bot implementation can run any type of Dialog. The use of type parameterization is to allows multiple - different bots to be run at different endpoints within the same project. This can be achieved by defining distinct - Controller types each with dependency on distinct Bot types. The ConversationState is used by the Dialog system. The - UserState isn't, however, it might have been used in a Dialog implementation, and the requirement is that all - BotState objects are saved at the end of a turn. - """ - - def __init__( - self, - conversation_state: ConversationState, - user_state: UserState, - dialog: Dialog, - ): - if conversation_state is None: - raise TypeError( - "[DialogBot]: Missing parameter. conversation_state is required but None was given" - ) - if user_state is None: - raise TypeError( - "[DialogBot]: Missing parameter. user_state is required but None was given" - ) - if dialog is None: - raise Exception("[DialogBot]: Missing parameter. dialog is required") - - self.conversation_state = conversation_state - self.user_state = user_state - self.dialog = dialog - - async def on_turn(self, turn_context: TurnContext): - await super().on_turn(turn_context) - - # Save any state changes that might have ocurred during the turn. - await self.conversation_state.save_changes(turn_context) - await self.user_state.save_changes(turn_context) - - async def on_message_activity(self, turn_context: TurnContext): - await DialogHelper.run_dialog( - self.dialog, - turn_context, - self.conversation_state.create_property("DialogState"), - ) \ No newline at end of file From c98b7ce1a0ccaea0d14dea72916dd200592db163 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 19:43:55 +0100 Subject: [PATCH 17/29] Classification added --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8dd3d55..861420f 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ This project was completed in 5 days by two Machine Learning students from BeCod The efficient implementation of our solution relies on a plethora of solid libraries: #### Inputs preprocessing +The process of transforming and sanitizing a message in order to be able to classify it. -| Library | Used for | +|     Library     | Used for | |---|---| | BeautifulSoup | Preventing and removing tags and other HTML elements | | Unidecode | Removing all accents | @@ -28,6 +29,14 @@ The efficient implementation of our solution relies on a plethora of solid libra The pre-processing is done in the [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) object. +#### Classification +The process of recognising and giving a label to a message. + +|     Library    | Used for | +|---|---| +| transformers | Downloading and using BERT| +| PyTorch | Fine-tuning the model based on our dataset | + ## Cross-plateforme implementation From 74819e19b9387bc96c47ab863c8affad991066ef Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 19:46:15 +0100 Subject: [PATCH 18/29] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 861420f..fa0f1ff 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ The efficient implementation of our solution relies on a plethora of solid libra #### Inputs preprocessing The process of transforming and sanitizing a message in order to be able to classify it. -|     Library     | Used for | +| Library | Used for | |---|---| | BeautifulSoup | Preventing and removing tags and other HTML elements | | Unidecode | Removing all accents | @@ -32,7 +32,7 @@ The pre-processing is done in the [Preprocessor.py](/src/nlu/preprocessing/prepr #### Classification The process of recognising and giving a label to a message. -|     Library    | Used for | +| Library | Used for | |---|---| | transformers | Downloading and using BERT| | PyTorch | Fine-tuning the model based on our dataset | @@ -110,4 +110,4 @@ Timeline: - Etablir l'objectif (déployer bot cross-plateforme + créer propre modele) - Trouver un framework >> MSBotFramework - Créer un dataset -- Deployer dummy bot \ No newline at end of file +- Deployer dummy bot From 0593af915a1a95f445889717de10c4118a2760dd Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 19:52:18 +0100 Subject: [PATCH 19/29] Dialogflow image added --- README.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index fa0f1ff..3e944eb 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # Resa Chatbot -A cross-platform chatbot based on MS Bot Framework and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be) ! +A cross-platform chatbot based on MS Bot Framework and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. + +Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be), tell him that you want to book a hotel room! ### Project timeline @@ -12,11 +14,17 @@ This project was completed in 5 days by two Machine Learning students from BeCod - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) -### Techs and libraries used +## The dialog flow + +

+ +

+ +## Techs and libraries used -The efficient implementation of our solution relies on a plethora of solid libraries: +The efficient implementation of our solution relies on the Bot Framework from Microsoft, and a plethora of solid libraries: -#### Inputs preprocessing +### Inputs preprocessing The process of transforming and sanitizing a message in order to be able to classify it. | Library | Used for | @@ -29,13 +37,14 @@ The process of transforming and sanitizing a message in order to be able to clas The pre-processing is done in the [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) object. -#### Classification +### Classification & matching The process of recognising and giving a label to a message. | Library | Used for | |---|---| -| transformers | Downloading and using BERT| +| transformers | Downloading and using BERT | | PyTorch | Fine-tuning the model based on our dataset | +| PolyFuzz | With regex, to detect keywords and complex intentions | ## Cross-plateforme implementation From 81d690746a386db97da0a023f42f4dcab99d6731 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 19:56:57 +0100 Subject: [PATCH 20/29] Table rewritten --- README.md | 36 ++++++++++++++---------------------- 1 file changed, 14 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 3e944eb..0b5ddf2 100644 --- a/README.md +++ b/README.md @@ -20,31 +20,23 @@ This project was completed in 5 days by two Machine Learning students from BeCod

-## Techs and libraries used - -The efficient implementation of our solution relies on the Bot Framework from Microsoft, and a plethora of solid libraries: - -### Inputs preprocessing The process of transforming and sanitizing a message in order to be able to classify it. - -| Library | Used for | -|---|---| -| BeautifulSoup | Preventing and removing tags and other HTML elements | -| Unidecode | Removing all accents | -| SpaCy | Lemmatize and detect numbers written in letters | -| word2number | Replace the numbers written in letters, into digits | -| contractions | Detecting and replacing contracted forms of language | - -The pre-processing is done in the [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) object. - -### Classification & matching The process of recognising and giving a label to a message. +### Techs and libraries used + +The efficient implementation of our solution relies on the Bot Framework from Microsoft, and a plethora of solid libraries: -| Library | Used for | -|---|---| -| transformers | Downloading and using BERT | -| PyTorch | Fine-tuning the model based on our dataset | -| PolyFuzz | With regex, to detect keywords and complex intentions | +| Library | Used in | Detail | +|---|---|---| +| BeautifulSoup | [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) | Preventing and removing tags and other HTML elements | +| Unidecode | [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) | Removing all accents | +| SpaCy | [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) | Lemmatize and detect numbers written in letters | +| word2number | [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) | Replace the numbers written in letters, into digits | +| contractions | [Preprocessor.py](/src/nlu/preprocessing/preprocessor.py) | Detecting and replacing contracted forms of language | +| | | | +| transformers | [Classifier.py](/src/nlu/classifying/classifier.py) | Downloading and using BERT | +| PyTorch | [Classifier.py](/src/nlu/classifying/classifier.py) | Fine-tuning the model based on our dataset | +| PolyFuzz | [Classifier.py](/src/nlu/classifying/classifier.py) | With regex, to detect keywords and complex intentions | ## Cross-plateforme implementation From cf3f8c08eeff9f0f0a7a59d04fe157e9664ee347 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 20:00:56 +0100 Subject: [PATCH 21/29] Cross platform definition added --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0b5ddf2..1c8af3e 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This project was completed in 5 days by two Machine Learning students from BeCod - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) -## The dialog flow +### The dialog flow

@@ -24,7 +24,7 @@ The process of transforming and sanitizing a message in order to be able to clas The process of recognising and giving a label to a message. ### Techs and libraries used -The efficient implementation of our solution relies on the Bot Framework from Microsoft, and a plethora of solid libraries: +The efficient implementation of our solution relies on a plethora of solid libraries: | Library | Used in | Detail | |---|---|---| @@ -38,6 +38,14 @@ The efficient implementation of our solution relies on the Bot Framework from Mi | PyTorch | [Classifier.py](/src/nlu/classifying/classifier.py) | Fine-tuning the model based on our dataset | | PolyFuzz | [Classifier.py](/src/nlu/classifying/classifier.py) | With regex, to detect keywords and complex intentions | +### This bot is cross-platform + +All these libraries have been brought together with Microsoft's Bot Framework, a tool that allows us to publish this bot on all the following platforms: + +

+ +

+ ## Cross-plateforme implementation From 2aaf901245630f0099f75b365cf4906fba43b106 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 20:59:05 +0100 Subject: [PATCH 22/29] README.md updated --- README.md | 87 ++++++------------------------------------------------- 1 file changed, 9 insertions(+), 78 deletions(-) diff --git a/README.md b/README.md index 1c8af3e..e827f28 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Resa Chatbot -A cross-platform chatbot based on MS Bot Framework and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. +A cross-platform chatbot based on MS Bot Framework, PyTorch and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. -Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be), tell him that you want to book a hotel room! +Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be), **tell him that you want to book a hotel room**! ### Project timeline @@ -14,6 +14,12 @@ This project was completed in 5 days by two Machine Learning students from BeCod - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) +### Bot features +- Advanced NLU (thanks to BERT) to understand custom intentions +- Strong entity and keywords matcher, to detect complex informations +- Flexible dialogs flow that adapt to user's responses +- Easy-to-interact on any platform, thanks to cards, button and more + ### The dialog flow

@@ -44,79 +50,4 @@ All these libraries have been brought together with Microsoft's Bot Framework, a

-

- -## Cross-plateforme implementation - - -## fonctionnalités du Bot : - -### Traitement des inputs "utilisateurs" - -- Bert ? - -### Possible réponses - -- Accueillire - - Décrire les fonctionnalités du bot - - Répondre -- Donner les heures d'ouvertures -- Afficher une liste d'objet, de produit - -### Nice to have - -- Réserver un service / un produit - - Gérer un agenda - - vérifier la disponibilité - - -- - - "**In English**, the bot should be able to :\n", - "\n", - "- Understand phrases related to a room reservation.\n", - "Example that the bot will have to understand: \n", - "\n", - "\t\t> I wish to reserve a room for 2 people.\n", - "\t\t> I wish to reserve a room for 4 days\n", - "\t\t> Do you have rooms available from July 23rd?\n", - "\t\t> I would like to reserve a room for two days and for two people\n", - "\n", - "- Understand phrases related to a table reservation for the restaurant. \n", - "\n", - "\t\t> I would like to make a reservation for tonight.\n", - "\t\t> I'd like to reserve a table for four people.\n", - "\n", - "- Must ensure a continuous and ongoing conversation. Example of a complete conversation : \n", - "\n", - "\t\t> Customer : Hello !\n", - "\t\t> Bot : Hello, how can I help you? \n", - "\t\t> Customer: I would like to reserve a table for 4 people ? \n", - "\t\t> Bot : For which date would you like to reserve your table?\n", - "\t\t> Customer : Today at 7:00 pm\n", - "\t\t> Bot : What name should I make the reservation under?\n", - "\t\t> Customer : My name is Mr. Dupont! \n", - "\t\t> Bot : Very well Mr Dupont, I confirm you the reservation of a table for 4 people tonight at 7:00 pm. \n", - "\t\t> Bot : Can I help you with something else?\n", - "\t\t> Customer : No thanks\n", - "\t\t> Bot: Have a nice day. \n", - "\n", - "- Understand when the client is angry. In this case, the bot will indicate that it is transmitting the conversation to a human. \n", - "\n", - "\t\t> You're incompetent!\n", - "\t\t> My room is dirty! This is outrageous!\n", - "\t\t> I want to talk to a human. \n", - "\n", - "### Nice-to-have features\n", - "- Create an API of your bot to make it cross-platform \n", - "- Use Docker\n", - - - - -## Hébergement du Bot - -Timeline: -- Etablir l'objectif (déployer bot cross-plateforme + créer propre modele) -- Trouver un framework >> MSBotFramework -- Créer un dataset -- Deployer dummy bot +

\ No newline at end of file From cb3e61fe60b246e103183f780805d24809ea3bb7 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:06:04 +0100 Subject: [PATCH 23/29] Added chatbo_header.svg --- assets/images/chatbo_header.svg | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 assets/images/chatbo_header.svg diff --git a/assets/images/chatbo_header.svg b/assets/images/chatbo_header.svg new file mode 100644 index 0000000..69b0557 --- /dev/null +++ b/assets/images/chatbo_header.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file From 743a70990a72514874ebcc88a47f4d239a5022a4 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:11:59 +0100 Subject: [PATCH 24/29] Update chatbo_header.svg --- assets/images/chatbo_header.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/images/chatbo_header.svg b/assets/images/chatbo_header.svg index 69b0557..295a095 100644 --- a/assets/images/chatbo_header.svg +++ b/assets/images/chatbo_header.svg @@ -1,3 +1,3 @@ - \ No newline at end of file +
Resa Chatbot
Resa Chatbot
Viewer does not support full SVG 1.1
\ No newline at end of file From 1a7f602deb5627e5325f65a39d9c4a1b981731d7 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:13:17 +0100 Subject: [PATCH 25/29] README.md updated --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e827f28..d99f663 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,9 @@ -# Resa Chatbot +![Resa chatbot](/assets/images/chatbo_header.svg) A cross-platform chatbot based on MS Bot Framework, PyTorch and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be), **tell him that you want to book a hotel room**! -### Project timeline - -

- -

- -This project was completed in 5 days by two Machine Learning students from BeCode: - - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) - - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) - ### Bot features - Advanced NLU (thanks to BERT) to understand custom intentions - Strong entity and keywords matcher, to detect complex informations @@ -50,4 +40,14 @@ All these libraries have been brought together with Microsoft's Bot Framework, a

-

\ No newline at end of file +

+ +### Project timeline + +

+ +

+ +This project was completed in 5 days by two Machine Learning students from BeCode: + - **Vincent Leurs**: [Twitter](https://twitter.com/VincentLeurs) - [Github](https://github.com/paradous) + - **Joffrey Bienvenu**: [Website](https://joffreybvn.be/) - [Twitter](https://twitter.com/Joffreybvn) - [Github](https://github.com/joffreybvn) From d7a890bdae54114241a2931fa84b3b6c2d828a72 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:14:41 +0100 Subject: [PATCH 26/29] Update chatbo_header.svg --- assets/images/chatbo_header.svg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/images/chatbo_header.svg b/assets/images/chatbo_header.svg index 295a095..12fbb8a 100644 --- a/assets/images/chatbo_header.svg +++ b/assets/images/chatbo_header.svg @@ -1,3 +1,3 @@ -
Resa Chatbot
Resa Chatbot
Viewer does not support full SVG 1.1
\ No newline at end of file +
Resa Chatbot
Resa Chatbot
Viewer does not support full SVG 1.1
\ No newline at end of file From de9eea8ca68393bb5a158c1da2f7cfa3010d2f7a Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:15:52 +0100 Subject: [PATCH 27/29] README.md updated --- README.md | 2 +- assets/images/{chatbo_header.svg => chatbot_header.svg} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename assets/images/{chatbo_header.svg => chatbot_header.svg} (100%) diff --git a/README.md b/README.md index d99f663..89a67e0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Resa chatbot](/assets/images/chatbo_header.svg) +![Resa chatbot](/assets/images/chatbot_header.svg) A cross-platform chatbot based on MS Bot Framework, PyTorch and a fine-tuned BERT model, to demonstrate how to easily create complex dialogs and deploy it on Azure. diff --git a/assets/images/chatbo_header.svg b/assets/images/chatbot_header.svg similarity index 100% rename from assets/images/chatbo_header.svg rename to assets/images/chatbot_header.svg From d98db819728c20ae7d4813b132c1bb726e0f6602 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:17:23 +0100 Subject: [PATCH 28/29] README.md updated --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 89a67e0..e98c34f 100644 --- a/README.md +++ b/README.md @@ -42,6 +42,11 @@ All these libraries have been brought together with Microsoft's Bot Framework, a

+As of today, the bot is available on: +- Skype: [@demo_rasa_bot]() +- Telegram: [@demo_rasa_bot]() +- Webpage: [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be) + ### Project timeline

From cc9f8c3c0ad2834112ad492063b011c41f2516a7 Mon Sep 17 00:00:00 2001 From: Joffrey Bienvenu Date: Mon, 8 Feb 2021 21:18:36 +0100 Subject: [PATCH 29/29] README.md updated --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e98c34f..63faaef 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Test is on [chatbot.joffreybvn.be](https://chatbot.joffreybvn.be), **tell him th - Advanced NLU (thanks to BERT) to understand custom intentions - Strong entity and keywords matcher, to detect complex informations - Flexible dialogs flow that adapt to user's responses -- Easy-to-interact on any platform, thanks to cards, button and more +- Easy-to-interact on any platform, thanks to cards, buttons and more ### The dialog flow