blun-king-cli 9.1.20 → 9.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/update-notice.js +47 -22
- package/blun.mjs +222 -197
- package/package.json +1 -1
- package/standard-tools/language-guard/blun_language_guard.py +22 -15
package/package.json
CHANGED
|
@@ -173,13 +173,14 @@ def _languages_for(text: str, language: str) -> tuple[str, ...]:
|
|
|
173
173
|
return (base,) if base in DIACRITICS.RULES else ()
|
|
174
174
|
|
|
175
175
|
|
|
176
|
-
def validate_text(
|
|
177
|
-
text: str,
|
|
178
|
-
language: str = "auto",
|
|
179
|
-
glossary: dict[str, Any] | None = None,
|
|
180
|
-
content_type: str = "prose",
|
|
181
|
-
short_text_reviewed: bool = False,
|
|
182
|
-
|
|
176
|
+
def validate_text(
|
|
177
|
+
text: str,
|
|
178
|
+
language: str = "auto",
|
|
179
|
+
glossary: dict[str, Any] | None = None,
|
|
180
|
+
content_type: str = "prose",
|
|
181
|
+
short_text_reviewed: bool = False,
|
|
182
|
+
require_character_profile: bool = True,
|
|
183
|
+
) -> dict[str, Any]:
|
|
183
184
|
findings: list[Finding] = []
|
|
184
185
|
if not text.strip():
|
|
185
186
|
findings.append(Finding("empty-target", "Target text is empty."))
|
|
@@ -199,7 +200,12 @@ def validate_text(
|
|
|
199
200
|
base_language = language.casefold().replace("_", "-").split("-", 1)[0]
|
|
200
201
|
profile = LANGUAGE_CHARACTER_PROFILES.get(base_language)
|
|
201
202
|
profile_prose = DIACRITICS.mask_technical_text(text)
|
|
202
|
-
if
|
|
203
|
+
if (
|
|
204
|
+
require_character_profile
|
|
205
|
+
and profile
|
|
206
|
+
and len(profile_prose) >= 200
|
|
207
|
+
and not any(character in profile for character in profile_prose)
|
|
208
|
+
):
|
|
203
209
|
findings.append(Finding(
|
|
204
210
|
"missing-language-character-profile",
|
|
205
211
|
f"Long {base_language} text contains none of the language's characteristic native characters; possible wholesale ASCII folding.",
|
|
@@ -386,13 +392,14 @@ def release_response(arguments: dict[str, Any]) -> dict[str, Any]:
|
|
|
386
392
|
and language.casefold() not in {"auto", "all"}
|
|
387
393
|
and EXACT_LANGUAGE_TAG.fullmatch(language) is not None
|
|
388
394
|
)
|
|
389
|
-
report = validate_text(
|
|
390
|
-
target if target_is_text else "",
|
|
391
|
-
language if isinstance(language, str) else "",
|
|
392
|
-
arguments.get("glossary"),
|
|
393
|
-
arguments.get("content_type", "prose"),
|
|
394
|
-
arguments.get("short_text_reviewed") is True,
|
|
395
|
-
|
|
395
|
+
report = validate_text(
|
|
396
|
+
target if target_is_text else "",
|
|
397
|
+
language if isinstance(language, str) else "",
|
|
398
|
+
arguments.get("glossary"),
|
|
399
|
+
arguments.get("content_type", "prose"),
|
|
400
|
+
arguments.get("short_text_reviewed") is True,
|
|
401
|
+
False,
|
|
402
|
+
)
|
|
396
403
|
report["checks"].append("agent-response-native-orthography")
|
|
397
404
|
if not target_is_text:
|
|
398
405
|
report["findings"].append(
|