Skip to content

Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.

fix(content-humanize): stop over-deleting emoji-adjacency glue near non-Latin scripts

Agrici Danielf78c644590e2
diff --git a/scripts/content_humanize.py b/scripts/content_humanize.py
index e72b0a5..e76462d 100644
--- a/scripts/content_humanize.py
+++ b/scripts/content_humanize.py
@@ -38,6 +38,7 @@ import argparse
import json
import re
import sys
+import unicodedata
from pathlib import Path
# Replacements run in order. Each entry is (pattern, replacement, label).
@@ -160,10 +161,31 @@ _EMOJI_GLUE = {
}
+def _is_emoji_like(ch: str) -> bool:
+ """True when ``ch`` is itself an emoji-ish symbol, not just a high codepoint.
+
+ Uses the Unicode general category (``So``, "symbol, other") plus the two
+ ranges that hold the bulk of pictographic and emoji-adjacent symbol
+ characters, instead of a blanket ``codepoint >= U+2100`` test, which also
+ matches CJK ideographs, Hangul, and letters in many other scripts.
+ """
+ if not ch:
+ return False
+ if unicodedata.category(ch) == "So":
+ return True
+ cp = ord(ch)
+ return (0x1F000 <= cp <= 0x1FAFF) or (0x2600 <= cp <= 0x27BF)
+
+
+def _is_letter(ch: str) -> bool:
+ """True when ``ch`` is a Unicode letter (any script)."""
+ return bool(ch) and unicodedata.category(ch).startswith("L")
+
+
def _emoji_adjacent(prev: str, nxt: str) -> bool:
"""True when either neighbour is plausibly part of an emoji sequence."""
for ch in (prev, nxt):
- if ch and (ord(ch) >= 0x2100 or ch == "\u20e3"):
+ if ch and (_is_emoji_like(ch) or ch == "\u20e3"):
return True
return False
@@ -181,6 +203,12 @@ def strip_invisible(text: str) -> tuple[str, dict]:
elif ch in _EMOJI_GLUE:
prev = text[i - 1] if i else ""
nxt = text[i + 1] if i + 1 < len(text) else ""
+ # ZWNJ/ZWJ are orthographic in Arabic, Persian, Urdu, Devanagari,
+ # Bengali, Tamil, and other scripts that use joining or conjunct
+ # forms: never delete them next to a letter in any script.
+ if ch in ("\u200c", "\u200d") and (_is_letter(prev) or _is_letter(nxt)):
+ out.append(ch)
+ continue
if _emoji_adjacent(prev, nxt):
out.append(ch)
continue
diff --git a/skills/seo-content/SKILL.md b/skills/seo-content/SKILL.md
index 172f295..75ffe90 100644
--- a/skills/seo-content/SKILL.md
+++ b/skills/seo-content/SKILL.md
@@ -144,8 +144,8 @@ For "humanize this", "remove watermarks", or "clean up this draft", run the
bundled cleanup script on the user's own content:
```bash
-claude-seo run content_humanize.py draft.md -o cleaned.md
-cat draft.md | claude-seo run content_humanize.py --json
+"${CLAUDE_PLUGIN_ROOT}/scripts/claude-seo" run content_humanize.py draft.md -o cleaned.md
+cat draft.md | "${CLAUDE_PLUGIN_ROOT}/scripts/claude-seo" run content_humanize.py --json
```
Two deterministic passes, both logged in the JSON output:
diff --git a/tests/test_content_humanize.py b/tests/test_content_humanize.py
index 376fbc6..c50102e 100644
--- a/tests/test_content_humanize.py
+++ b/tests/test_content_humanize.py
@@ -69,3 +69,29 @@ def test_humanize_reports_zero_on_clean_text():
assert result["cleaned"] == "Plain honest prose about roof repair."
assert result["invisible_count"] == 0
assert result["change_count"] == 0
+
+
+def test_zwnj_preserved_in_persian_orthography():
+ # ZWNJ between letters is orthographic in Persian (a "pseudo-space" that
+ # blocks glyph joining), not a hidden-text fingerprint. Deleting it
+ # changes the word's correct letter-joining shape.
+ for word in ("می‌رود", "کتاب‌ها"):
+ cleaned, removed = strip_invisible(word)
+ assert cleaned == word
+ assert removed == {}
+
+
+def test_zwj_preserved_in_devanagari_conjunct():
+ # ZWJ between letters requests an explicit half-form/conjunct in
+ # Devanagari; it is orthographic, not a watermark.
+ word = "कार्य‍कर्ता"
+ cleaned, removed = strip_invisible(word)
+ assert cleaned == word
+ assert removed == {}
+
+
+def test_stray_zwj_between_digits_still_stripped():
+ # A ZWJ with no letter or emoji neighbour is still a fingerprint.
+ cleaned, removed = strip_invisible("12‍34")
+ assert cleaned == "1234"
+ assert removed == {"zero-width-joiner": 1}