RASA學習筆記-新建第一個rasa項目(二)


在第上篇新建的rasa項目基礎上添加form

一、修改domain.yml

在domain.yml中定義slots,添加如下所示內容

定義response 模板

二、修改data/nlu.yml

補充訓練數據

三、修改 data/stories.yml

在stories.yml中添加如下內容:

version: "2.0"
nlu:
- intent: greet
  examples: |
    - hey
    - hello
    - hi
    - hello there
    - good morning
    - good evening
    - moin
    - hey there
    - let's go
    - hey dude
    - goodmorning
    - goodevening
    - good afternoon
    - fine, thank you, and you?
- intent: goodbye
  examples: |
    - good afternoon
    - cu
    - good by
    - cee you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later
- intent: affirm
  examples: |
    - yes
    - y
    - indeed
    - of course
    - that sounds good
    - correct
    - sure
    - ok
    - why not
    - ok great
    - yes I did
    - yeah, great
    - pretty good
    - fine
    - I sure did
    - more or less
- intent: deny
  examples: |
    - no
    - n
    - never
    - I don't think so
    - don't like that
    - no way
    - not really
    - none
    - absolutely not
    - no thanks
    - didn't do any
    - no I didn't 
    - could have been better
    - not great 
    - nope
- intent: inform
  examples: |
    - a full [8 hours](sleep)
    - only [four hours](sleep)
    - about [6 hours](sleep)
    - [low](stress)
    - [medium](stress)
    - [high](stress)
    - yes, I went for a [run](exercise)
    - played [football](exercise)
    - I did a [workout](exercise) video
    - Be more patient with my family
    - eat better
    - eat less junk food
    - Go to bed earlier
    - too much sweets
    
- intent: out_of_scope
  examples: |
    - that's not what i want to do 
    - wait stop
    - your are no help
    - this is no help at all
    - how old are you
    - I want to order a pizza
    - tell me the weather
    - I already told you that
    - none of your business
    - stop asking
    - never mind
    - I want to do something else
    - I changed my mind
- intent: mood_great
  examples: |
    - perfect
    - great
    - amazing
    - feeling like a king
    - wonderful
    - I am feeling very good
    - I am great
    - I am amazing
    - I am going to save the world
    - super stoked
    - extremely good
    - so so perfect
    - so good
    - so perfect
- intent: mood_unhappy
  examples: |
    - my day was horrible
    - I am sad
    - I don't feel very well
    - I am disappointed
    - super sad
    - I'm so sad
    - sad
    - very sad
    - unhappy
    - not good
    - not very good
    - extremly sad
    - so saad
    - so sad
- intent: thankyou
  examples: |
    - okay great thanks
    - thank you
    - sure thanks
    - thanks bye
    - thanks
- intent: bot_challenge
  examples: |
    - are you a bot?
    - are you a human?
    - am I talking to a bot?
    - am I talking to a human?
- intent: ask_lower_stress
  examples: |
    - What do I do if I'm too stressed?
    - How can I lower my stress level
    - What are some good ways to lower stress?
    - What are good ways to relax?
    - What are some things I can do to lower my stress?
- intent: ask_eat_healthy
  examples: |
    - What's considered a healthy diet?
    - What's considered a good diet?
    - How do I follow a healthy diet?
    - How do I eat healthy?
- intent: ask_exercise
  examples: |
    - What's a good amount of exercise for someone in their thirties?
    - How much exercise should I be getting?
    - How much exercise is recommended?
    - Is walking once a day enough exercise?
    - How much exercise should I do every day?
    - How many times per week should I go to the gym?
- intent: n
  examples: |
    - \stop

四、修改 actions/action.py

五、修改 config.yml

添加橫線部分內容

六、修改 end_points.yml

七、訓練模型

rasa train

八、啟動模型

  1. 在一個窗口開啟服務
rasa run actions

  1. 另開一個窗口,啟動應用
rasa shell

九、對話


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM