| # -*- coding: utf-8 -*- | |
| from fastapi import APIRouter | |
| from pythainlp.util import ( | |
| bahttext as py_bahttext, | |
| normalize as py_normalize, | |
| tone_detector as py_tone_detector | |
| ) | |
| router = APIRouter() | |
| def bahttext(number: float): | |
| return {"bahttext": py_bahttext(number)} | |
| def normalize(text: str): | |
| return {"text": py_normalize(text)} | |
| def tone_detector(syllable: str): | |
| return {"tone": py_tone_detector(syllable)} | |