YAML 이해하기

발행: (2026년 1월 3일 오후 09:50 GMT+9)
6 분 소요
원문: Dev.to

I’m happy to translate the article for you, but I need the actual text you’d like translated. Could you please paste the content (or the portions you want translated) here? I’ll keep the source link at the top and preserve all formatting, code blocks, URLs, and technical terms as requested.

내용

  • YAML
  • Intents
  • Entities
  • Slots

YAML (또는 YML)

YAML은 마크업 언어입니다. HTML이나 XML과 달리 웹사이트 디자인에 사용되지 않으며, RASA에서는 모든 설정 파일의 구조적 기반을 형성합니다.

  • YAML은 들여쓰기를 통해 계층 블록을 생성합니다.
  • type은 하위 타입(예: intents, slots, entities)을 포함하는 상위 클래스라고 생각할 수 있습니다.

일반적인 블록 구조

- type:
    examples: |
      - e.g. 1
      - e.g. 2
      - e.g. 3

이 패턴은 intents, slots, 또는 entities를 예시 구문과 함께 정의할 때 흔히 사용됩니다.

인텐트

인텐트사용자가 말하고자 하는 내용—메시지 뒤에 숨은 목적을 포착합니다. RASA의 NLU 컴포넌트는 같은 의미를 가진 다양한 표현을 하나의 인텐트로 매핑합니다.

예시 인텐트

사용자 발화매핑된 인텐트
배가 아픈 것 같아요intent_symptom_stomach_ache
배가 아파요intent_symptom_stomach_ache
복통이 있을지도 몰라요intent_symptom_stomach_ache

인텐트가 파이프라인을 통해 흐르는 방식

[User query] → [NLU: intent & entity prediction] → [Dialogue manager] → [Bot response]

예측의 JSON 표현

{
  "intent": {
    "name": "report_symptom",
    "confidence": 0.92
  },
  "entities": [
    {"entity": "symptom", "value": "cough"},
    {"entity": "duration", "value": "two days"}
  ]
}

예시 NLU 파일 (nlu.yml)

version: "3.1"

nlu:
  - intent: greet
    examples: |
      - hello
      - hi
      - good morning

  - intent: report_symptom
    examples: |
      - I have a headache
      - My head hurts
      - I've been coughing for two days

domain.yml에서 인텐트 선언하기

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

Source:

엔티티

인텐트가 사용자가 무엇을 원하는지에 답한다면, 엔티티는 발화에 언급된 구체적인 값을 제공합니다.

  • 엔티티를 통해 봇은 상세하고 상황에 맞는 정보를 제공할 수 있습니다.
  • 엔티티는 NLU 컴포넌트에 의해 추출되어 대화 관리자에게 전달됩니다.

엔티티 추출 예시 (JSON)

{
  "entities": [
    {"entity": "symptom", "value": "fever"},
    {"entity": "duration", "value": "three days"}
  ]
}

nlu.yml에서 엔티티 정의하기

nlu:
  - intent: report_symptom
    examples: |
      - I have a [fever](symptom)
      - I've been coughing for [two days](duration)
      - My [head](body_part) hurts

엔티티 유형

  • Word (자유 텍스트)
  • Categorical (미리 정의된 목록)
  • Numerical (숫자, 날짜 등)
  • Lookup / Regex (패턴 기반)

Slots

Slots은 RASA의 메모리 시스템입니다.

  • Entities단일 사용자 메시지에서 추출됩니다.
  • Slots는 여러 턴에 걸쳐 지속되어, 봇이 컨텍스트를 유지할 수 있게 합니다.

Why slots are needed

User: I have a fever.
Bot:  How long have you had it?
User: Three days.

봇은 증상이 fever라는 것을 기억하면서 duration을 물어야 합니다. Slots가 이 연속성을 가능하게 하며, 없으면 각 턴이 독립된 입력으로 처리됩니다.

Slot flow diagram

[User input] → [Intent & Entity extraction] → [Slot filling / update] → [Dialogue manager (policies)] → [Bot response]

Defining slots in domain.yml

slots:
  symptom:
    type: text
    influence_conversation: true
  duration:
    type: text
    influence_conversation: true

엔티티가 추출되면, 이름이 일치할 경우 RASA가 이를 자동으로 해당 슬롯에 매핑할 수 있습니다. 이 매핑은 NLU 출력과 대화 관리자의 의사결정 사이를 연결합니다.

TL;DR

  • YAML은 모든 RASA 설정 파일을 구조화합니다.
  • Intents는 사용자의 목표를 포착합니다.
  • Entities는 발화 내에서 특정 정보 조각을 포착합니다.
  • Slots는 이러한 정보 조각을 여러 턴에 걸쳐 저장하여 상황에 맞고 일관된 대화를 가능하게 합니다.

이러한 기본 요소들을 이해하는 것은 Stories, Rules, and Policies로 넘어가기 전에 필수이며, 이들은 인텐트, 엔티티, 슬롯을 기반으로 봇이 어떻게 반응할지 조정합니다.

Slots in JSON Representation

{
  "slots": {
    "symptom": "fever",
    "duration": "three days"
  }
}

Types of Slots

  • Text slots – 원시 문자열을 저장합니다 (예: 증상, 이름)
  • Categorical slots – 미리 정의된 집합으로 값이 제한됩니다 (예: mild / moderate / severe)
  • Boolean slots – true/false 플래그 (예: emergency_present)
  • Float / integer slots – 연령이나 복용량과 같은 수치 값
  • List slots – 여러 값을 저장합니다 (예: 여러 증상)

다음 블로그: 곧 공개됩니다.

Back to Blog

관련 글

더 보기 »

RGB LED 사이드퀘스트 💡

markdown !Jennifer Davis https://media2.dev.to/dynamic/image/width=50,height=50,fit=cover,gravity=auto,format=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%...

Mendex: 내가 만드는 이유

소개 안녕하세요 여러분. 오늘은 제가 누구인지, 무엇을 만들고 있는지, 그리고 그 이유를 공유하고 싶습니다. 초기 경력과 번아웃 저는 개발자로서 17년 동안 경력을 시작했습니다.