Files
kamidso-back/kamidso/native_connectors/semantic/text.py
T
javadandCursor edbaa2acec Add native Didar connectors so chats can query CRM data reliably.
Connector calls, semantic rules, and DuckDB memory keep long runs stable, and stream retry stops chats from stalling.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-12 19:26:47 +03:30

13 lines
438 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Shared normalization for Persian business text."""
from __future__ import annotations
_DIGITS = str.maketrans("۰۱۲۳۴۵۶۷۸۹٠١٢٣٤٥٦٧٨٩", "01234567890123456789")
def normalize_text(value: str) -> str:
text = value.replace("\u200c", "").replace("\u200d", "")
text = text.replace("ي", "ی").replace("ك", "ک").replace("ة", "ه")
text = text.translate(_DIGITS)
return " ".join(text.strip().split())