16 lines
337 B
Python
16 lines
337 B
Python
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
|
|
NL_PHRASE_REPLACEMENTS = {
|
|
"PLAN": "PLAN",
|
|
}
|
|
|
|
|
|
def normalize_nl_text(text: str, field_path: str = "") -> str:
|
|
cleaned = text
|
|
for source, target in NL_PHRASE_REPLACEMENTS.items():
|
|
cleaned = cleaned.replace(source, target)
|
|
return re.sub(r"\s+", " ", cleaned).strip()
|