# hanspell

> (주)다음과 네이버(주)의 온라인 서비스를 이용한 한글 맞춤법 검사기.

Latest version **1.0.1** (published 2026-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install hanspell
pnpm add hanspell
yarn add hanspell
bun add hanspell
```

Provides the command `hanspell-cli`.

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2026-05-23 |
| First published | 2018-08-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 3 |
| Unpacked size | 26.4 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 190 |
| Author | 9beach |
| Maintainers | 9beach |
| Keywords | 한글, 맞춤법, 한국어, 한국, Korean, Spell, hangul, Korea, spell check, SpellCheck |

## Links

- npm: https://www.npmjs.com/package/hanspell
- Repository: https://github.com/9beach/hanspell
- Issues: https://github.com/9beach/hanspell/issues
- npm.io page: https://npm.io/package/hanspell

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [minimatch](https://npm.io/package/minimatch.md) ^10.2.5
- [html-entities](https://npm.io/package/html-entities.md) ^2.6.0

## Recent versions

- 1.0.1 (latest) — 2026-05-23
- 1.0.0 — 2026-05-23
- 0.10.0 — 2026-05-23
- 0.9.7 — 2022-09-30
- 0.9.6 — 2022-09-07
- 0.9.5 — 2022-09-06
- 0.9.4 — 2021-11-24
- 0.9.3 — 2021-10-09
- 0.9.2 — 2021-08-19
- 0.9.1 — 2021-08-08
- 0.9.0 — 2021-08-08
- 0.8.9 — 2021-08-04
- 0.8.8 — 2021-07-31
- 0.8.7 — 2021-07-24
- 0.8.6 — 2021-07-23
- … 45 more at https://npm.io/package/hanspell/versions

## README

# hanspell

`hanspell`은 (주)다음과 네이버(주)의 웹 서비스를 이용한 한글 맞춤법 검사기입니다.

[비주얼 스튜디오 코드 한스펠](https://github.com/9beach/vscode-hanspell)과 [하스켈](https://www.haskell.org/)로 작성한 [hanspell-hs](https://github.com/9beach/hanspell-hs)도 있으니 참고하세요.

[![npm version](https://badge.fury.io/js/hanspell.svg)](https://badge.fury.io/js/hanspell)

## 설치

[한스펠 릴리스](https://github.com/9beach/hanspell/releases)에서 실행파일을 다운로드 하세요.

macOS에서는 다운로드한 실행 파일에 검역(quarantine) 속성이 붙어 "확인되지
않은 개발자" 경고가 뜹니다. 다음 명령으로 한 번만 속성을 지우면 이후
경고 없이 실행됩니다.

```sh
xattr -d com.apple.quarantine ./hanspell
```

소스를 받아서 설치하려면 [Node.js](https://nodejs.org/ko/) 18 이상을 설치한 뒤 다음을 실행하세요.

```sh
npm install -g hanspell
```

Node.js 환경에 따라 `sudo` 명령이 필요할 수도 있습니다.

```sh
sudo npm install -g hanspell
```

## 명령어 사용법

```console
$ hanspell-cli -h
사용법: hanspell-cli [-d | -n | -a | -h]

옵션:
  -d, --daum [default]    다음 서비스를 이용해서 맞춤법을 교정합니다
  -n, --naver             네이버 서비스를 이용해서 맞춤법을 교정합니다
  -a, --all               두 서비스의 모든 결과를 반영해서 맞춤법을 교정합니다
  -h, --info              도움말을 출력합니다

버그 리포트와 제안: <https://github.com/9beach/hanspell/issues>
한스펠 홈 페이지: <https://github.com/9beach/hanspell/>
```

문장을 직접 입력하거나 클립보드에서 복사해서 맞춤법을 교정할 수 있습니다. 다음은
사용 예시입니다. <kbd>CTRL + D</kbd>는 줄을 바꾸고 맨 앞에서 입력해야 합니다.

<pre>
$ hanspell-cli
나는 차가운 모래속에 두 손을 넣고 검게 빛나는 바다를 바라본다.
우주의 가장자리 같다.
쇼코는 해변에 서 있으면 이세상의 변두리에 선 느낌이 든다고 말했었다.
<kbd>CTRL + D</kbd>
모래속에 <font color=grey>-></font> 모래 속에<font color=grey>
띄어쓰기 오류입니다. 대치어를 참고하여 고쳐 쓰세요.</font>
이세상의 <font color=grey>-></font> 이 세상의<font color=grey>
관형사는 뒤에 오는 말과 띄어 쓰는 것이 옳습니다.
...</font>
</pre>

![스크린숏](https://raw.githubusercontent.com/9beach/hanspell/master/hanspell-screenshot.png '한스펠 스크린숏')

파일의 맞춤법을 교정하려면 다음과 같이 명령합니다.

```sh
cat your-text | hanspell-cli
```

로그는 생략한 채 교정된 문장만 보려면 다음과 같이 명령합니다.

```console
$ cat your-text | hanspell-cli 2> /dev/null
나는 차가운 모래 속에 두 손을 넣고 검게 빛나는 바다를 바라본다.
우주의 가장자리 같다.
쇼코는 해변에 서 있으면 이 세상의 변두리에 선 느낌이 든다고 말했었다.
```

교정 제안만 보려면 다음과 같이 명령합니다.

```sh
cat your-text | hanspell-cli 2>&1 > /dev/null | grep '->'
```

클립보드에 복사된 문장을 교정하려면, macOS 사용자는 `pbpaste`,
X 윈도 시스템 사용자는 `xclip -o`, 마이크로소프트 윈도우 사용자는
`powershell.exe Get-Clipboard` 명령을 이용할 수 있습니다.

```sh
pbpaste | hanspell-cli
```

`~/.hanspell-ignore` 파일에 교정 대상에서 제외할 문자열을
[글로브 패턴](<https://ko.wikipedia.org/wiki/글로브_(프로그래밍)>)으로 지정할 수
있습니다. ‘그로떼스끄’로 시작하는 문자열과 ‘빠이’를 교정 대상에서 제외하려면
다음과 같이 설정하세요.

```txt
그로떼스끄*
빠이
```

`~/.hanspell-history` 파일에는 맞춤법 교정 내용이 기록됩니다.

```txt
내노라하는 -> 내로라하는
전세계 -> 전 세계
그 뿐만 -> 그뿐만
때 마다 -> 때마다
했는 지 -> 했는지
...
```

아래는 사용자가 자주 틀리는 맞춤법을 빈도순으로 보여주는 셸 스크립트입니다. 리눅스나 macOS 환경에서만 작동합니다.

```console
$ sort < ~/.hanspell-history | uniq -c | sort -nr | head -n 5
  17 모래속에 -> 모래 속에
  13 그 뿐만 -> 그뿐만
  13 했는 지 -> 했는지
  13 한바퀴 -> 한 바퀴
   7 내노라하는 -> 내로라하는
```

## 마이크로소프트 윈도우 환경

`hanspell`은 UTF-8 인코딩으로 저장된 파일만 인식합니다.

```bash
type your-text.utf-8 | hanspell-cli
```

홈 디렉터리의 `.hanspell-ignore` 파일 또한 UTF-8 인코딩으로 저장해야 합니다.

## 라이브러리 사용법

Node.js 프로젝트에서 `hanspell` 라이브러리를 사용하려면 다음을 실행하세요.

```bash
cd my-project && npm install --save hanspell
```

`hanspell` 라이브러리에는 `spellCheckByDAUM` 함수와 `spellCheckByNAVER` 함수가 있습니다. 다음은 사용 예입니다.

```javascript
// hanspell-example.js
const hanspell = require('hanspell');

const sentence = '리랜드는 얼굴 골격이 굵은게,';
const end = function () {
  console.log('// check ends');
};
const error = function (err) {
  console.error('// error: ' + err);
};

hanspell.spellCheckByDAUM(sentence, 6000, console.log, end, error);
hanspell.spellCheckByNAVER(sentence, 6000, console.log, end, error);
```

다음과 비슷한 결과가 예상됩니다.

```console
[
  {
    type: 'space',
    token: '굵은게,',
    suggestions: [ '굵은 게,' ],
    context: '얼굴 골격이 굵은게,'
  }
]
// check ends
[
  {
    token: '리랜드는',
    suggestions: [ '이랜드는' ],
    info: '맞춤법 오류입니다.'
  },
  {
    token: '굵은게,',
    suggestions: [ '굵은 게,' ],
    info: '띄어쓰기 오류입니다.'
  }
]
// check ends
```

두 함수의 호출 결과는 모두 `token`, `suggestions`, `info` 속성을 가집니다.
`spellCheckByDAUM`은 `type`, `context` 속성을 추가로 가집니다.

TypeScript 사용자는 별도 설정 없이 타입이 자동으로 인식됩니다.

```typescript
import { spellCheckByNAVER, NaverTypo } from 'hanspell';

spellCheckByNAVER(
  '안뇽하세요.',
  6000,
  (data: NaverTypo[]) => console.log(data),
  () => console.log('// check ends'),
  (err) => console.error(err),
);
```


네이버 검사기는 교정 후보를 항상 하나만 제공하고, `info`는 오류 분류(맞춤법/
띄어쓰기/표준어 추천)만 알려 줍니다.

위의 예시에서 `sentence`가 250 단어 또는 1000자를 넘으면, 인자로 전달된
`console.log`는 여러 번 호출되지만 `end`는 마지막에 한 번만 호출됩니다.

## 라이선스 고지

이 프로그램의 소스 코드는 MIT 라이선스를 따릅니다. 다음과 네이버의 맞춤법 웹
서비스는 각 제공사의 이용 약관에 따라 사용해야 합니다.

---
_Source: https://npm.io/package/hanspell · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
