All Projects → BI4O → rasa_milktea_chatbot

BI4O / rasa_milktea_chatbot

Licence: other
Chatbot with bert chinese model, base on rasa framework(中文聊天机器人,结合bert意图分析,基于rasa框架)

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to rasa milktea chatbot

virtual-assistant
Virtual Assistant
Stars: ✭ 67 (-30.93%)
Mutual labels:  nlu, rasa
Clue
中文语言理解测评基准 Chinese Language Understanding Evaluation Benchmark: datasets, baselines, pre-trained models, corpus and leaderboard
Stars: ✭ 2,425 (+2400%)
Mutual labels:  nlu, bert
opensnips
Open source projects related to Snips https://snips.ai/.
Stars: ✭ 50 (-48.45%)
Mutual labels:  nlu, rasa
bert-as-a-service TFX
End-to-end pipeline with TFX to train and deploy a BERT model for sentiment analysis.
Stars: ✭ 32 (-67.01%)
Mutual labels:  bert, bert-as-service
app rasa chat bot
a stateless chat bot to perform natural language queries against the App Store top charts
Stars: ✭ 20 (-79.38%)
Mutual labels:  nlu, rasa
Botpress
🤖 Dev tools to reliably understand text and automate conversations. Built-in NLU. Connect & deploy on any messaging channel (Slack, MS Teams, website, Telegram, etc).
Stars: ✭ 9,486 (+9679.38%)
Mutual labels:  nlu, rasa
Rasa
💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
Stars: ✭ 13,219 (+13527.84%)
Mutual labels:  nlu, rasa
Nlp Architect
A model library for exploring state-of-the-art deep learning topologies and techniques for optimizing Natural Language Processing neural networks
Stars: ✭ 2,768 (+2753.61%)
Mutual labels:  nlu, bert
rasa-chatbot
Sample chatbot with rasa stack
Stars: ✭ 29 (-70.1%)
Mutual labels:  nlu, rasa
rasa bot example
This is an example rasa chatbot implementation that can be connected to your Facebook page.
Stars: ✭ 14 (-85.57%)
Mutual labels:  nlu, rasa
rasa-bert-finetune
支持rasa-nlu 的bert finetune
Stars: ✭ 46 (-52.58%)
Mutual labels:  rasa, bert
rasa-docker-arm
Rasa Docker image for ARMv7. Runs on a Raspberry Pi.
Stars: ✭ 19 (-80.41%)
Mutual labels:  nlu, rasa
clofus-chatbot
Clofus® Chat bot Platform using rasa core and rasa nlu similar to rasa x but opensource demo https://clofus.github.io/clofus-chatbot/
Stars: ✭ 61 (-37.11%)
Mutual labels:  nlu, rasa
BERT-BiLSTM-CRF
BERT-BiLSTM-CRF的Keras版实现
Stars: ✭ 40 (-58.76%)
Mutual labels:  bert
chatbot-generative
A generative-model based chatbot trained with Chinese corpus
Stars: ✭ 14 (-85.57%)
Mutual labels:  chinese-chatbot
Text-Summarization
Abstractive and Extractive Text summarization using Transformers.
Stars: ✭ 38 (-60.82%)
Mutual labels:  bert
consistency
Implementation of models in our EMNLP 2019 paper: A Logic-Driven Framework for Consistency of Neural Models
Stars: ✭ 26 (-73.2%)
Mutual labels:  bert
pen.el
Pen.el stands for Prompt Engineering in emacs. It facilitates the creation, discovery and usage of prompts to language models. Pen supports OpenAI, EleutherAI, Aleph-Alpha, HuggingFace and others. It's the engine for the LookingGlass imaginary web browser.
Stars: ✭ 376 (+287.63%)
Mutual labels:  nlu
classifier multi label
multi-label,classifier,text classification,多标签文本分类,文本分类,BERT,ALBERT,multi-label-classification
Stars: ✭ 127 (+30.93%)
Mutual labels:  bert
anonymisation
Anonymization of legal cases (Fr) based on Flair embeddings
Stars: ✭ 85 (-12.37%)
Mutual labels:  bert

Rasa Milk Tea Chatbot (chinese)

a milk tea waiter chatbot for chinese, if you don't know rasa yet, refer to mini rasa tutorial below

