npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dialektike/tossicat

v0.8.1

Published

입력된 단어에 맞게 같이 입력된 토시(조사)를 적절하게 변환하는 라이브러리

Downloads

20

Readme

tossicat for Web

tossicat for Web은 임의의 단어와 그 단어에 붙일 조사(즉 토시)를 입력하면, 입력한 조사를 같이 입력한 단어에 자연스러운 형태로 바꿔서 적절하게 변환해 주는 라이브러리를 만드는 리포지토리(Repository)입니다. 변환할 토시가 여러개 들어 있는 문장을 아래와 같은 형식으로 입력하면,

"{철수, 은} {영희, 과} {밥, 를} 먹습니다."

다음과 같이 변경해 줍니다.

"철수는 영희와 밥을 먹습니다."

이것은 fix_sentence() 함수가 맡습니다.

function fix_sentence(
    sentence: string,
    ): string;

아래와 같이 사용하시면 됩니다.

fix_sentence("{철수, 은} {영희,   과} {밥,  를} 먹습니다.") // 결과: "철수는 영희와 밥을 먹습니다."

앞에서처럼 문장을 다루는 것이 아니라 단순하게 특정 단어에 특정 토시를 붙일 때 어떻게 변환해야 하는 것인지를 알고 싶은 경우도 있습니다. 이런 경우에 사용할 함수는 fix()입니다.

function fix(
    // 토시를 붙이고자 하는 임의의 단어
    word: string,
    // 위 단어(word)에 붙일 조사(즉 토시)
    tossi: string
    ): string;

아래와 같이 사용하시면 됩니다.

fix("밥","을") // 결과: "밥을"
fix("철수", "은") // 결과: "철수는"

위와 같이 이 두 함수는 임의의 단어와 그 단어에 붙일 조사(즉 토시)를 입력하면 적합한 토시로 변경한 다음 단어와 토시를 합쳐 반환하게 됩니다. 현재 이 프로젝트에서 처리할 수 있는 토시(tossi)는 다음과 같습니다. 지속적으로 추가할 예정입니다.

  1. 변환을 고려해야 하는 토시들, 105개
  2. 변환할 필요가 없는 토시들, 33개

이 둘을 합쳐서 총 138개의 토시를 처리할 수 있습니다. 여기에 외국어 단어가 입력되었을 경우 그 단어의 발음을 정확하게 알 수 없기 때문에, "(을)를"과 같이 토시를 병기해 변환하는 경우가 일어날 수 있기 때문에 내부적으로 처리할 수 있는 토시 숫자는 훨씬 많습니다. 이와 관련된 자세한 내용은 RELEASES.md를 참고하세요.

이 리포지토리는 Rust로 작성한 tossicat을 자바스크립트에서 사용하기 위해 러스트의 wasm-pack을 사용하여 컴파일해 WebAssembly로 변환하는 것을 목표로 하고 있습니다. 현재 이 리포지토리를 컴파일해서 npm에서 @dialektike/tossicat이라는 패키지로 배포하고 있습니다.

설치 및 사용법

package.json에 다음과 같이 패키지를 추가하시면 됩니다.

"dependencies": {
      "@dialektike/tossicat": "^0.8.0"
    },

그런 다음 다음과 같이 사용하시면 됩니다.

const js = import("@dialektike/tossicat/tossicat");
    js.then(js => {
        const temp_1 = js.fix("철수","가");
        const temp_2 = js.fix_sentence("{철수, 은} {영희, 처럼} {밥,  를} 먹습니다.");
        const temp = temp_1 + temp_2;
        alert(temp);
    });

외국어로 병기된 단어나 숫자가 포함된 단어가 입력되더라도 마지막 글자만 한글이거나 숫자이면 적절하게 처리할 수 있습니다. 만약 입력된 단어의 글자수가 많거나 변환할 수 없는 토시가 입력되면 에러가 발생하게 됩니다. 에러를 처리하기 위해서는 아래와 같이 하시면 됩니다.

const js = import("@dialektike/tossicat/tossicat");
    js.then(js => {
        try {
            const result = js.fix("철수", "apple");
            alert(result);
        } catch (err) {
            console.error(err);
        }
    });

에러 메세지에 관한 것은 아래 링크를 참고해주세요.

이 리포지토리에 있는 test_web 폴더를 보시면 더 자세히 알 수 있습니다.

빌드 및 배포

이 리포지토리는 Rust 패키지를 위한 것이 아닙니다. wasm-pack을 이용해서 WebAssembly로 컴파일해 npm에 패키지를 배포하는 것이 최종 목표입니다. 만약 러스트 코드에 관심이 있으시면, 여기에서 바인딩해서 사용하고 있는 라이브러리인 tossicat-core를 참고하세요.

1. 사전 준비

Rust와 wasm-pack이 설치되어 있어야 합니다.

cargo install wasm-pack

2. WASM 빌드

아래 명령어로 컴파일합니다. --scope 뒤에 자신의 npm 스코프를 넣어야 합니다.

wasm-pack build --scope <npm-scope>

컴파일하고 나면 pkg 폴더가 만들어지고 거기에 .wasm, .js, .d.ts, package.json 등이 생성됩니다.

3. npm 배포

cd pkg
npm publish --access=public

4. 데모 테스트

cd test_web
npm install
npm run dev

브라우저에서 fix()fix_sentence()의 동작을 확인할 수 있습니다.