Nodes/danbot-comfy-node/Danbot Translation Extractor
ComfyUI Node

Danbot Translation Extractor

Split the model's tag output into copyright, character, and everything else

By p1atdev·Created 2 years ago·Updated about a year ago· 35
Danbot Translation Extractor
  • danbot_model
  • translation_kwargs
generated_tags

The Danbot model doesn't just hand you one flat tag list - it categorizes as it goes, wrapping the output in <copyright>, <character>, and <translation> markers. Danbot Translation Extractor is the node that tears those markers apart so you can treat each category as its own string.

Why bother? Because in the Danbooru vocabulary these categories behave differently. Copyright tags are the series (genshin_impact), character tags are named characters (hatsune_miku), and everything else - pose, clothing, background, expression - is a general translation tag. When you're building a serious anime workflow, you often want to keep characters stable while swapping scenery, or weight the series tag differently. A single joined string can't do that. This node is the seam.

How it works

Two inputs: danbot_model (the handle from Danbot Load Model, which knows the exact marker patterns) and generated_tags - and here's the subtle part, it wants the raw output of the Generator node, not the cleaned generated_tags. The raw output still carries the <copyright>...</copyright> wrappers the extractor's regexes look for. Feed it the cleaned list and every pattern comes back empty.

The output is a single translation_kwargs handle of type DANBOT_FORMAT_KWARGS - a dictionary with three keys: copyright, character, and translation. It's a dict, not a visible string, so on its own it doesn't show you anything. Where it shines is wired into the Danbot V2408 Formatter, which accepts these kwargs and splices the copyright/character tags back into the extension template as the context for a second pass. That's the real purpose: translate once, then hand the categorized result back to the model so it can extend the list intelligently.

Practical notes

  • In the canned V2408 Pipeline this extraction happens internally - you only need this node when you're building the two-stage translate-then-extend graph by hand.
  • Wire order matters: Generator → Translation Extractor → Formatter → Generator again, in a loop. It reads a little intimidating the first time you see it, but it's just "pass 1 feeds pass 2."
  • Pair it with the Danbot Extension Extractor for the same trick on the extension output.

Install

The whole pack installs in one shot - ComfyUI Manager, search danbot-comfy-node, or:

cd ComfyUI/custom_nodes
git clone https://github.com/p1atdev/danbot-comfy-node
cd danbot-comfy-node
pip install -r requirements.txt

(portable: ../../../python_embeded/python.exe -s -m pip install -r requirements.txt.) Dependencies are just transformers, sentencepiece, protobuf; restart ComfyUI and the extractors live under prompt/Danbooru Tags Translator.

Categoryprompt/Danbooru Tags Translator

Inputs (2)

NameTypeDefaultDescription
danbot_modelDANBOT_MODEL
generated_tagsSTRINGThe tags generated by the model.

Outputs (1)

NameTypeDescription
translation_kwargsDANBOT_FORMAT_KWARGS