summaryrefslogtreecommitdiff
path: root/src/lib/calls/nlp.ts
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-06-03 19:40:34 +0700
committerpolwex <polwex@sortug.com>2025-06-03 19:40:34 +0700
commitb91b758041cbc7b8bf7e2a4aee8d6228a75d8105 (patch)
tree4fa343ed394034b16841ecfcb6411b1574d24b25 /src/lib/calls/nlp.ts
parent175ddca375cef765cec8ca5bbc527a205c40bf25 (diff)
m
Diffstat (limited to 'src/lib/calls/nlp.ts')
-rw-r--r--src/lib/calls/nlp.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/lib/calls/nlp.ts b/src/lib/calls/nlp.ts
index 1e84e93..2810744 100644
--- a/src/lib/calls/nlp.ts
+++ b/src/lib/calls/nlp.ts
@@ -176,3 +176,17 @@ export async function findLemma(word: string, lang: string) {
const jj = await r2.json();
return jj;
}
+export async function charsiuG2P(word: string, lang: string) {
+ const opts = {
+ method: "POST",
+ headers: {
+ "Content-type": "application/json",
+ "X-API-KEY": Bun.env.SORTUG_NLP_API_KEY!,
+ },
+ body: JSON.stringify({ string: word, lang }),
+ };
+ // const r1 = await fetch(`http://localhost:8000/segmentate`, opts);
+ const r2 = await fetch("http://localhost:8105" + `/ipa`, opts);
+ const jj = await r2.json();
+ return jj;
+}