{"id":29748760,"url":"https://github.com/achrefbenammar404/quasi-patterned-conversations-analysis","last_synced_at":"2025-10-14T11:02:35.660Z","repository":{"id":258250905,"uuid":"844808093","full_name":"achrefbenammar404/quasi-patterned-conversations-analysis","owner":"achrefbenammar404","description":"Official Implementation of the IEEE EUROCON 2025 Paper A Computational Approach to Modeling Conversational Systems Analyzing Large-Scale Quasi-Patterned Dialogue Flows Mohamed Achref Ben Ammar – National Institute of Applied Science and Technology (INSAT), University of Carthage, Tunisia Mohamed Taha Bennani – University of Tunis El Manar (FST)","archived":true,"fork":false,"pushed_at":"2025-04-15T21:07:57.000Z","size":2982,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-26T14:52:30.674Z","etag":null,"topics":["ai","computational-linguistics","conversational-agent","conversational-ai","data-analysis","graph-algorithms","nlp","research","research-paper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/achrefbenammar404.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-20T02:26:18.000Z","updated_at":"2025-04-26T21:55:17.000Z","dependencies_parsed_at":"2024-11-20T20:23:27.650Z","dependency_job_id":"bf52fdc8-1d24-4dea-a5f5-975d68ba594c","html_url":"https://github.com/achrefbenammar404/quasi-patterned-conversations-analysis","commit_stats":null,"previous_names":["achrefbenammar404/quasi-patterned-conversations-analysis"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/achrefbenammar404/quasi-patterned-conversations-analysis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2Fquasi-patterned-conversations-analysis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2Fquasi-patterned-conversations-analysis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2Fquasi-patterned-conversations-analysis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2Fquasi-patterned-conversations-analysis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/achrefbenammar404","download_url":"https://codeload.github.com/achrefbenammar404/quasi-patterned-conversations-analysis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/achrefbenammar404%2Fquasi-patterned-conversations-analysis/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279018762,"owners_count":26086454,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","computational-linguistics","conversational-agent","conversational-ai","data-analysis","graph-algorithms","nlp","research","research-paper"],"created_at":"2025-07-26T10:42:31.413Z","updated_at":"2025-10-14T11:02:35.654Z","avatar_url":"https://github.com/achrefbenammar404.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eA Computational Approach to Modeling Conversational Systems\u003c/h1\u003e\n\u003ch3 align=\"center\"\u003eAnalyzing Large-Scale Quasi-Patterned Dialogue Flows\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"resources/logo_c.png\" alt=\"INSAT logo\" width=\"100\"\u003e\n  \u003cimg src=\"resources/utm-og-img.png\" alt=\"FST Logo\" width=\"100\"/\u003e\n\n  \u003cp align = \"center\"\u003e\n    \u003cimg src=\"resources/IEEE-Region-8-Logo.png\" alt=\"IEEE XPLORE logo\" width=\"230\"\u003e\n  \u003c/p\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eOfficial Implementation of the IEEE EUROCON 2025 Paper \u003cbr\u003eA Computational Approach to Modeling Conversational Systems\u003c/h1\u003e\nAnalyzing Large-Scale Quasi-Patterned Dialogue Flows\u003c/strong\u003e\u003cbr\u003e\n  \u003cem\u003eMohamed Achref Ben Ammar\u003c/em\u003e – National Institute of Applied Science and Technology (INSAT), University of Carthage, Tunisia\u003cbr\u003e\n  \u003cem\u003eMohamed Taha Bennani\u003c/em\u003e – University of Tunis El Manar (FST)\n\u003c/p\u003e\n\n---\n\n## Abstract\n\nThe rise of large language models (LLMs) has led to increasingly complex and loosely structured dialogues. In this work, we introduce a **computational graph-based framework** that models these quasi-patterned conversations. Central to our approach is the **Filter \u0026 Reconnect** method, a graph simplification technique that reduces conversational noise while preserving semantic structure.\n\nKey outcomes:\n- **2.06× improvement in semantic metric S** over prior methods\n- **0 δ-hyperbolicity**, enforcing a tree-like, interpretable structure\n\nThis framework offers practical tools for monitoring and analyzing chatbot behavior, dialogue management systems, and user interaction patterns at scale.\n\n---\n\n## Methodology Overview\n\nThe methodology consists of the following core steps:\n\n1. **Utterance Extraction**  \n   Conversational utterances are extracted from a structured dataset consisting of multi-turn dialogues.\n\n2. **Semantic Embedding**  \n   Each utterance is transformed into a dense vector using a pre-trained text embedding model, capturing the semantic meaning of the message.\n\n3. **Clustering of Intents**  \n   Using hierarchical clustering techniques and a large language model (LLM), similar utterances are grouped together to identify key communicative intents.\n\n4. **Markov Chain Construction**  \n   A Markov Chain is built where nodes represent clustered intents and edges represent transitions between them in the dialogue flow.\n\n5. **Graph Simplification: Filter \u0026 Reconnect**  \n   The conversational graph undergoes a noise reduction process by removing irrelevant transitions while preserving semantic and structural coherence.\n\n6. **Flow Pattern Analysis**  \n   The resulting graph is then analyzed to identify quasi-patterned conversational flows, enabling improved interpretability and dialogue system evaluation.\n\n---\n\n## Setup\n\n### 1. Install Dependencies\n\n```bash\n# Create and activate a virtual environment\npython -m venv venv\nsource venv/bin/activate        # Linux/MacOS\nvenv\\Scripts\\activate           # Windows\n\n# Install required packages\npip install -r requirements.txt\n\n# Download required NLP model\npython -m spacy download en_core_web_md\n```\n\n### 2. Create a `.env` File\n\nAt the project root, create a `.env` file and configure the following environment variables:\n\n```dotenv\n# Python setup\nPYTHONPATH=${PYTHONPATH}:.\n\n# Environment mode\nENVIRONMENT=\"local\"\n\n# API Keys\nGOOGLE_API_KEY=\nMISTRAL_API_KEY=\n```\n\n\u003e Ensure your API keys are valid and have the appropriate access privileges.\n\n---\n\n## Input Data Format\n\nThis framework supports **ABCD v1.1**, **MultiWOZ 2.0**, or any **custom dataset** formatted as follows:\n\n```json\n{\n  \"conversation_1\": [\n    {\"role\": \"agent\", \"content\": \"Hello, how can I help you today?\"},\n    {\"role\": \"customer\", \"content\": \"I need assistance with my account.\"},\n    {\"role\": \"action\", \"content\": \"Agent opened account details.\"}\n  ]\n}\n```\n\n- Save your data file as: `data/processed_formatted_conversations.json`\n\n---\n\n## Run the Pipeline\n\n```bash\npython main.py \\\n    --file_path data/processed_formatted_conversations.json \\\n    --num_sampled_data 500 \\\n    --min_clusters 10 \\\n    --max_clusters 30 \\\n    --model_name 'sentence-transformers/all-mpnet-base-v2' \\\n    --label_model 'open-mixtral-8x22b' \\\n    --tau 0.15 \\\n    --top_k 2 \\\n    --alpha 0.8\n```\n\n---\n\n## Advanced Configuration\n\n| Parameter            | Description                                      | Default                         |\n|----------------------|--------------------------------------------------|---------------------------------|\n| `--num_sampled_data` | Number of conversations to sample                | 100                             |\n| `--min_clusters`     | Minimum cluster count for elbow method           | 5                               |\n| `--max_clusters`     | Maximum cluster count for elbow method           | 15                              |\n| `--model_name`       | Sentence embedding model                         | 'all-MiniLM-L12-v2'             |\n| `--label_model`      | LLM for labeling dialogue state clusters         | 'open-mixtral-8x22b'            |\n| `--tau`              | Minimum transition probability threshold         | 0.1                             |\n| `--top_k`            | Number of outgoing edges to retain per node      | 1                               |\n| `--alpha`            | Balance between semantic similarity and topology | 1.0                             |\n\n---\n\n## Citation\n\nIf you use this codebase for your research, please cite:\n\n```bibtex\n@inproceedings{achref2025conversationalgraph,\n  title={A Computational Approach to Modeling Conversational Systems: Analyzing Large-Scale Quasi-Patterned Dialogue Flows},\n  author={Mohamed Achref Ben Ammar and Mohamed Taha Bennani},\n  conference={IEEE EUROCON 2025 - The 21st International Conference on Smart Technologies},\n  year={2025},\n  publisher={IEEE},\n}\n```\n\n---\n\n## Contact\n\nFor questions, collaborations, or feedback, feel free to reach out:\n\n- **Mohamed Achref Ben Ammar** – [mohamedachref.benammar@insat.ucar.tn](mailto:mohamedachref.benammar@insat.ucar.tn)  \n- **Mohamed Taha Bennani** – [taha.bennani@fst.utm.tn](mailto:taha.bennani@fst.utm.tn)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefbenammar404%2Fquasi-patterned-conversations-analysis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fachrefbenammar404%2Fquasi-patterned-conversations-analysis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fachrefbenammar404%2Fquasi-patterned-conversations-analysis/lists"}