본문으로 바로가기

주요파일

 

다음 해당 파일에 대해서 알아보겠습니다.

 

https://rasa.com/docs/rasa/user-guide/rasa-tutorial/

 

 

nlu.md

 

nlu.md 파일은 Rasa NLU Model 의 훈련 데이터로, 분류(Classification)를 나타냅니다.

 

샘플 훈련 데이터의 포맷을 보시면 다음과 같은 형식으로 구분하고 있습니다.

## intent:Name
- Sentence
- Sentence
...

 

Classification: greet, goodbye, affirm, deny ...

 

 

이 밖에도 NLU Model 은 다음과 같이 Markdown, JSON, 단일 파일, 여러파일로도 훈련을 지원하고 있습니다.

 

https://rasa.com/docs/rasa/nlu/training-data-format/

 

 

stories.md

 

stories.md 파일은 Rasa Core Model 의 훈련 데이터로, 대화의 흐름을 나타냅니다.

 

샘플 훈련 데이터의 포맷을 보시면 다음과 같은 형식으로 구분하고 있습니다.

 

* Intent Name 은 앞서 본 nlu.md 안의 정의된 intent 입니다.

* response 는 domain.yml 에 정의 되어있습니다.

## Path Name
* Intent Name
  - response
* Intent Name
  - response
...

 

Story: happy path, sad path 1, sad path2, say goodbye

 

이 밖에도 Slot, Actions 등을 활용하여 상황에 맞고, 능동적인 응답을 지정할 수 있습니다.

 

 

domain.yml

 

stories.md 파일은 Rasa Core Model 을 위한 설정파일로, Model 이 알아야하는 intent, response 등을 정의 합니다. 

 

스토리에서 내용을 가져왔습니다.

utter_greet, utter_happy 부분이 domain.yml 에 정의된 response 에 해당됩니다.

## happy path
* greet
  - utter_greet
* mood_great
  - utter_happy

 

 

 

예제 훈련 데이터

 

nlu.md

## intent:greet
- 안녕
- 안녕하세요
- 하이

## intent:goodbye
- 안녕히 계세요
- 다음 기회에
- 그럼 이만

## intent:affirm
- 네
- 맞아
- 응
- 맞습니다

## intent:deny
- 아니
- 아니요
- 싫어

## intent:mood_great
- 기분이 좋아
- 행복해

## intent:mood_unhappy
- 우울해
- 기분이 안좋아

 

stories.md

## happy path
* greet
  - utter_greet
* mood_great
  - utter_happy

## sad path
* greet
  - utter_greet
* mood_unhappy
  - utter_cheer_up
  - utter_did_that_help
* affirm
  - utter_affirm

## goodbye
* goodbye
  - utter_goodbye

 

domain.yml

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy

responses:
  utter_greet:
  - text: "안녕 인간"
  - text: "반갑다 인간"

  utter_cheer_up:
  - text: "힘내라 인간"
  - text: "나도 힘들다 인간"

  utter_did_that_help:
  - text: "도움이 필요한가"

  utter_affirm:
  - text: "내가 도움이 되었군"

  utter_happy:
  - text: "나도 기분이 좋군"

  utter_goodbye:
  - text: "수고해라"

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

 

 

실행

 

모델 학습 진행

rasa train

 

대화형 쉘 실행

rasa shell

 

happy path

greet > mood_great > utter_happy

 

sad path

greet > mood_unhappy > uttrer_cheer_up + utter_did_that_help > affirm > utter_affirm