> ## Documentation Index
> Fetch the complete documentation index at: https://koreai.mintlify.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Traits

<Badge icon="arrow-left" color="gray">[Back to NLP Topics](/ai-for-service/automation/natural-language/nlp-topics)</Badge>

Traits identify specific characteristics in user utterances—before intent recognition—and use them to drive intent detection, dialog transitions, and entity population.

**Example:** The utterance "My flight is late and I will miss my connection" expresses the traits `flight delay` and `emergency`. The `emergency` trait routes the conversation to a human agent without requiring a direct intent match.

***

## What Traits Enable

* **Indirect entity extraction** — infer entity values from context (e.g., "seat in front with extra legroom" implies First Class).
* **Rule-based intent recognition** — trait rule matches are treated as definitive matches.
* **Keyword/phrase identification** — match traits to specific words and synonyms.
* **Inference from sentence context** — detect traits from overall meaning, not just keywords.

***

## Trait Definition

Go to **Natural Language > Training > Traits**.

### Trait Type

A Trait Type is a collection of related traits (e.g., `Flight Fare` containing `Economy`, `Business`, `First Class`).

| Option            | Description                                                                           |
| ----------------- | ------------------------------------------------------------------------------------- |
| **ML-Based**      | Trained with words, phrases, or utterances. One trait per type is detected.           |
| **Pattern-Based** | Trained with patterns. Multiple traits can be detected; ordering determines priority. |

**Network type** (ML-Based):

* **Standard** — n-gram model (configurable up to 5-gram).
* **Few-shot Model** — embedding-based. Options: BGE M3 and Pretrained MPNet.

**N-gram configuration:**

* **n-gram**: set max sequence length (1-5; default 1).
* **skip-gram**: set sequence length (2-4) and max skip distance (1-3).

<Note>
  - Trait names must be unique within a Trait Type.
  - Traits with the same name can exist across multiple types, but are difficult to distinguish in rules/detection results.
  - Only spaces and underscores are allowed as special characters in trait names.
  - For multilingual assistants, add language-specific traits.
  - When a trait name is modified, manually update all rules that reference it — the platform does not do this automatically.
</Note>

***

## Trait Association Rules

### Dialog Execution

Link traits to intents using rules. A trait rule match is treated as a definitive intent match.

**Add rules from:**

* **Traits section** — click **Add New Rule**.
* **Intent Node** — **NLP Properties > Rules** section.
* **Natural Language > Training > Intents** — click the **Rules** tab for an intent.

Each rule can have one or more conditions using AND. Multiple rules per intent are OR-ed — the intent matches if any one rule matches.

### Knowledge Graph Intents

Associate traits with KG terms:

1. Go to **Knowledge AI > FAQs > Manage KG**.
2. Click the **Settings (gear icon)** on a node.
3. Assign the trait. One trait per node.

***

## Trait Detection

* One trait per Trait Type is detected (for ML-based types).
* Multiple traits can be detected for pattern-based types.
* Detected traits are added to the context object: `context.traits` (array of detected trait names).

Use `context.traits` in:

* Intent identification rules.
* Dialog transition conditions (`contains` operator).
* Entity population logic.
* App definitions.

Trait detection data is included in Batch Testing reports and the Find Intent API.

***

## Dialog Transition Using Traits

Use `context.traits` in **Connection Rules** (under dialog **Connection > Properties**):

```javascript theme={null}
context.traits contains "economy"
```

***

## Use Case Example

**Scenario:** Book a flight based on cost preference.

1. Create Trait Type `Flight Fare` with trait `Economy` trained on utterances like "low cost", "budget", "cheapest".
2. Add a rule for the `Book Flight` intent: trigger when `Economy` trait is detected.
3. Add connection conditions in the dialog: branch based on `context.traits contains "economy"`.

**Result:** "I am looking for a low-cost option to London" triggers the `Book Flight` intent and routes to the economy booking flow.
