MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / normalize_direction_key

Function normalize_direction_key

config/direction_lexicon.py:48–56  ·  view source on GitHub ↗
(value: Any)

Source from the content-addressed store, hash-verified

46
47
48def normalize_direction_key(value: Any) -> str:
49 raw = str(value or "").strip().casefold()
50 if not raw:
51 return ""
52 slug = re.sub(r"[^\w\u4e00-\u9fff]+", "-", raw, flags=re.UNICODE)
53 slug = slug.strip("-_")
54 slug = re.sub(r"[_\s]+", "-", slug)
55 slug = re.sub(r"-{2,}", "-", slug)
56 return slug
57
58
59def _dedupe_strings(values: Iterable[Any]) -> List[str]:

Callers 15

derive_topic_keyFunction · 0.85
_default_entryFunction · 0.85
_normalize_entryFunction · 0.85
load_lexiconFunction · 0.85
save_lexiconFunction · 0.85
get_direction_entryFunction · 0.85
expand_direction_termsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected