Repository: iai-group/DialogueKit (language: python)

Issue:
Move user and agent modules under participant package
@NoB0 What do you think about moving user and agent under participant? Those implement participant, and also there is probably no need to have three packages with a single module each.


Discussion / hints:
It is a good point, I think this is a good idea.
OK, turning it to a P0 issue for you then :)
I'll update the figure in the paper accordingly.

Fix patch:
diff --git a/README.md b/README.md
index eb0672f4..533afc6f 100644
--- a/README.md
+++ b/README.md
@@ -47,7 +47,7 @@ If you want to specify a specific commit as the source of the package append the
 
     ```python
     from dialoguekit.core.utterance import Utterance
-    from dialoguekit.user.user import User, UserType
+    from dialoguekit.participant.user import User, UserType
     from sample_agents.parrot_agent import ParrotAgent
 
     # Participants
diff --git a/dialoguekit/agent/__init__.py b/dialoguekit/agent/__init__.py
deleted file mode 100644
index 34d5492a..00000000
--- a/dialoguekit/agent/__init__.py
+++ /dev/null
@@ -1,7 +0,0 @@
-"""Agent level init."""
-from dialoguekit.agent.agent import Agent, AgentType
-
-__all__ = [
-    "Agent",
-    "AgentType",
-]
diff --git a/dialoguekit/connector/dialogue_connector.py b/dialoguekit/connector/dialogue_connector.py
index bc2a7b75..99729923 100644
--- a/dialoguekit/connector/dialogue_connector.py
+++ b/dialoguekit/connector/dialogue_connector.py
@@ -18,11 +18,11 @@
 import json
 import os
 
-from dialoguekit.agent.agent import Agent
 from dialoguekit.core.annotated_utterance import AnnotatedUtterance
 from dialoguekit.core.dialogue import Dialogue
+from dialoguekit.participant.agent import Agent
+from dialoguekit.participant.user import User
 from dialoguekit.platforms.platform import Platform
-from dialoguekit.user.user import User
 
 _DIALOGUE_EXPORT_PATH = "dialogue_export"
 
@@ -191,7 +191,7 @@ def _dump_dialogue_history(self):
 
 
 if __name__ == "__main__":
-    from dialoguekit.user.user import User
+    from dialoguekit.participant.user import User
     from sample_agents.moviebot_agent import MovieBotAgent
 
     # Participants
diff --git a/dialoguekit/participant/__init__.py b/dialoguekit/participant/__init__.py
index feaf3d5f..af7e09ba 100644
--- a/dialoguekit/participant/__init__.py
+++ b/dialoguekit/participant/__init__.py
@@ -1,4 +1,5 @@
 """Participant init."""
 from dialoguekit.participant.participant import DialogueParticipant, Participant
+from dialoguekit.participant.user_preferences import UserPreferences
 
-__all__ = ["Participant", "DialogueParticipant"]
+__all__ = ["Participant", "DialogueParticipant", "UserPreferences"]
diff --git a/dialoguekit/agent/agent.py b/dialoguekit/participant/agent.py
similarity index 91%
rename from dialoguekit/agent/agent.py
rename to dialoguekit/participant/agent.py
index e368cf30..15e499f1 100644
--- a/dialoguekit/agent/agent.py
+++ b/dialoguekit/participant/agent.py
@@ -13,9 +13,6 @@
 
 from dialoguekit.participant.participant import DialogueParticipant, Participant
 
-# TODO Some research needs to be done in how Python abstract classes work,
-# to implement them for Agent and participant
-
 
 class AgentType(Enum):
     """Represents different types of agents (bot vs Wizard-of-Oz)."""
diff --git a/dialoguekit/user/user.py b/dialoguekit/participant/user.py
similarity index 100%
rename from dialoguekit/user/user.py
rename to dialoguekit/participant/user.py
diff --git a/dialoguekit/user/user_preferences.py b/dialoguekit/participant/user_preferences.py
similarity index 100%
rename from dialoguekit/user/user_preferences.py
rename to dialoguekit/participant/user_preferences.py
diff --git a/dialoguekit/user/__init__.py b/dialoguekit/user/__init__.py
deleted file mode 100644
index aa053092..00000000
--- a/dialoguekit/user/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-"""Module level init for the users."""
-from dialoguekit.user.user import User
-from dialoguekit.user.user_preferences import UserPreferences
-
-__all__ = ["UserPreferences", "User"]
diff --git a/docs/source/concepts.rst b/docs/source/concepts.rst
index a6361300..ef6f4994 100644
--- a/docs/source/concepts.rst
+++ b/docs/source/concepts.rst
@@ -18,7 +18,7 @@ DialogueKit assumes the agent to always start the conversation and also end it.
 
 Agent
 -----
-:py:mod:`dialoguekit.agent.agent`
+:py:mod:`dialoguekit.participant.agent`
 
 Represents a conversational agent with some intelligent capabilities (typically defined by the dialogue policy, natural language understanding, and natural language generation components).
 
@@ -36,7 +36,7 @@ DialogueKit is shipped with some sample agents (**TODO:** reference sample agent
 
 User 
 ----
-:py:mod:`dialoguekit.user.user`
+:py:mod:`dialoguekit.participant.user`
 
 Represents a human interacting with an agent in natural language text.
 
diff --git a/docs/source/external_agents.rst b/docs/source/external_agents.rst
index ffd9e441..0a1acafc 100644
--- a/docs/source/external_agents.rst
+++ b/docs/source/external_agents.rst
@@ -8,7 +8,7 @@ External Agents
 Rasa parrot
 --------------
 
-The :py:mod:`dialoguekit.agent.rasa_parrot_agent.py` **Agent** is just an example of how a Rasa agent could be used in DialogueKit.
+The :py:mod:`sample_agents.rasa_parrot_agent.py` **Agent** is just an example of how a Rasa agent could be used in DialogueKit.
 This **Agent** talks to the :py:mod:`additional.rasa-parrot` which does all the processing while the **DialogueKit Rasa Agent** only handles the communication.
 
 
diff --git a/docs/source/usage.rst b/docs/source/usage.rst
index 2a081c2a..8414fee4 100644
--- a/docs/source/usage.rst
+++ b/docs/source/usage.rst
@@ -11,7 +11,7 @@ only parrots back what the user said.
 
     .. code-block:: python
 
-        from dialoguekit.user.user import User
+        from dialoguekit.participant.user import User
         from sample_agents.parrot_agent import ParrotAgent
         from dialoguekit.platforms.platform import Platform
         from dialoguekit.connector.dialogue_connector import DialogueConnector
diff --git a/sample_agents/moviebot_agent.py b/sample_agents/moviebot_agent.py
index b24b8e52..b957d34e 100644
--- a/sample_agents/moviebot_agent.py
+++ b/sample_agents/moviebot_agent.py
@@ -15,10 +15,10 @@
 
 import requests
 
-from dialoguekit.agent.agent import Agent, AgentType
 from dialoguekit.core.annotated_utterance import AnnotatedUtterance
 from dialoguekit.core.intent import Intent
 from dialoguekit.core.utterance import Utterance
+from dialoguekit.participant.agent import Agent, AgentType
 from dialoguekit.participant.participant import DialogueParticipant
 
 _MOVIEBOT_DEFAULT_URI = "http://127.0.0.1:5001"
diff --git a/sample_agents/parrot_agent.py b/sample_agents/parrot_agent.py
index 4f82418c..bb869da3 100644
--- a/sample_agents/parrot_agent.py
+++ b/sample_agents/parrot_agent.py
@@ -1,9 +1,9 @@
 """Simplest possible agent that parrots back everything the user says."""
 
-from dialoguekit.agent.agent import Agent
 from dialoguekit.core.annotated_utterance import AnnotatedUtterance
 from dialoguekit.core.intent import Intent
 from dialoguekit.core.utterance import Utterance
+from dialoguekit.participant.agent import Agent
 from dialoguekit.participant.participant import DialogueParticipant
 
 
diff --git a/sample_agents/rasa_parrot_agent.py b/sample_agents/rasa_parrot_agent.py
index cc0baaaf..fe42fa11 100644
--- a/sample_agents/rasa_parrot_agent.py
+++ b/sample_agents/rasa_parrot_agent.py
@@ -6,10 +6,10 @@
 
 import requests
 
-from dialoguekit.agent.agent import Agent
 from dialoguekit.core.annotated_utterance import AnnotatedUtterance
 from dialoguekit.core.intent import Intent
 from dialoguekit.core.utterance import Utterance
+from dialoguekit.participant.agent import Agent
 from dialoguekit.participant.participant import DialogueParticipant
 
 
diff --git a/sample_agents/woz_agent.py b/sample_agents/woz_agent.py
index 38ac33e4..84d34103 100644
--- a/sample_agents/woz_agent.py
+++ b/sample_agents/woz_agent.py
@@ -6,10 +6,10 @@
 """
 from typing import List, Optional
 
-from dialoguekit.agent.agent import Agent, AgentType
 from dialoguekit.core.annotated_utterance import AnnotatedUtterance
 from dialoguekit.core.intent import Intent
 from dialoguekit.core.utterance import Utterance
+from dialoguekit.participant.agent import Agent, AgentType
 from dialoguekit.participant.participant import DialogueParticipant
 
 


Test patch:
diff --git a/tests/sample_agents/test_parrot_agent.py b/tests/sample_agents/test_parrot_agent.py
index 39ce2207..fc940fcb 100644
--- a/tests/sample_agents/test_parrot_agent.py
+++ b/tests/sample_agents/test_parrot_agent.py
@@ -4,10 +4,10 @@
 
 import pytest
 
-from dialoguekit.agent.agent import AgentType
 from dialoguekit.connector.dialogue_connector import DialogueConnector
+from dialoguekit.participant.agent import AgentType
+from dialoguekit.participant.user import User, UserType
 from dialoguekit.platforms.platform import Platform
-from dialoguekit.user.user import User, UserType
 from sample_agents.parrot_agent import ParrotAgent
 
 
diff --git a/tests/user/test_user_preferences.py b/tests/user/test_user_preferences.py
index 530a2878..39b4d4e9 100644
--- a/tests/user/test_user_preferences.py
+++ b/tests/user/test_user_preferences.py
@@ -1,7 +1,8 @@
 """Tests for the UserPreferences class."""
 
 import pytest
-from dialoguekit.user import UserPreferences
+
+from dialoguekit.participant.user_preferences import UserPreferences
 
 
 def test_set_preference():