diff --git a/scripts/port-census.py b/scripts/port-census.py index 8ea1f66..3c38846 100755 --- a/scripts/port-census.py +++ b/scripts/port-census.py @@ -25,8 +25,14 @@ def toks(line): out.append(n) # Identifiers, flags, paths and backticked spans are the facts worth # tracking; ordinary prose words are not — they reword on every rewrite. - out += [w for w in re.findall(r"[A-Za-z][\w./:-]{7,}", line) - if re.search(r"[\d_.:/-]", w) or w.isupper()] + # A hyphen alone is not evidence of an identifier (`long-standing`), so a + # dashed word counts only with two hyphens (`frank-tts-engine`) or with a + # digit, dot, slash, colon or `--` inside it. + for w in re.findall(r"[A-Za-z][\w./:-]{7,}", line): + core = w.strip(".,;:!?\"')]") + if (core.startswith("--") or core.isupper() + or re.search(r"[\d_/:.]", core) or core.count("-") >= 2): + out.append(core) out += [s.strip() for s in re.findall(r"`([^`]+)`", line) if len(s) > 3] return out