Nodes/comfyui-PepeAnimeGenreClassifier/Pepe Anime Genre Classifier
ComfyUI Node

Pepe Anime Genre Classifier

Know the anime, blank on the genres? This node fills in the prompt tags.

By Pepehoschi·Created 3 months ago·Updated 3 months ago· 0
Pepe Anime Genre Classifier
    • genres
    • matched_title
    • uid
    • score
    • matches_json
    anime_title
    top_k5
    min_score0.45
    include_adulttrue

    You're building an Illustrious or NoobAI workflow for Haikyuu, and you can picture the show fine - you just can't summon "Sports, School, Shounen" out of your head at 11pm. Type the title into Pepe Anime Genre Classifier, and it hands you back the genres as a comma-separated string ready to drop into your prompt. That's the whole job, and it does it offline, in a fraction of a second.

    This is a plain data-lookup node: it searches a bundled snapshot of ~19,000 MyAnimeList entries (Data/myanimelist_genres.csv, in the uid;title;genre format) and returns the genres of the best title match. The name is a lie in the most reassuring direction - it doesn't "classify" anything with a model, calls no API, needs no key, and never touches the network. Given the ecosystem's history of API-wrapper nodes that phone home with your credentials, "the whole thing is a local CSV read" is a feature worth calling out.

    How the matching works

    The interesting bit is the fuzzy glue. Each CSV row is preprocessed once (lazily, the first time the node runs, then cached in memory for the rest of the process) into a normalized title - casefolded, punctuation stripped, & turned into and - plus a no-spaces "compact" form and a token set. Your query is scored against every entry with a weighted cocktail: exact normalized match scores 1.0, compact match 0.98, substring containment 0.75–0.9, and anything else gets 0.55 × difflib.SequenceMatcher ratio + 0.45 × token overlap. So "Fullmetal Alchemist Brotherhood" still resolves to "Fullmetal Alchemist: Brotherhood" without you fussing over the colon.

    One deliberate quirk: duplicate CSV rows are kept rather than deduplicated, so a title with several rows shows all of them in matches_json. It keeps the node faithful to the source data, and it's genuinely useful when one show has multiple MAL entries.

    The inputs and outputs that matter

    You'll really only touch two things:

    • anime_title - the title to look up. Plain string.
    • min_score - the confidence floor (0.0–1.0, default 0.45). If the best match is wrong, raise this. It's the closest thing the node has to a "make me trust it" dial.

    include_adult (default on) filters out entries tagged with the Hentai genre when off, and top_k (default 5, max 20) controls how many candidates appear in the JSON output - mostly a debugging knob.

    Outputs: genres is the comma-separated string you feed into a text encode or prompt-builder node; matched_title and uid tell you exactly which MAL row won (so you can catch a wrong match at a glance); score is the match confidence from 0.0 to 1.0; and matches_json dumps the full candidate list if you want to see what else was close.

    Installing it

    This is the rare custom node with zero baggage. No requirements.txt, no model files to download, nothing to configure. Via ComfyUI Manager, search "Pepe Anime Genre Classifier" (or the pack title comfyui-PepeAnimeGenreClassifier), or clone it manually:

    cd ComfyUI/custom_nodes
    git clone https://github.com/Pepehoschi/comfyui-PepeAnimeGenreClassifier
    

    Restart ComfyUI and both nodes from the pack appear under Pepe/Anime (the genre node and its tag-list sibling ship together - you get both for the price of one install).

    Where people get burned

    • score measures how confidently the title matched, not how good or complete the genres are. A perfect 1.0 match can still return a thin genre list.
    • Wrong best match? Raise min_score and read matches_json. The right row is usually sitting right there at #2 or #3.
    • The dataset is a static snapshot shipped in the repo - there are no live updates, so anything released or retitled recently won't resolve. The README also warns that alternate titles only work if the source CSV has enough overlap for fuzzy matching to find them.
    • include_adult only catches the genre Hentai; that's the one filter word the code knows.

    It's a small, honest utility - a lookup table with unusually good fuzzy glue. If you build anime-character workflows from series prompts, it's the difference between alt-tabbing to MAL and staying in the graph.

    CategoryPepe/Anime

    Inputs (4)

    NameTypeDefaultDescription
    anime_titleSTRING
    top_kINT51–20
    min_scoreFLOAT0.450–1
    include_adultBOOLEANtrue

    Outputs (5)

    NameTypeDescription
    genresSTRING
    matched_titleSTRING
    uidSTRING
    scoreFLOAT
    matches_jsonSTRING