Skip to content

Multi-tier framework for evaluating AI agent skills and plugins with quality gates, security scanning, harness compatibility checks, semantic overlap detection, synthetic evaluation dataset generation, and live agent evaluation that measures how skills affect agent behavior. Ships reusable CI templates that bring every check to any repository.

fix(text-analyzer): leave punctuation-only tokens out of the top words (#738)

Dhananjay Aggarwalc43365be76e4
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ec50e61a..23914101 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -477,6 +477,8 @@ All notable changes to SkillEvaluator are documented in this file.
preparing scanners, so configuration errors do not trigger downloads or stdout noise.
- Documentation-only CI follows imports through collected test modules and
package initializers, so dependent documentation assertions are included.
+- The text-analyzer reference skill no longer lists punctuation-only tokens as top words. An ellipsis
+ (`...`) was counted as the empty word `""` and a dash (`-`) as a word, pushing real words out of the top 5.
- The Tier 1 PII scan no longer stalls on a long identifier before an IPv4-shaped value. A line with a
30-letter name followed by `= "8.8.0.8"` took about a minute to scan, and every further letter doubled that.
- On Windows, stopping a Tier 3 Harbor run no longer fails with `Harbor process-tree cleanup could not be
diff --git a/src/skillevaluator/tier3/reference_skills/text-analyzer/scripts/analyze_text.py b/src/skillevaluator/tier3/reference_skills/text-analyzer/scripts/analyze_text.py
index 0c97d017..b89d5cf8 100755
--- a/src/skillevaluator/tier3/reference_skills/text-analyzer/scripts/analyze_text.py
+++ b/src/skillevaluator/tier3/reference_skills/text-analyzer/scripts/analyze_text.py
@@ -24,7 +24,8 @@ def analyze(text: str) -> dict:
avg_word_len = round(sum(len(w) for w in words) / max(word_count, 1), 2)
- freq = Counter(w.lower().strip(".,;:!?\"'()[]{}") for w in words)
+ tokens = (w.lower().strip(".,;:!?\"'()[]{}") for w in words)
+ freq = Counter(t for t in tokens if any(ch.isalnum() for ch in t))
top_words = freq.most_common(5)
return {
diff --git a/tests/test_reference_text_analyzer.py b/tests/test_reference_text_analyzer.py
new file mode 100644
index 00000000..229b3b8d
--- /dev/null
+++ b/tests/test_reference_text_analyzer.py
@@ -0,0 +1,56 @@
+# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+
+"""Behavior tests for the packaged text-analyzer reference script."""
+
+from __future__ import annotations
+
+import importlib.util
+from pathlib import Path
+from types import ModuleType
+
+ANALYZE_TEXT = (
+ Path(__file__).resolve().parents[1]
+ / "src/skillevaluator/tier3/reference_skills/text-analyzer/scripts/analyze_text.py"
+)
+
+
+def _load_analyzer() -> ModuleType:
+ spec = importlib.util.spec_from_file_location("reference_script_analyze_text", ANALYZE_TEXT)
+ assert spec and spec.loader
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ return module
+
+
+def test_top_words_skip_punctuation_only_tokens() -> None:
+ stats = _load_analyzer().analyze("Wait... what? ... ok ... - fine - yes! \u2014 & \u2013")
+
+ assert [entry["word"] for entry in stats["top_words"]] == ["wait", "what", "ok", "fine", "yes"]
+ assert stats["word_count"] == 12
+
+
+def test_top_words_keep_numbers_and_inner_punctuation() -> None:
+ stats = _load_analyzer().analyze("v2 v2 don't don't 3.14 well-known")
+
+ assert stats["top_words"] == [
+ {"word": "v2", "count": 2},
+ {"word": "don't", "count": 2},
+ {"word": "3.14", "count": 1},
+ {"word": "well-known", "count": 1},
+ ]
+
+
+def test_starter_eval_text_statistics_are_unchanged() -> None:
+ stats = _load_analyzer().analyze(
+ "The quick brown fox jumps over the lazy dog. The dog barked at the fox. The fox ran away quickly."
+ )
+
+ assert stats["word_count"] == 20
+ assert stats["character_count"] == 97
+ assert stats["sentence_count"] == 3
+ assert stats["top_words"][:3] == [
+ {"word": "the", "count": 5},
+ {"word": "fox", "count": 3},
+ {"word": "dog", "count": 2},
+ ]