File size: 341 Bytes
ba907f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# data/text_utils.py – shared text helpers

import re


def normalize_question(q: str) -> str:
    """
    Normalize Lao question:
    - lowercase
    - remove basic punctuation
    - collapse spaces
    """
    q = q.lower()
    q = re.sub(r"[?!?!\.\,\:\;\"β€œβ€'β€˜β€™]", " ", q)
    q = re.sub(r"\s+", " ", q)
    return q.strip()