Extensions/comfyui-PepeAnimeGenreClassifier
ComfyUI Extension

comfyui-PepeAnimeGenreClassifier

ComfyUI custom nodes for converting an anime series title into genre or tag text that can be used in prompt-building workflows.

By Pepehoschi·Created 2 months ago·Updated 2 months ago· 0
Pepehoschi/comfyui-PepeAnimeGenreClassifier
Nodes
On cloudLocal install
Stars0
Updated2 months ago
Readme

ComfyUI Pepe Anime Genre Classifier

ComfyUI custom nodes for converting an anime series title into genre or tag text that can be used in prompt-building workflows.

The nodes are useful when you know the name of an anime, but want metadata such as Action, Fantasy, School, volleyball, based on a manga, or female protagonist without manually looking it up. Titles are matched fuzzily, so small differences in punctuation, spacing, or wording can still resolve to the closest known series.

Nodes

Pepe Anime Genre Classifier

Looks up broad genre labels from Data/myanimelist_genres.csv.

Inputs:

  • anime_title: title to search for.
  • top_k: number of candidate matches to include in the JSON output.
  • min_score: minimum confidence score from 0.0 to 1.0.
  • include_adult: whether entries tagged as adult-only genres may be returned.

Outputs:

  • genres: comma-separated genres from the best match.
  • matched_title: title from the CSV row that matched best.
  • uid: MyAnimeList id from the genre CSV.
  • score: confidence score for the best match.
  • matches_json: JSON array of the best candidate matches.

Pepe Anime Tag Classifier

Looks up detailed descriptive tags from Data/AnimeSeriesTagList.csv.

Inputs:

  • anime_title: title to search for.
  • top_k: number of candidate matches to include in the JSON output.
  • min_score: minimum confidence score from 0.0 to 1.0.
  • include_adult: whether adult-only tag rows may be returned.

Outputs:

  • tags: comma-separated tags from the best match.
  • matched_title: title from the CSV row that matched best.
  • score: confidence score for the best match.
  • matches_json: JSON array of the best candidate matches.

How Matching Works

Both nodes load their CSV data once when first used, then keep a preprocessed in-memory index for the current ComfyUI process.

For each title, the node stores:

  • the original title
  • a normalized title
  • a compact title without spaces
  • tokenized words

Search combines:

  • exact normalized title match
  • compact title match
  • substring matching
  • token overlap
  • difflib.SequenceMatcher fuzzy string similarity

Duplicate CSV rows are intentionally preserved. This keeps the node faithful to the source data and makes duplicate rows visible in matches_json.

Installation

Clone this repository into your ComfyUI custom_nodes directory:

cd D:\AI\ComfyUI_windows_portable\ComfyUI\custom_nodes
git clone https://github.com/Pepehoschi/comfyui-PepeAnimeGenreClassifier.git

Restart ComfyUI after installation. The nodes appear under:

Pepe/Anime

Data Files

The repository includes the CSV data needed by the nodes:

  • Data/myanimelist_genres.csv
  • Data/AnimeSeriesTagList.csv

The genre file uses:

uid;title;genre

The tag file uses:

title;tags

Tags are pipe-separated in the source CSV and returned as comma-separated text by the node.

Practical Notes

  • score is a title-match confidence score, not a statement that the genres or tags are objectively complete.
  • If a title has multiple matching rows, inspect matches_json.
  • If the best match is wrong, raise min_score or review the candidate list in matches_json.
  • Alternate titles only work if the source CSV contains enough title overlap for fuzzy matching.
  • The current implementation has no external Python dependencies.

Development Check

Run the tests from the repository root:

$env:PYTHONDONTWRITEBYTECODE='1'
python -m unittest discover tests

The PYTHONDONTWRITEBYTECODE setting avoids Windows cache-file permission noise in some ComfyUI portable installs.