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

# How the Nigerian Persona Engine works

> Inside the Nigerian Persona Engine — restaurant scoring weights, review tone calibration, multilingual output detection, and the implicit learning loop.

The Persona Engine is the cultural intelligence layer that separates NaijaTaste from a generic restaurant finder. It models how different types of Nigerian diners think, speak, and judge food — and produces output in their language.

## What the engine does

Two things, running on every request:

1. **Scores restaurants** against a user's persona to produce ranked recommendations
2. **Generates reviews** in the voice, tone, and language of that persona

Both use the same underlying model — the Nigerian Persona Engine.

## How recommendation scoring works

When a user searches, the engine runs a scoring pass:

1. **Persona weight vector** is loaded for the user's archetype
2. **Restaurant signals** are pulled from Google Places (rating, price level, category, review count)
3. **Signals are weighted** by persona — a Street Food Enthusiast's score weights price level 3× more than a Lagos Professional's
4. **Proximity decay** is applied — restaurants farther from the search area score lower
5. **Ranked list** is returned, top 5

The whole pass takes under 500ms.

## How review generation works

The persona controls four things in every review:

| Dimension                | What it sets                                        |
| ------------------------ | --------------------------------------------------- |
| **Tone**                 | How much Pidgin, how formal the language            |
| **Star calibration**     | What a 4-star experience means for this persona     |
| **Highlight vocabulary** | Which aspects of the restaurant get emphasised      |
| **Complaint patterns**   | What a negative review from this persona focuses on |

## Multilingual output

The engine produces output in five Nigerian languages based on the user's channel and preference:

| Language            | How it's selected                       |
| ------------------- | --------------------------------------- |
| **English**         | Default on web and API                  |
| **Nigerian Pidgin** | Set by persona or user preference       |
| **Yoruba**          | Detected from WhatsApp message language |
| **Hausa**           | Detected from WhatsApp message language |
| **Igbo**            | Detected from WhatsApp message language |

On WhatsApp, language detection is automatic — the agent reads your message language and responds in kind. Mid-conversation switches are handled correctly.

## The implicit learning layer

On top of the base persona, the engine maintains a learning layer per user. Every interaction is a signal:

```text theme={null}
save → liked this style
regenerate → didn't like this style
copy → approved the content
adjust → explicit preference captured
```

The last 50 signals are fetched on each new generation and passed to the model as `past_adjustments`. The `_extract_patterns()` function scans for:

* Feedback keywords with frequency thresholds (shorter, less hype, lower rating)
* Saved review rating averages
* Tone save vs. regenerate tallies
* Restaurant type regeneration counts

Matched patterns are appended to the prompt silently. No settings page. No setup.

## The three archetypes

<Card title="The three archetypes" icon="users" href="/persona-engine/the-three-archetypes">
  Deep dive on Lagos Professional, Street Food Enthusiast, and The Aunty — their calibrations, vocabularies, and what moves their scores.
</Card>
