A custom ComfyUI node that receives a text prompt from the workflow, removes or replaces sentences based on user-defined trigger words, and passes the filtered text to the next node.
- Works inline in your ComfyUI workflow – text in, text out
- Delete sentences that contain a single word or all words from a comma-separated list
- Replace sentences that contain all words from a comma-separated list with a custom sentence
- URL dots (e.g.
www.example.com) are ignored during sentence splitting - Optional case-sensitive matching
- Compatible with Python 3.13+
cd ComfyUI/custom_nodes/
git clone https://github.com/Slartibart23/comfyui-sentence-filter.gitRestart ComfyUI. The node appears under text › processing as "Sentence Filter ✂️".
| Input | Type | Required | Description |
|---|---|---|---|
text |
STRING | ✅ | Input text prompt from the workflow |
delete_words |
STRING | ➖ | Comma-separated words – sentence is deleted if it contains all of them |
replace_words |
STRING | ➖ | Comma-separated words – sentence is replaced if it contains all of them |
replacement_sentence |
STRING | ➖ | The sentence that replaces matched sentences |
case_sensitive |
BOOLEAN | ➖ | Enable case-sensitive matching (default: off) |
| Output | Type | Description |
|---|---|---|
text |
STRING | Filtered text, ready for the next node |
sentences_deleted |
INT | Number of sentences deleted |
sentences_replaced |
INT | Number of sentences replaced |
delete_words = Watermark
→ Any sentence containing the word Watermark is removed.
Input: "A beautiful photo. The watermark www.femjoy.com is in the corner. Enjoy."
Output: "A beautiful photo. Enjoy."
delete_words = blonde, straight, young
→ A sentence is only removed if it contains all three words.
Input: "Nice day. A young woman with straight hair of blonde color. The end."
Output: "Nice day. The end."
replace_words = blonde, straight, young
replacement_sentence = A mature woman with brown curly hair
Input: "Intro. A young woman with straight blonde hair. Outro."
Output: "Intro. A mature woman with brown curly hair. Outro."
If a sentence matches both delete_words and replace_words,
deletion takes priority.
cd comfyui-sentence-filter
pip install pytest
python -m pytest tests/ -v- Python 3.13+
- ComfyUI (any recent version)
- No additional Python packages required
MIT License – see LICENSE for details.