Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for NLU module #245

Merged
merged 5 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Below is the overview of IAI MovieBot 2.0 architecture. Blue components are inhe
- Telegram
- Flask REST
- Flask socket.io
* Natural Language Understanding (NLU)
* Natural Language Understanding (NLU) [[doc](https://iai-moviebot.readthedocs.io/en/latest/nlu.html)]
- Rule-based
- JointBERT
* Dialogue management
Expand Down
13 changes: 6 additions & 7 deletions docs/source/architecture.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ System Architecture

This page provides a high-level overview of the architecture of our system. At this level of abstraction, our system constitutes a domain-independent framework for facilitating conversational item recommendation. Thus, even though we will be using movie-related examples for illustration, it is straightforward to adapt the system to other domains.

The system architecture is shown in the figure below, illustrating the core process for each dialogue turn.
The overview of the system architecture is shown in the figure below.

.. image:: _static/Blueprint_MovieBot.png
.. image:: _static/Blueprint_MovieBot_v2.png

The main components of the system are:

Natural Language Understanding
------------------------------

The :py:class:`NLU <moviebot.nlu.nlu>` component converts the natural language :py:class:`UserUtterance <moviebot.core.utterance.utterance.UserUtterance>` into a :py:class:`DialogueAct <moviebot.dialogue_manager.dialogue_act>`. This process, comprising of *intent detection* and *slot filling*, is performed based on the current dialogue state.

- :doc:`Natural Language Understanding <nlu>`
- Dialogue Manager
- Natural Language Generation

Dialogue Manager
----------------
Expand Down
2 changes: 0 additions & 2 deletions docs/source/contact.rst

This file was deleted.

26 changes: 1 addition & 25 deletions docs/source/dialogue.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,7 @@ User intents

:py:class:`UserIntents <moviebot.intents.user_intents>`

+------------------------+------------+
| Intent | Description |
+========================+============+
| Reveal | The user wants to reveal a preference. |
+------------------------+------------+
| Inquire | Once the agent has recommended an item, the user can ask further details about it. |
+------------------------+------------+
| Remove preference | The user wants to remove any previously stated preference. |
+------------------------+------------+
| Reject | The user either has already seen/consumed the recommended item or does not like it. |
+------------------------+------------+
| Accept | The user accepts (likes) the recommendation. This will determine the success of the system as being able to find a recommendation the user liked. |
+------------------------+------------+
| Continue recommendation | If the user likes a recommendation, they can either restart, quit or continue the process to get a similar recommendation. |
+------------------------+------------+
| Restart | The user wants to restart the recommendation process. |
+------------------------+------------+
| Acknowledge | Acknowledge the agent's question where required. |
+------------------------+------------+
| Deny | Negate the agent's question where required. |
+------------------------+------------+
| Hi | When the user initiates the conversation, they start with a formal hi/hello or reveal preferences. |
+------------------------+------------+
| Bye | End the conversation by sending a bye message or an exit command. |
+------------------------+------------+
A detailed description is provided :doc:`here <nlu>`.

Agent intents
"""""""""""""
Expand Down
1 change: 0 additions & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ The distinctive features of IAI MovieBot include a task-specific dialogue flow,
architecture
dialogue
reinforcement_learning
contact


Indices and tables
Expand Down
64 changes: 64 additions & 0 deletions docs/source/nlu.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Natural Language Understanding
------------------------------

The natural language understanding (NLU) component converts incoming user utterances into dialogue acts.
A dialogue act is a structured representation comprising an intent and parameters. A parameter is a triplet including a slot, an operator, and a value. Note that the user intents and slots, that are domain specific, are pre-defined and can easily be modified to fit a new domain.
The NLU process is divided into two steps: intent classification and slot filling.

Two types of NLU component are available:

- :py:class:`RuleBasedNLU <moviebot.nlu.rule_based_nlu.RuleBasedNLU>`: intents and parameters are extracted using pre-defined rules.
- :py:class:`NeuralNLU <moviebot.nlu.neural_nlu.NeuralNLU>`: intents and parameters are extracted using a JointBERT model with a CRF layer [1]_. Training data and scripts are released with the code.

User Intents
------------

:py:class:`UserIntents <moviebot.intents.user_intents>`

+--------------------------+----------------------------------------------+
| Intent | Description |
+==========================+==============================================+
| Reveal | The user wants to reveal a preference. |
+--------------------------+----------------------------------------------+
| Inquire | Once the agent has recommended an item, |
| | the user can ask further details about it. |
+--------------------------+----------------------------------------------+
| Remove preference | The user wants to remove any previously |
| | stated preference. |
+--------------------------+----------------------------------------------+
| Reject | The user either has already seen/consumed |
| | the recommended item or does not like it. |
+--------------------------+----------------------------------------------+
| Accept | The user accepts (likes) the recommendation. |
| | This will determine the success of the system|
| | as being able to find a satisfying |
| | recommendation. |
+--------------------------+----------------------------------------------+
| Continue recommendation | If the user likes a recommendation, they can |
| | either restart, quit, or continue the process|
| | to get a similar recommendation. |
+--------------------------+----------------------------------------------+
| Restart | The user wants to restart the recommendation |
| | process. |
+--------------------------+----------------------------------------------+
| Acknowledge | Acknowledge the agent's question where |
| | required. |
+--------------------------+----------------------------------------------+
| Deny | Negate the agent's question where required. |
+--------------------------+----------------------------------------------+
| Hi | When the user initiates the conversation, |
| | they start with a formal hi/hello or reveal |
| | preferences. |
+--------------------------+----------------------------------------------+
| Bye | End the conversation by sending a bye message|
| | or an exit command. |
+--------------------------+----------------------------------------------+

Slots
-----

The slots are defined in the enumeration :py:class:`Slots <moviebot.nlu.annotation.slots.Slots>`. Note that some of these slots cannot be filled upon the reception of a user utterance, such as `imdb_link` and `cover_image`.

**References**

.. [1] Chen, Q., Zhuo, Z., & Wang, W. (2019). BERT for Joint Intent Classification and Slot Filling. arXiv preprint arXiv:1902.10909.
Loading