ConversionEntityExtraction.h header

#include <ew/app/ConversionEntityExtraction.h>

Namespace ew::app

ConvertedEntity struct

struct ew::app::ConvertedEntity

One entity the folder conversion proposes from source text – the widened form of ExtractedEntity (docs/AI_FOLDER_CONVERSION.md §4 C4): beyond name/category/summary it carries the entity's ALIASES (nicknames, alternate spellings – these feed auto-linking and spell-check on apply) and its structured FIELD VALUES ("Role: Protagonist", "Home: Evermere"), so a conversion lands a filled-in codex entry, not a stub.

Members

QString ew::app::ConvertedEntity::name

The proposed entity name.

QString ew::app::ConvertedEntity::category

The suggested category label ("Characters", "Locations", "Items", "Organizations", "Events", or "Other" when the model is unsure).

QString ew::app::ConvertedEntity::summary

A one-sentence summary grounded in the source text.

QStringList ew::app::ConvertedEntity::aliases

Nicknames and alternate names found in the text (may be empty; never contains the name itself).

std::vector<std::pair<QString, QString> > ew::app::ConvertedEntity::fields

Structured field values as (label, value) pairs, in proposal order.

bool ew::app::ConvertedEntity::operator==(const ConvertedEntity &) const =default

Value equality across all fields.

Functions

AiRequest ew::app::buildConversionEntityRequest(const QString &sourceText, const QStringList &existingNames)

Builds the AI request asking the model to extract fully-detailed entities from sourceText as strict JSON for parseConversionEntityResponse, excluding names already in existingNames. Pure (assembles the prompt only); the caller sets the model and sends via an AiProvider.

std::vector< ConvertedEntity > ew::app::parseConversionEntityResponse(const QString &content)

Parses the model reply into proposals. Tolerant exactly like the shipped extraction parsers (fence/prose-wrapped JSON via the hardened extractor; non-string scalars kept; empty names dropped; duplicate names case-insensitively collapsed to the first; an alias equal to the name is dropped; empty field labels/values dropped). Returns empty when no well-formed array is present. Pure and unit-testable.