File size: 643 Bytes
8fe7306 59fb62a b9def7b 8fe7306 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# -*- coding: utf-8 -*-
from fastapi import APIRouter
from pythainlp.soundex import (
soundex as py_soundex
)
from enum import Enum
router = APIRouter()
class SoundexEngine(str, Enum):
udom83 = "udom83"
lk82 = "lk82"
metasound = "metasound"
prayut_and_somchaip = "prayut_and_somchaip"
@router.post('/soundex')
def soundex(text: str, engine: SoundexEngine = "udom83"):
"""
This api converts Thai text into phonetic code.
## Input
= **text**: A word that want into phonetic code.
- **engine**: Soundex Engine (default is udom83)
"""
return {"soundex": py_soundex(text=text, engine=engine)} |