Repository
Current version released
3 years ago
Seonbi client library for Deno
Seonbi is an HTML preprocessor that makes typographic/orthographic adjustments on Korean text. See the website for details.
This directory contains a simple client library which manages and communicates
with Seonbi HTTP API server. The transform()
function and Seonbi
class
automatically downloads the Seonbi executable binary and runs the server under
the hood.
Hereβs an example code for one-shot transformation:
import { transform } from "https://deno.land/x/seonbi/mod.ts";
const input = "λλ
Έλ₯Ό ιν΄ μ°λ μ λΉ";
const output = transform(input);
console.log(output); // λλ
Έλ₯Ό ν΅ν΄ μ°λ μ λΉ
When there are multiple inputs to transform, makes a Seonbi
instance and
call its transform()
method multiple times so that the server subprocess
are not spawned needlessly more than once:
import { Seonbi } from "https://deno.land/x/seonbi/mod.ts";
const inputs = [
"εΊθ©©",
"ηζΏ μλ 거리",
"ε€ͺεμ μμΉ¨",
"무μμ΄ ζι",
"λ μ€λ ε°ε",
"λ³ ν€λ λ°€",
"μ¬ν ζ屬",
];
const seonbi = new Seonbi();
const outputs = await Promise.all(inputs.map(input => seonbi.transform(input)));
console.log(outputs);
/*
[
"μμ",
"κ°ν μλ 거리",
"νμ΄μ μμΉ¨",
"무μμ΄ μκ°",
"λ μ€λ μ§λ",
"λ³ ν€λ λ°€",
"μ¬ν μ‘±μ",
]
*/