* fix: recover concept detail lost in resolver and harden analyzer parsing
Three shippability fixes for the v1 pipeline:
P2 (main): the Illustrious Resolver did exact-key KB lookup only, so any
compound concept the analyzer emits ("white summer dress", "black business
suit") missed and was dropped silently as SC0001. Add a deterministic
head-noun fallback (§17.2): on a miss, drop leading modifiers and look up the
longest remaining suffix ("white summer dress" -> "dress"). No tag/concept is
invented. Emits SC0019 (Concept Reduced) so the reduction is visible.
P1a: the analyzer required the entire model response to be a single JSON
document, so any surrounding prose ("Sure! Here is the scene:") failed parsing
and, with the prompt reused unchanged, every retry failed identically ->
empty output. Extract the first balanced top-level {...} object from
surrounding text (string-aware brace scan); the object bytes are unchanged and
must still validate, so this is unwrapping, not JSON repair.
P1b: the node's "raw" output was to_raw_json(result.data) -- a re-serialization
of the parsed Scene, so on failure it was empty and the model's actual text was
invisible. Capture the last raw model text in analyzer metadata and surface it
as the node's raw output.
Regenerated goldens: unknown_concepts "hologram jacket" now resolves to
"jacket" via head-noun fallback (intended).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: add entry rating + resolver.include_nsfw gating
Foundations for the Danbooru-vocab KB: a per-entry `rating` (general|explicit,
default general) and a `resolver.include_nsfw` config flag (default false). The
resolver omits explicit-rated entries from lookup and expansion unless enabled,
so a gated concept is reported as unknown (SC0001). Schema, model, config, and
example config updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* feat: generate KB from embedded Danbooru vocab (188 -> 16.4k tags)
Replace the coverage ceiling of the 188-entry hand KB by importing a large,
validated Danbooru tag vocabulary. This is the fix for the core "detail loss"
symptom: compound concepts the analyzer emits ("red dress", "sunflower field",
"train station platform") are now real tags that resolve instead of being
dropped.
- scripts/build_vocab.py: one-time dev step that filters the Raffle node's
categorized tag dump (drops artist/character/copyright/attribution categories
and subjective adjectives, keeps only id-pattern-valid tags) into a committed,
self-contained snapshot at data/danbooru_vocab.txt (16.4k tags).
- scripts/generate_kb_from_vocab.py: additive, non-destructive generator. Writes
knowledge_base/gen_<category>.json, mapping the Raffle categories to the 19
canonical categories and tagging NSFW categories rating=explicit. Skips any tag
already defined as a hand-curated id/alias, so the curated canonicalization
(female + aliases) and expansions (school_uniform -> blazer, pleated_skirt) are
preserved and always win.
Result: 16.4k additive entries + 188 curated. Plain natural-language concepts
now resolve broadly via curated aliases + head-noun fallback with no analyzer
prompt change; NSFW gated behind resolver.include_nsfw; golden and dataset tests
stay green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* style: ruff format build_vocab.py
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
* fix(security): drop untrusted CLI path in build_vocab (SonarCloud S8707)
The --source CLI argument fed an untrusted path to the file system (taint).
The script is a one-time dev step; hard-code the source path constant instead.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: kunail0804 <kunail0804@gmail.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
360 lines
5.2 KiB
JSON
360 lines
5.2 KiB
JSON
[
|
|
{
|
|
"id": "aiming_at_viewer",
|
|
"tags": [
|
|
"aiming at viewer"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "averting_eyes",
|
|
"tags": [
|
|
"averting eyes"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "eye_contact",
|
|
"tags": [
|
|
"eye contact"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "eye_focus",
|
|
"tags": [
|
|
"eye focus"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "face_down",
|
|
"tags": [
|
|
"face down"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_ahead",
|
|
"tags": [
|
|
"facing ahead"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_another",
|
|
"tags": [
|
|
"facing another"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_away",
|
|
"tags": [
|
|
"facing away"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_back",
|
|
"tags": [
|
|
"facing back"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_down",
|
|
"tags": [
|
|
"facing down"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_to_the_side",
|
|
"tags": [
|
|
"facing to the side"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "facing_viewer",
|
|
"tags": [
|
|
"facing viewer"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "glance",
|
|
"tags": [
|
|
"glance"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "hair_behind_eyewear",
|
|
"tags": [
|
|
"hair behind eyewear"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_afar",
|
|
"tags": [
|
|
"looking afar"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_ahead",
|
|
"tags": [
|
|
"looking ahead"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_around",
|
|
"tags": [
|
|
"looking around"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_animal",
|
|
"tags": [
|
|
"looking at animal"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_another",
|
|
"tags": [
|
|
"looking at another"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_ass",
|
|
"tags": [
|
|
"looking at ass"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_breasts",
|
|
"tags": [
|
|
"looking at breasts"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_bulge",
|
|
"tags": [
|
|
"looking at bulge"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_creature",
|
|
"tags": [
|
|
"looking at creature"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_flowers",
|
|
"tags": [
|
|
"looking at flowers"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_food",
|
|
"tags": [
|
|
"looking at food"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_hand",
|
|
"tags": [
|
|
"looking at hand"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_hands",
|
|
"tags": [
|
|
"looking at hands"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_mirror",
|
|
"tags": [
|
|
"looking at mirror"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_object",
|
|
"tags": [
|
|
"looking at object"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_pectorals",
|
|
"tags": [
|
|
"looking at pectorals"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_penis",
|
|
"tags": [
|
|
"looking at penis"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_pussy",
|
|
"tags": [
|
|
"looking at pussy"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_screen",
|
|
"tags": [
|
|
"looking at screen"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_self",
|
|
"tags": [
|
|
"looking at self"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_at_watch",
|
|
"tags": [
|
|
"looking at watch"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_away",
|
|
"tags": [
|
|
"looking away"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_back",
|
|
"tags": [
|
|
"looking back"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_down",
|
|
"tags": [
|
|
"looking down"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_inside",
|
|
"tags": [
|
|
"looking inside"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_outside",
|
|
"tags": [
|
|
"looking outside"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_over_eyewear",
|
|
"tags": [
|
|
"looking over eyewear"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_past_viewer",
|
|
"tags": [
|
|
"looking past viewer"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_through_fingers",
|
|
"tags": [
|
|
"looking through fingers"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_through_window",
|
|
"tags": [
|
|
"looking through window"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_to_the_side",
|
|
"tags": [
|
|
"looking to the side"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "looking_up",
|
|
"tags": [
|
|
"looking up"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "pov_adoring",
|
|
"tags": [
|
|
"pov adoring"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "pov_bullying",
|
|
"tags": [
|
|
"pov bullying"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "shaft_look",
|
|
"tags": [
|
|
"shaft look"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "sideways_glance",
|
|
"tags": [
|
|
"sideways glance"
|
|
],
|
|
"category": "eyes"
|
|
},
|
|
{
|
|
"id": "stare_down",
|
|
"tags": [
|
|
"stare down"
|
|
],
|
|
"category": "eyes"
|
|
}
|
|
]
|