Rasa Core version:0.9.6
Python version: 3.6
Operating system (windows, osx, ...): Windows 10
Issue:
I want to find a way to automatically convert any conversation into a story format to be able to train my bot.
I have generated my stories using the online training session, or the machine teaching offered by RASA Core, but I found this technique impractical when I want to have a big training data.
I want to use any conversation and be able to automatically convert it into a story without having to do so manually. Any ideas?
Content of domain file (if used & relevant):
This can be done by adding a end action.
For example:
If conversations end with bye statement, just create a action for bye which has a function to create stories and at the end of the conversation it will convert the entire conversation into the story and save the same into a file you named.
Add the below lines to you action.py file
from rasa_core.events import Restarted
from rasa_core.events import StoryExported
#---------------Your Entire Action Code here-----------------------
class ActionByeBye (Action):
def name(self):
return 'action_bye'
def run (self, dispatcher, tracker, domain):
return[StoryExported("data.md"),Restarted()]
Change the stories.md file with the below file.
## Generated Story 3320800183399695936
* greet
- utter_greet
* inform
- utter_ask_location
* inform{"location": "italy"}
- slot{"location": "italy"}
- action_weather
- slot{"location": "italy"}
* goodbye
- utter_goodbye
- action_bye
- export
## Generated Story -3351152636827275381
* greet
- utter_greet
* inform[location=London]
- slot{"location": "London"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## Generated Story 8921121480760034253
* greet
- utter_greet
* inform
- utter_ask_location
* inform[location=London]
- slot{"location": "London"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## Generated Story -5208991511085841103
- slot{"location": "London"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## Generated Story -5208991511085841103
- slot{"location": "London"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## story_001
* greet
- utter_greet
* inform
- utter_ask_location
* inform[location=London]
- slot{"location": "London"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## story_002
* greet
- utter_greet
* inform[location=Paris]
- slot{"location": "Paris"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## story_003
* greet
- utter_greet
* inform
- utter_ask_location
* inform[location=Vilnius]
- slot{"location": "Vilnius"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## story_004
* greet
- utter_greet
* inform[location=Italy]
- slot{"location": "Italy"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
## story_005
* greet
- utter_greet
* inform
- utter_ask_location
* inform[location=Lithuania]
- slot{"location": "Lithuania"}
- action_weather
* goodbye
- utter_goodbye
- action_bye
- export
Change the weather_domian.yml file with the below file.
slots:
location:
type: text
intents:
- greet
- goodbye
- inform
entities:
- location
templates:
utter_greet:
- 'Hello! How can I help?'
utter_goodbye:
- 'Talk to you later.'
- 'Bye bye :('
utter_ask_location:
- 'In what location?'
actions:
- utter_greet
- utter_goodbye
- utter_ask_location
- actions.ActionWeather
- actions.ActionByeBye
Thanks, it worked !
I see that you used return[StoryExported("data.md"),Restarted()] in action.py and - export in stories.md so I wanted to ask if - export is necessary since you already return this... or in contrast if you should have added - action_restart in the stories.md after the - export action? Or either solution would work?
@balinda-1995 do you need any more help or can we close this issue?
yes i am done, thanks!
Most helpful comment
Thanks, it worked !