summaryrefslogtreecommitdiff
path: root/src/lib/calls/nlp.ts
diff options
context:
space:
mode:
authorpolwex <polwex@sortug.com>2025-05-29 12:46:01 +0700
committerpolwex <polwex@sortug.com>2025-05-29 12:46:01 +0700
commit06e8d0a0d636f539f20ece3d9d767190d0a71b3b (patch)
tree4564a30b20e6bafc89ecdf0e818b23e4734f3ec1 /src/lib/calls/nlp.ts
parenta3f24ea79b14394b24c4b60a010651eb29eeb872 (diff)
m
Diffstat (limited to 'src/lib/calls/nlp.ts')
-rw-r--r--src/lib/calls/nlp.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lib/calls/nlp.ts b/src/lib/calls/nlp.ts
index 28562d0..24e7cf3 100644
--- a/src/lib/calls/nlp.ts
+++ b/src/lib/calls/nlp.ts
@@ -52,3 +52,18 @@ export async function deconstructSyllable(ipa: string): Promise<SyllableRes> {
const jj = await r2.json();
return jj;
}
+
+export async function findLemma(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:8102" + `/spacy`, opts);
+ const jj = await r2.json();
+ return jj;
+}