or read the rasa offical docs

  • installation

    you need to download bert_chinese_model and unzip it first: chinese_L-12_H-768_A-12

    git clone https://github.com/BI4O/rasa_milktea_chatbot.git
    cd rasa_milktea_chatbot
    pip install -r requirements.txt -i https://pypi.tuan.tsinghua.edu.cn/simple
  • quick start

    1. start bert server

      bert-serving-start -model_dir path/to/chinese_L-12_H-768_A-12/ -num_worker=1

    2. jump to milktea

      cd milktea

    3. start action server

      rasa run actions

    4. train a model

      rasa train

    5. talk to your chatbot

      rasa shell

      you can order 3 different products,more can be added to model yourself

      • 奶茶
      • 咖啡
      • 卡布奇诺

      and choose 3 sizes

      • 特大
  • mini rasa tutorial

    1. 创建一个新的项目
    2. 查看NLU培训数据
    3. 定义模型配置,写下第一个故事Story
    4. 定义这个故事story的作用域domain
    5. 训练模型
    6. 测试你写好的助手
    1. 创建新项目

      路径指向一个新的空文件夹 cd path/to/a/blank/folder

      在这个文件夹里面创建新的rasa项目 rasa init --no-prompt

      文件夹中将会生成以下的文件:

      __init__.py 空文件用于定位
      actions.py 用于定义动作(自定义脚本代码)
      config.yml 配置NLU和core模型
      credentials.yml 连接到其他服务器的细节(不常用)
      data/nlu.md 我的自定义NLU训练数据
      data/stories.md 我的自定义故事stories
      domain.yml 助手的定义域domian
      endpoints.yml 连接到fb message等的轨道(不常用)
      models/<timestamp>.tar.gz 模型及其参数文件
    2. 自定义NLU训练数据

      cat data/nlu.md

      显示如下

      ## intent:order
      - [奶茶](type)
      - [咖啡](type)
      - 我想要一杯[奶茶](type)
      - 要杯[奶茶](type)
      - 有[奶茶](type)吗
      - 有[奶茶](type)卖吗
      - 想要一杯[咖啡](type)
      - 要杯[咖啡](type)
      - 有[咖啡](type)吗
      - 我想要一杯[卡布奇诺](type)
      - 要杯[卡布奇诺](type)
      - [卡布奇诺](type)
      
      ## intent:inform_size
      - [中](size)
      - [中](size)的
      - [中](size)杯
      - [中](size)杯吧
      - 要[中](size)杯
      - [大](size)
      - [大](size)的
      - [大](size)杯
      - [大](size)杯吧
      - 要[大](size)杯
      - [特大](size)
      - [特大](size)的 
      - [特大](size)杯
      - [特大](size)杯吧
      - 要[特大](size)杯
      • intent 表示意图,需要以##开头,以换行结尾。比如说这里显示的是两个意图1. 下单,2. 告知奶茶的规格,所有客户可能会用的说辞都应该放在这里,用于nlu模型学习怎么去理解一个人说的话

      • [value](entity) entity表示实体,value表示实体具体的值,经过训练后,nlu模型就可以给core模型返回类似这样的变量:{"type":"奶茶","size":"大"},这样core模型就可以根据typesize这两个参数做出相应的回应

    3. 定义模型配置

      1. 配置文件config.yml将定义前面的NLU模块和你的模型会用到的Core元素,本次使用的是来自大神写好的组件,这里也强烈推荐大家前往学习https://github.com/GaoQ1/rasa_nlu_gq
      2. NLU的配置属于决定了使用的语言和管道,Core的policies的关键词决定了模型见会使用到的策略policies
      3. note: 如果你只是想建立一个chatbot而不想了解太多关于算法的细节,config.yml可以不用改,直接用
    4. 自定义故事

      查看写好的故事

      cat data/stories.md

      ## order naicha
      - order{"type": "奶茶"}
        - slot{"type": "奶茶"}
        - utter_ask_size
      - inform_size{"size": ""}
        - slot{"size": ""}
        - utter_affirm
        - confirm
        - action_charge
        - utter_goodbye

      故事的组成

      1. ##开头表示的是这个故事的名称,一个描述性的名字
      2. 故事以换行结束,下一个故事##开头
      3. *开头的表示为用户意图 intent{"entity1": "value", "entity2": "value"}
      4. -开头的表示为机器人执行的动作actions

      用户信息

      1. 在定义故事的时候,不需要知道用户具体说了什么,而是根据NLU pipeline中输出的意图intent和实体entity的组合来猜测用户的所有可能的需求
      2. 实体entity是很重要的,因为助手学习动作的时候,需要同时结合这两者

      动作acitons

      ​ actions有两种类型

      1. utter_xxx 可以直接返回要回复的话术,只需要在domain.yml中说明就可以用了

      2. action_xxx 可以执行你想要的自定义操作,除了需要在domain.yml中说明外,还需要在aciton.py文件中添加。比如你想有一个自定义动作action_HelloWorld

        • 首先把这个自定义动作添加到domain.yml的acitons下

          actions:
          - aciton_HelloWorld
          
        • 然后在acitons.py文件中添加新的类

          class YourCustomAction(Action):
              def name(self):
                  # 这个返回的值必须和stories.md和domain.yml中说明的一致
                  return "action_HelloWorld"
              def run(self,dispatcher,tracker,domain):
                  # 定义这个动作要执行的你想要的操作
                  # 比如我想在对话中返回给用户的是HellowWorld!
                  dispatcher.utter_message('HelloWorld!')
                  return []
    5. 定义域domain

      cat domain.yml

      intents:  
        - greet:
          triggers: utter_greet
        - goodbye:
          triggers: utter_goodbye
        - confirm
        - deny
        - order
        - thanks
        - inform_size
        - unknown_intent
         
      actions: 
        - utter_greet
        - utter_ask_order_what
        - utter_ask_size
         
      entities:
        - type
        - size
      
      slots:
        type:
          type: text
        size:
          type: text
         
      templates:
        utter_greet:
          - text: "你好"
        utter_ask_order_what:
          - text: "想要喝点什么?"
        utter_ask_size:
          - text: "想要什么规格的呢?我们有中/大/特大杯"

      其中

      1. intents:用户意图
      2. entities:实体
      3. slots:槽
      4. actions:助手说和做的事情
      5. templates:助手根据actions具体要做的事情

      因为在这种情况下,我们的动作action只是向用户发送话语作为回复,这些简单的actions都是utter_开头的动作actions,这种动作需要助手在templates中选择语句进行回复,实际上还可以定义更多的动作见Custom Actions

    6. 训练模型

    使用下面的命令,会自动检查domain/stories/NLU中的不同而重新对模型进行训练,训练好的模型将会被打上时间戳time stamp作为新的模型 rasa train

    1. 启动助手进行对话

      rasa shell

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].