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 🙏

© 2024 – Pkg Stats / Ryan Hefner

hangul-chosung-search

v1.0.2

Published

hangul chosung searcher

Downloads

156

Readme

hangul-chosung-search

NPM Module

Demo Page

설명

한글 초성 검색 모듈입니다. 대상 문자열에 입력 문자열이 포함되는지를 검사하는 기능입니다. (영문자도 지원합니다.)

사용자가 입력창에 계속 타이핑 할 때 결과의 깜빡임이 없는 것을 고려하여 개발하였습니다. 즉, 로직상에서 입력 문자의 종성이 초성 자음으로도 구분되도록 하였고, 검색창에서 UI 상 깜빡임이 없습니다.

회사 업무로 한글 초성 검색 기능을 개발하던 중 만들다보니 재밌기도 하고, 또 오픈 소스로 올리면 많은 분들이 유용하게 사용하실 수 있을 것 같아 NPM Module로 배포하게 되었습니다.

한글은 유니코드 문자집합에서 U+1100~U+115E까지는 초성, U+1161~U+11A7까지는 중성, U+11A8~U+11FF까지는 종성. 이런 식으로 인코딩 되어 있습니다.

자모가 합쳐진 문자를 정규화를 통해 각각 초성, 중성, 종성으로 분해할 수 있는데, 이러한 기능은 Hangul.js를 이용하였습니다.

설치

node.js

npm install hangul-chosung-search

사용법

import search from "hangul-chosung-search";
search(target, text);
// return true or false

hangul-chosung-search 모듈을 import 한 후, 각각 target: 대상 문자열, text: 입력 문자열 을 인자로 전달해 줍니다.

대상 문자열에 입력 문자열이 포함된다면 true 를 반환, 포함되지 않는다면 false 를 반환합니다.

search('안녕', 'ㅇ') // true

search('안녕', 'ㄹ') // false

search('안녕', 'ㅇㄴ') // true

search('Bitcoin', 'bit') // true

다음과 같이 종성은 검색 대상에서 제외됩니다.

search('말', 'ㄹ') // false

꽤나 재미있는 패턴도 고려해 보았습니다.

search('재미있는', 'ㅈㅁ있ㄴ') // true

그 외

적중 점수 기능이 추가되면 좋을 것 같습니다. 전체의 얼만큼이나 적중했는지를 알려주는 score를 함께 반환해 점수가 높은 단어가 검색창에서 더 상위에 display 되도록 하면 좋을 것 같습니다.