From 15efc30e9e7179accd30375d3edb2e34a3b4dc5f Mon Sep 17 00:00:00 2001 From: Oscar Wan Date: Fri, 24 Jul 2026 20:45:42 -0700 Subject: updated generation process --- src/gap_pipeline/surface.py | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'src/gap_pipeline/surface.py') diff --git a/src/gap_pipeline/surface.py b/src/gap_pipeline/surface.py index 914d847..aae34a8 100644 --- a/src/gap_pipeline/surface.py +++ b/src/gap_pipeline/surface.py @@ -29,6 +29,24 @@ SURFACE_FAMILIES: tuple[SurfaceFamily, ...] = ( IDENTIFIER_RE = re.compile(r"^[a-z]{8,}$") +def apply_rename_map(text: str, rename_map: dict[str, str]) -> str: + """Apply symbol renames without replacing letters inside other tokens.""" + + rendered = text + for source in sorted(rename_map, key=len, reverse=True): + pattern = re.escape(source) + if source[0].isalnum(): + pattern = rf"(?