Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hmmhmmhm/hangul-search-js

πŸ‡°πŸ‡· Simple Korean text search module
https://github.com/hmmhmmhm/hangul-search-js

korea korean korean-language korean-letters korean-nlp korean-text-processing

Last synced: about 2 months ago
JSON representation

πŸ‡°πŸ‡· Simple Korean text search module

Awesome Lists containing this project

README

        

# πŸ‡°πŸ‡· Hangul Search Js

> It allows you to search for simple Korean characters in the most consistent order regardless of the character assembly order.

![Github Workflow](https://github.com/hmmhmmhm/hangul-search-js/actions/workflows/test.yml/badge.svg)
![GitHub License](https://img.shields.io/github/license/hmmhmmhm/hangul-search-js)
![Jest Coverage](https://raw.githubusercontent.com/hmmhmmhm/hangul-search-js/main/badges/badge-lines.svg)
![Gzip Size](https://img.badgesize.io//hmmhmmhm/hangul-search-js/main/export/hangul-search.js.svg?compression=gzip)
[![TypeScript](https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg)](http://www.typescriptlang.org/)
![NPM Version](https://img.shields.io/npm/v/hangul-search-js.svg?label=version)
![jsDelivr](https://badgen.net/jsdelivr/v/npm/hangul-search-js)


## πŸ“¦ Usage (ES5+)

```bash
npm i hangul-search-js
```

```ts
import { createSearch } from 'hangul-search-js'

const search = createSearch([
'λ‘―λ°μ‹œλ„€λ§ˆ',
'유튜브',
'ν”„λ‘œκ²Œμ΄λ¨Έ',
'κ°€λ‚œ',
'λ‚œκ°€'
])

const result = search('μ‹œγ„΄')
// result: ['λ‘―λ°μ‹œλ„€λ§ˆ', 'ν”„λ‘œκ²Œμ΄λ¨Έ', 'κ°€λ‚œ', 'λ‚œκ°€']

const resultExact = search('μ‹œγ„΄', { exact: true })
// result: ['λ‘―λ°μ‹œλ„€λ§ˆ']

const resultExact = search('λ‚œκ°€', { exact: true, order: true })
// result: ['λ‚œκ°€']
```


## πŸ“¦ Usage (CDN)

```html

```

```js
var createSearch = window.hangulSearch

var search = createSearch([
'λ‘―λ°μ‹œλ„€λ§ˆ',
'유튜브',
'ν”„λ‘œκ²Œμ΄λ¨Έ',
'κ°€λ‚œ',
'λ‚œκ°€'
])

var result = search('μ‹œγ„΄')
// result: ['λ‘―λ°μ‹œλ„€λ§ˆ', 'ν”„λ‘œκ²Œμ΄λ¨Έ', 'κ°€λ‚œ', 'λ‚œκ°€']

var resultExact = search('μ‹œγ„΄', { exact: true })
// result: ['λ‘―λ°μ‹œλ„€λ§ˆ']

var resultExact = search('λ‚œκ°€', { exact: true, order: true })
// result: ['λ‚œκ°€']
```


## πŸ’‘ License

> MIT Licensed.