Commit
·
737b250
1
Parent(s):
9dbb134
Update code
Browse files- routers/soundex.py +1 -1
- routers/spell.py +2 -2
- routers/tokenize.py +3 -3
- routers/util.py +3 -3
routers/soundex.py
CHANGED
|
@@ -28,5 +28,5 @@ def soundex(word: str, engine: SoundexEngine = "udom83"):
|
|
| 28 |
"""
|
| 29 |
return Response(
|
| 30 |
json.dumps({"soundex": py_soundex(text=word, engine=engine)}, ensure_ascii=False),
|
| 31 |
-
media_type="application/json",
|
| 32 |
)
|
|
|
|
| 28 |
"""
|
| 29 |
return Response(
|
| 30 |
json.dumps({"soundex": py_soundex(text=word, engine=engine)}, ensure_ascii=False),
|
| 31 |
+
media_type="application/json; charset=utf-8",
|
| 32 |
)
|
routers/spell.py
CHANGED
|
@@ -36,7 +36,7 @@ def correct(word: float, engine: CorrectEngine = "pn"):
|
|
| 36 |
"""
|
| 37 |
return Response(
|
| 38 |
json.dumps({"word": py_correct(word, engine=engine)}, ensure_ascii=False),
|
| 39 |
-
media_type="application/json",
|
| 40 |
)
|
| 41 |
|
| 42 |
|
|
@@ -52,5 +52,5 @@ def spell(word: float, engine: SpellEngine = "pn"):
|
|
| 52 |
"""
|
| 53 |
return Response(
|
| 54 |
json.dumps({"word": py_spell(word, engine=engine)}, ensure_ascii=False),
|
| 55 |
-
media_type="application/json",
|
| 56 |
)
|
|
|
|
| 36 |
"""
|
| 37 |
return Response(
|
| 38 |
json.dumps({"word": py_correct(word, engine=engine)}, ensure_ascii=False),
|
| 39 |
+
media_type="application/json; charset=utf-8",
|
| 40 |
)
|
| 41 |
|
| 42 |
|
|
|
|
| 52 |
"""
|
| 53 |
return Response(
|
| 54 |
json.dumps({"word": py_spell(word, engine=engine)}, ensure_ascii=False),
|
| 55 |
+
media_type="application/json; charset=utf-8",
|
| 56 |
)
|
routers/tokenize.py
CHANGED
|
@@ -52,7 +52,7 @@ def word_tokenize(text: str, engine: WordTokenizeEngine = "newmm"):
|
|
| 52 |
"""
|
| 53 |
return Response(
|
| 54 |
json.dumps({"words": py_word_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 55 |
-
media_type="application/json",
|
| 56 |
)
|
| 57 |
|
| 58 |
|
|
@@ -68,7 +68,7 @@ def subword_tokenize(text: str, engine: SubwordTokenizeEngine = "tcc"):
|
|
| 68 |
"""
|
| 69 |
return Response(
|
| 70 |
json.dumps({"subwords": py_subword_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 71 |
-
media_type="application/json",
|
| 72 |
)
|
| 73 |
|
| 74 |
|
|
@@ -84,5 +84,5 @@ def sent_tokenize(text: str, engine: SentTokenizeEngine = "crfcut"):
|
|
| 84 |
"""
|
| 85 |
return Response(
|
| 86 |
json.dumps({"sents": py_sent_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 87 |
-
media_type="application/json",
|
| 88 |
)
|
|
|
|
| 52 |
"""
|
| 53 |
return Response(
|
| 54 |
json.dumps({"words": py_word_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 55 |
+
media_type="application/json; charset=utf-8",
|
| 56 |
)
|
| 57 |
|
| 58 |
|
|
|
|
| 68 |
"""
|
| 69 |
return Response(
|
| 70 |
json.dumps({"subwords": py_subword_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 71 |
+
media_type="application/json; charset=utf-8",
|
| 72 |
)
|
| 73 |
|
| 74 |
|
|
|
|
| 84 |
"""
|
| 85 |
return Response(
|
| 86 |
json.dumps({"sents": py_sent_tokenize(text=text, engine=engine)}, ensure_ascii=False),
|
| 87 |
+
media_type="application/json; charset=utf-8",
|
| 88 |
)
|
routers/util.py
CHANGED
|
@@ -15,7 +15,7 @@ def bahttext(number: float):
|
|
| 15 |
"""
|
| 16 |
return Response(
|
| 17 |
json.dumps({"bahttext": py_bahttext(number)}, ensure_ascii=False),
|
| 18 |
-
media_type="application/json",
|
| 19 |
)
|
| 20 |
|
| 21 |
|
|
@@ -26,7 +26,7 @@ def normalize(text: str):
|
|
| 26 |
"""
|
| 27 |
return Response(
|
| 28 |
json.dumps({"text": py_normalize(text)}, ensure_ascii=False),
|
| 29 |
-
media_type="application/json",
|
| 30 |
)
|
| 31 |
|
| 32 |
|
|
@@ -37,5 +37,5 @@ def tone_detector(syllable: str):
|
|
| 37 |
"""
|
| 38 |
return Response(
|
| 39 |
json.dumps({"tone": py_tone_detector(syllable)}, ensure_ascii=False),
|
| 40 |
-
media_type="application/json",
|
| 41 |
)
|
|
|
|
| 15 |
"""
|
| 16 |
return Response(
|
| 17 |
json.dumps({"bahttext": py_bahttext(number)}, ensure_ascii=False),
|
| 18 |
+
media_type="application/json; charset=utf-8",
|
| 19 |
)
|
| 20 |
|
| 21 |
|
|
|
|
| 26 |
"""
|
| 27 |
return Response(
|
| 28 |
json.dumps({"text": py_normalize(text)}, ensure_ascii=False),
|
| 29 |
+
media_type="application/json; charset=utf-8",
|
| 30 |
)
|
| 31 |
|
| 32 |
|
|
|
|
| 37 |
"""
|
| 38 |
return Response(
|
| 39 |
json.dumps({"tone": py_tone_detector(syllable)}, ensure_ascii=False),
|
| 40 |
+
media_type="application/json; charset=utf-8",
|
| 41 |
)
|