{"id":20839321,"url":"https://github.com/ailln/fuzi-nlu","last_synced_at":"2025-10-03T15:41:13.965Z","repository":{"id":41822671,"uuid":"154306712","full_name":"Ailln/fuzi-nlu","owner":"Ailln","description":"🤖️ 聊天机器人——夫子的「自然语言理解」模块","archived":false,"fork":false,"pushed_at":"2022-08-06T05:21:47.000Z","size":8856,"stargazers_count":87,"open_issues_count":3,"forks_count":26,"subscribers_count":7,"default_branch":"main","last_synced_at":"2023-03-03T17:17:25.272Z","etag":null,"topics":["chatbot","intent-classification","joint-nlu","nlu","pytorch","question-answering","seq2seq","seq2seq-chatbot","slot-filling","socketio"],"latest_commit_sha":null,"homepage":"https://fuzi.ailln.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ailln.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}},"created_at":"2018-10-23T10:12:24.000Z","updated_at":"2023-02-22T09:49:38.000Z","dependencies_parsed_at":"2022-09-15T16:22:44.666Z","dependency_job_id":null,"html_url":"https://github.com/Ailln/fuzi-nlu","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ailln%2Ffuzi-nlu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ailln%2Ffuzi-nlu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ailln%2Ffuzi-nlu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ailln%2Ffuzi-nlu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ailln","download_url":"https://codeload.github.com/Ailln/fuzi-nlu/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225110501,"owners_count":17422412,"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","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":["chatbot","intent-classification","joint-nlu","nlu","pytorch","question-answering","seq2seq","seq2seq-chatbot","slot-filling","socketio"],"created_at":"2024-11-18T01:13:19.765Z","updated_at":"2025-10-03T15:41:13.853Z","avatar_url":"https://github.com/Ailln.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FUZI NLU\n\n[![Apache2 License](https://img.shields.io/badge/license-Apache2-orange.svg)](https://github.com/Ailln/fuzi-nlu/blob/master/LICENSE)\n[![stars](https://img.shields.io/github/stars/Ailln/fuzi-nlu.svg)](https://github.com/Ailln/fuzi-nlu/stargazers)\n[![forks](https://img.shields.io/github/forks/Ailln/fuzi-nlu.svg)](https://github.com/Ailln/fuzi-nlu/network/members)\n\n🤖️ 聊天机器人——`夫子`的「自然语言理解」模块。\n\n## 1 简介\n\n`夫子` 聊天机器人有 7 个模块组成：\n1. [fuzi-bot](https://github.com/Ailln/fuzi-bot): 聊天界面模块，与用户进行交互。\n2. [fuzi-bot-api](https://github.com/Ailln/fuzi-bot-api): 聊天接口模块，与其他后端模块通信。\n3. [fuzi-nlu](https://github.com/Ailln/fuzi-nlu): 自然语言处理模块，理解用户的问题。\n4. fuzi: 对话管理模块，推断用户的意图。\n5. fuzi-admin: 后台管理模块，管理机器人的设置。\n6. fuzi-admin-api: 后台管理接口，与其他后端模块通信。\n7. fuzi-mark: 数据标注模块，标注用户的问题。\n\n![framework](.github/fuzi-framework.png)\n\n常见地聊天机器人有两种：\n\n1. 闲聊型 `open domain`\n2. 任务型 `task oriented`\n\n本项目属于第二种，即面向任务的聊天机器人。这类型机器人的常见应用是智能客服，**目的是为了解决用户的明确需求**。\n\n![flow](.github/chatbot-flow.png)\n\n上图为面向任务的聊天机器人的一般流程，该项目目前实现了第一部分的 `NLU` 功能，包含 `Slot Filling` 和 `Intent Prediction`。\n\n## 2 预览\n\n![预览](.github/fuzi-preview.png)\n\n[\u003e\u003e 点我立即尝试 \u003c\u003c](https://fuzi.ailln.com)\n\n## 3 数据\n\n### 3.1 数据集\n\n1. `guotie`：这份数据集的主要内容是关于我家🐱`锅贴`，只使用了意图识别的功能。\n2. `weather`: 在 Github 上找到的一份关于天气的 [中文公开数据集](https://github.com/howl-anderson/NLU_benchmark_dataset/tree/master/dataset/dialogflow/weather/rasa_format) 。\n3. `fewjoint`: [SMP2020](https://atmahou.github.io/attachments/FewJoint.zip) 。\n\n### 3.2 数据标注\n\n这里使用 RASA 开源的标注工具 [RASA-NLU-Trainer](https://github.com/RasaHQ/rasa-nlu-trainer) 进行标注。\n\n\u003e 我自己部署了一份在线上，可以[直接使用](https://chatbot.dovolopor.com/labeling/) 。\n\n标注完成后需要进行格式转化才能使用，这里以 `/back/data/guotie.json` 为例：\n\n```bash\npip install rasa==2.6.3\n\ncd fuzi-nlu/data\nmkdir guotie\n\n# rasa 暂时不支持从 json 直接转成 yaml，因此需要先转 md，再转 yaml\nrasa data convert nlu -f md --data guotie.json --out ./guotie/nlu.md\nrasa data convert nlu -f yaml --data ./guotie/nlu.md --out ./guotie/\n\nrm ./guotie/nlu.md\nmv ./guotie/nlu_converted.yml ./guotie/nlu.yml\n\n# 生成 domain\npython -m run.generate_domain_from_nlu --nlu ./data/guotie/nlu.yml --domain ./data/guotie/domain.yml\n```\n\n## 4 快速上手\n\n```shell\ngit clone https://github.com/Ailln/fuzi-nlu.git\n\ncd fuzi-nlu\n# 安装依赖\npip install -r requirements.txt\n\npython -m run.server\n```\n\n## 5 部署\n\n### 5.1 Docker\n\n```shell\ngit clone https://github.com/Ailln/fuzi-nlu.git\n\n# in amd64\ncd fuzi-nlu\n# 打包\ndocker build -t fuzi-nlu:1.0.0 .\n# 运行\ndocker run -d --restart=always --name fuzi-nlu -p 8081:8081 fuzi-nlu:1.0.0\n\n# in arm64\ncd fuzi-nlu\n# 打包\ndocker build -t fuzi-nlu:1.0.0 -f deploy/arm64.Dockerfile .\n# 运行\ndocker run -d --restart=always --name fuzi-nlu -p 8081:8081 fuzi-nlu:1.0.0\n```\n\n### 5.2 Kubernetes\n\n```shell\ncd fuzi-nlu\n# 准备好镜像\nkubectl apply -f deploy/deployment.yaml\n```\n\n## 6 其他\n\n### 6.1 重新训练模型\n\n```shell\ncd fuzi-nlu\n# 训练\npython -m run.train\n\n# 测试\npython -m run.test\n```\n\n### 6.2 QPS Test\n\n```shell\npip install locust -U\n\nlocust -f test/qps_test.py -u 10 -r 2\n# 打开 http://127.0.0.1:8089\n```\n\n## 7 参考\n\n- [Tensorflow动态seq2seq使用总结（r1.3）](https://github.com/applenob/RNN-for-Joint-NLU/blob/master/tensorflow_dynamic_seq2seq.md)\n- [Attention-Based Recurrent Neural Network Models for Joint Intent Detection and Slot Filling](https://arxiv.org/abs/1609.01454)\n- [BERT for Joint Intent Classification and Slot Filling](https://arxiv.org/pdf/1902.10909.pdf)\n- [从“连接”到“交互”—阿里巴巴智能对话交互实践及思考](https://yq.aliyun.com/articles/144035)\n- [A Frustratingly Easy Approach for Joint Entity and Relation Extraction](https://arxiv.org/pdf/2010.12812.pdf)\n- [FewJoint: A Few-shot Learning Benchmark for Joint Language Understanding](https://arxiv.org/abs/2009.08138)\n\n## 8 许可证\n\n[![](https://award.dovolopor.com?lt=License\u0026rt=Apache2\u0026rbc=orange)](./LICENSE)\n[![](https://award.dovolopor.com?lt=Ailln's\u0026rt=idea\u0026lbc=lightgray\u0026rbc=red\u0026ltc=red)](https://github.com/Ailln/award)\n\n## 9 交流\n\n请添加微信号：`Ailln_`，备注「fuzi」，我邀请你进入交流群。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Failln%2Ffuzi-nlu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Failln%2Ffuzi-nlu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Failln%2Ffuzi-nlu/lists"}