diff --git a/.weksa/cultural-ontology/README.md b/.weksa/cultural-ontology/README.md deleted file mode 100644 index a424e82..0000000 --- a/.weksa/cultural-ontology/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Cultural Ontology CultCache Seeds - -This directory stores Weksa cultural ontology as CultCache `.cc` witnesses. - -## Starter Database - -- `starter-targets.cc` - -This store contains one catalog entry and three draft guarded profile entries: - -- `weksa.cultural_ontology.pt-BR.vanilla_brazilian.v0` -- `weksa.cultural_ontology.en.transatlantic.v0` -- `weksa.cultural_ontology.ja-JP.kanto.contemporary.v0` - -The catalog entry is: - -- `weksa.cultural_ontology.catalog.seed_targets.v0` - -The `.cc` file is the typed state witness. This README is only an inspection -guide; it does not own cultural ontology truth. - -The profiles follow `schemas/cultural-ontology-profile.md`: salience axes and -linguistic affordances are nested typed state with feature IDs, activation -gates, constraints, indexicality, evidence, uncertainty, and trace labels. - -Qdrant retrieval may later propose evidence bundles for these profiles. It does -not own accepted profile state. diff --git a/.weksa/cultural-ontology/starter-targets.cc b/.weksa/cultural-ontology/starter-targets.cc deleted file mode 100644 index 680b06c..0000000 Binary files a/.weksa/cultural-ontology/starter-targets.cc and /dev/null differ diff --git a/README.md b/README.md index 3133190..2b5d0d3 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ culture, and constraint, and the planned lowerer that turns an agent's meaning packet into the reader's display language. **What is valuable here.** The interlingua standard and the lowering design: a -meaning packet owns what is meant, a target-language profile owns register, +meaning packet owns what is meant, the scene state (live: `weksa scene put|dump`, labelled by the rule in +`docs/scene-annotation.md`; speaker documents are planned) owns the speaker's relation to the addressee, which selects register, address and politeness, and a lowerer owns surface text and leaves a trace. **The problem it solves.** An agent's outward speech today is one English @@ -24,11 +25,13 @@ measured. published schemas in `schemas/cultnet/`. - `data/corpus/corpus.cc`, `data/entity/entity.cc` and `data/interlingua/inventory.cc`: the English corpus, its entities and the inventory, read with `weksa corpus dump`, - `weksa entity dump` and `weksa inventory dump`. + `weksa entity dump` and `weksa inventory dump`. `data/original/inventory.cc` + carries its own Validation-informed lexicon revisions (5 and 6) for lowering + measurements; scored runs use `data/interlingua`. - [Lowering target](./docs/targets/interlingua-lowering.md) and [its map](./docs/targets/interlingua-lowering-map.md): the design, scoring and cut sequence. -- `data/`: the cultural ontology and target-language profile data. +- `data/`: the committed stores (corpora, entities, inventory, language ontology) and research data; there are no target-language profiles. - `settings/`: setting-specific proving grounds for language projects. **Live versus planned.** Live: docs, fixtures, examples, ontology data and the @@ -82,9 +85,17 @@ English, Brazilian Portuguese, Japanese, and later target-language dialogue. [Flavored English Lowering](./docs/flavored-english-lowering.md) remains the target-specific English receipt. -See [Target-Language Cultural Ontology Profiles](./data/target-language-ontology/README.md) -for the reviewable address, register, politeness, idiom, metaphor, and script -distinctions that target lowerers must inspect before producing output. +The language ontology is `data/ontology/ontology.cc` (read it with +`weksa ontology dump`): per language, the lexicon, grammar and discourse choices a lowerer +reads for a stance, a discourse and a scene relation. Only an entry with a Scene condition names an +address or politeness level; the relation, from `data/original/speaker-state.cc`, picks it. Its +en-US and ja-JP entries and the keeper scenes are model-drafted or model-annotated, never Test evidence. Nothing yet grows them from accepted +rounds; until that mint exists they change only by a new `weksa ontology admit`. ja-JP holds Scene entries `onto:ja-JP:10` to `:13`. It holds none for an above-status out-group +addressee, and none for an above-status in-group addressee below intimacy 700 (`:12` still selects +an in-group addressee at intimacy 700 or more, whatever the status). Two entries for the above-status +cases were withdrawn: a paired measure found they made the lowerer match the reference register less +often, and they stay out until a native reader attests them. +ja-JP `:5` (hedging), `:7` (affection) and `:8` (restrained sadness) carry certainty and restraint conditions, through `AtMostOrUnset` bounds (an unrated certainty or restraint does not defeat them), so the hedging, certainty, affection, restraint and sadness entries never co-select on the pairs `:5`/`:6`, `:4`/`:7`, `:6`/`:7` and `:6`/`:8`; ja-JP `:3` (anger) carries `AtMostOrUnset` hedge and affection bounds, as en-US `:3`, so `:3`/`:5` and `:3`/`:7` never co-select; the store has no retire, so that was a rebuild of `data/ontology/ontology.cc` with the ja-JP text unchanged. en-US `:3` (blunt anger) carries `AtMostOrUnset` hedge and affection bounds, and `:5` (hedging) and `:8` (affection) each an `AtMostOrUnset` certainty bound (as ja-JP `:7`), so `:3`/`:5`, `:3`/`:8`, `:5`/`:6` and `:6`/`:8` never co-select; `:5`'s certainty clause is that condition and no longer prose; `:6` and the Scene entry `:10` still co-select and are kept apart by scoping in the text. ja-JP `:9` (surprise) states its question ending as available, not prescribed, so `:6`/`:9`, `:5`/`:9` and `:3`/`:9` stay co-selectable and are reconciled by wording, not by condition. For the first AquaSynth speech-training handoff, see [Tiny PanPhon v0.1 Speech Curriculum](./examples/speech-training/tiny-panphon-v0.1/README.md). diff --git a/crates/weksa/examples/show_working.rs b/crates/weksa/examples/show_working.rs index 8c23fb2..6a31b26 100644 --- a/crates/weksa/examples/show_working.rs +++ b/crates/weksa/examples/show_working.rs @@ -259,6 +259,8 @@ fn lower_error(e: &LowerError) -> Value { LowerError::ConsentMissing { predication } => ("ConsentMissing", format!("{predication} is a request the packet does not carry the addressee's consent to")), LowerError::AskerNotAddressee { predication } => ("AskerNotAddressee", format!("the agent of {predication} is not the addressee")), LowerError::EntityRead { entity, .. } => ("EntityRead", format!("the entity store failed reading {entity}")), + LowerError::SceneUnread => ("SceneUnread", "the view's scene was never read".to_string()), + LowerError::SpeakerTokenTaken => ("SpeakerTokenTaken", "a referent cites the entity id the speaker token uses".to_string()), }; json!({ "variant": variant, "reason": reason }) } diff --git a/crates/weksa/src/context.rs b/crates/weksa/src/context.rs index 877c974..5b64758 100644 --- a/crates/weksa/src/context.rs +++ b/crates/weksa/src/context.rs @@ -10,7 +10,14 @@ //! [`Inventory`] and an [`EditFeedback`] and nothing else, so no held-out text, //! key or per-item score can reach it. A lowering prompt names the language it //! is said in on a language line; every language is named by its tag, none by a -//! default. +//! default. A lowering prompt also prints the target language's ontology +//! entries that `ontology::select` chose for the view; the caller never names +//! entries. +//! +//! An ontology mint prompt is a second Train-only prompt: the [`TrainItems`] of +//! one language, the inventory's Stance, Discourse and Scene features (the only +//! ones a condition can read) and that language's existing entry lines. It reads +//! no packet, no score and no held-out text. //! //! Item text may hold line breaks; the renderer indents every continuation line //! (`indented`), so item text cannot forge a `[key]` line or a paragraph. @@ -26,15 +33,17 @@ use std::marker::PhantomData; use serde::Serialize; use crate::corpus::{CorpusItem, CorpusItemId}; -use crate::inventory::{Inventory, InventoryEntry, OptionLabel, ValueKind}; +use crate::inventory::{Inventory, InventoryEntry, OptionLabel, Slot, ValueKind}; use crate::lower::{EntityForms, LowerError, entity}; +use crate::encode::{EntryOntologyDraft, OntologyDraft}; +use crate::ontology::{Condition, Layer, Ontology, Test, select}; use crate::packet::{ - Context, Discourse, EntityId, Extension, Predication, Referent, Relation, Stance, + Context, Discourse, EntityId, Extension, FeatValue, Grade, Predication, Referent, Relation, Stance, }; use crate::run::LADDER_STEP; use crate::split::{Checkpoint, Split, SplitScheme, fnv1a64, hex16}; use crate::store::{CorpusStore, normalized}; -use crate::validate::LoweringInput; +use crate::validate::{LoweringInput, SceneRead}; /// The instructions a mint prompt starts with: the editor's whole brief. Fixed /// per run by `PROMPT_SOURCE_DIGEST`. @@ -61,14 +70,14 @@ Fields: - predications: a list of {id, concept, frame, roles, features}; roles is a list of {role, filler}, filler a node id. - relations: a list of {relation, from, to, features}. - stance: {features}; the speaker's felt affect and restraint, never the affect the line displays. -Node ids are n1, n2, and so on, one per referent and predication. Every other id comes from the inventory listed below and must be live at its revision. Write each id in full, exactly as the inventory lines spell it, family prefix included: concept:7, never 7. An entity comes only from the entities line. A referent's concept is never null, even when it carries an entity: give the nearest concept id. Participants and audience list the node ids of referents, never an entity id: an entity speaker is a referent whose entity field holds it, and participants lists that referent's node id. +Node ids are n1, n2, and so on, one per referent and predication. Every other id comes from the inventory listed below and must be live at its revision. Write each id in full, exactly as the inventory lines spell it, family prefix included: concept:7, never 7. An entity comes only from the entities line. A referent's concept is never null, even when it carries an entity: give the nearest concept id. Participants and audience list the node ids of referents, never an entity id: an entity speaker is a referent whose entity field holds it, and participants lists that referent's node id. A predication holds each role at most once, and a feature list each feature at most once: two or more fillers of one role are one referent of kind group that fills the role, and each member is related to it by a member_of relation from the member to the group. A feature is {feature, value}; value is {\"Grade\": 0 to 1000}, {\"Option\": label} or {\"Flag\": true or false}, as the inventory lists the feature's kind."; /// The instructions a lowering prompt starts with: the lowerer's whole brief. /// Fixed per run by `PROMPT_SOURCE_DIGEST`. pub const LOWER_INSTRUCTIONS: &str = "\ Say the packet below in the language on the language line, as one utterance of its speaker: all of its meaning and nothing it does not carry. -Every id is the inventory's listed below and every feature value is as listed; a grade is permille, 0 to 1000. The stance is the speaker's felt affect and restraint: it shapes how the utterance is said, not what it says. +Every id is the inventory's listed below and every feature value is as listed; a grade is permille, 0 to 1000. The stance is the speaker's felt affect and restraint: it shapes how the utterance is said, not what it says. The ontology lines are choices this language makes for this speaker, stance and scene: realize each where the packet allows; they add no meaning. A referent with an entity is named by one of that entity's forms on the entities line. Answer with one JSON object and nothing else: {\"text\": \"...\"}. No code fence, no commentary."; @@ -79,6 +88,13 @@ pub const RECALL_INSTRUCTIONS: &str = "\ Below is the opening of a passage, with what is known of where it comes from. Continue it exactly as its source words it, from memory, until the passage ends. If you do not remember it, give your best guess in the same voice. Answer with one JSON object and nothing else: {\"text\": \"...\"}, the continuation only, not the opening. No code fence, no commentary."; +/// The instructions of an ontology mint: drafting entries for one language from +/// its Train lines. Fixed per run by `PROMPT_SOURCE_DIGEST`. +pub const MINT_ONTOLOGY_INSTRUCTIONS: &str = "\ +Below are lines written in one language (the language line), the features an ontology condition may test, and the entries that language's ontology already has. Draft new entries: choices this language's culture makes, for a speaker in a stance and scene, about word, grammar, discourse, sound or script, that the lines show. +Answer with one JSON object and nothing else: {\"entries\": [{\"layer\": \"...\", \"when\": [...], \"choice\": \"...\", \"examples\": [...]}]}. No code fence, no commentary. +Give only entries the lines show, as many as they support (a language holds at most 64 in all). layer is exactly one of Lexicon, Grammar, Discourse, Phonology, Orthography. when holds at most 4 conditions, each {\"slot\": \"Stance\" | \"Discourse\" | \"Scene\", \"feature\": \"\", \"test\": ...}, where is the id printed before the colon of a listed feature (\"feature:10\", never its name) and its slot is one that feature lists. test is {\"AtLeast\": }, {\"AtMost\": } or {\"AtMostOrUnset\": } on a grade feature, or {\"Is\": {\"Option\": \"