# 파이토치에 기여하기 - Hunspell 설치 및 사용

**URL:** <https://discuss.pytorch.kr/t/hunspell/624>\
**Category:** 읽을거리&정보공유\
**Tags:** 오픈소스-컨트리뷰션-아카데미, 파이토치, hunspell, 오타찾기, 기여하기, opensource\
**Created:** [10월 5, 2022, 4:01오전 UTC](https://discuss.pytorch.kr/t/hunspell/624 "2022-10-05T04:01:32Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![black33jo](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/black33jo/32/484_2.png) [@black33jo](https://discuss.pytorch.kr/u/black33jo)\
**Post date:** [10월 5, 2022, 4:01오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/1 "2022-10-05T04:01:32Z")

</div>

# 글을 쓰게 된 이유

> **[2025 오픈소스 컨트리뷰션 아카데미 \[체험형-2차\] 멘티 모집 \<종료\>](https://www.contribution.ac/)**
>
> 🌱 모집대상

2022 오픈소스 컨트리뷰션 아카데미의 '파이토치 튜토리얼 번역' 팀에서 활동하였습니다. 문서를 번역하거나, 기존에 번역된 문서들에 있는 오타를 찾기 위해 Hunspell을 사용해보니 편리한 점이 많았습니다. 그래서 OS별로 설치 및 사용법을 간단하게 정리해보았습니다.

# Hunspell 소개

Hunspell 은 Libre Office, Mozilla firefox, Google Chrome등에서 사용되는 맞춤법 검사기입니다.  
자세한 내용은 [http://hunspell.github.io/](http://hunspell.github.io/) Hunspell 소개 페이지와 [GitHub - spellcheck-ko/hunspell-dict-ko: Korean spellchecking dictionary for Hunspell](https://github.com/spellcheck-ko/hunspell-dict-ko) Hunspell 한국어 사전 레포지토리를 참고해주세요.

# ⏺ Windows용

방법 1) windows에서 wsl 설치하여 hunspell 사용(권장)

[WSL 설치 | Microsoft Learn](https://docs.microsoft.com/ko-kr/windows/wsl/install) 참고

powershell terminal open

```auto
wsl --install

```

wsl 설치 후 PC를 다시 시작하면 wsl ubuntu를 자동으로 설치 하단 Linux 설치 방법 참고 hunspell 설치

방법 2) sigil을 활용한 hunspell 사용

1. sigil 다운로드 [Download Sigil - Sigil-Ebook](https://sigil-ebook.com/sigil/download/) 참고

2. sigil만 설치시 영문만 적용되어있는데 한국어도 적용하기 위한 ko-aff-dic-0.7.92.zip 다운로드

[Releases · spellcheck-ko/hunspell-dict-ko · GitHub](https://github.com/spellcheck-ko/hunspell-dict-ko/releases) 참고 3. sigil에 한국어도 등록하기 위해 (ex -\> C:\Program Files\Sigil\hunspell\_dictionaries) 폴더에 다운받았던 모음집 추가하기 4. sigil 실행시 편집 -\> 기본설정 -\> 맞춤법 검사 사전에 / 기본 언어 사전 : 한국어 , 2차 언어사전 영어-미국 으로 변경

 ![Untitled](https://discuss.pytorch.kr/uploads/default/original/1X/1504c34383c76ca70b62c51d58e98261b504cc4d.png)

1. txt xhtml을 지원하므로 변환 후 사용!

# ⏺ Linux용(Ubuntu, WSL)

[https://zoomadmin.com/HowToInstall/UbuntuPackage/hunspell](https://zoomadmin.com/HowToInstall/UbuntuPackage/hunspell) 참고

```auto
sudo apt-get update -y

```

```auto
sudo apt-get install -y hunspell

```

# ⏺ Mac용

## Homebrew 설치

[https://brew.sh/index\_ko](https://brew.sh/index_ko) 참고

```auto
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

```

## Hunspell 설치

brew 업데이트 및 업그레이드

```auto
brew update
brew upgrade

```

hunspell 설치

```auto
brew install hunspell

```

한국어 사전 파일 추가

> **[Releases · spellcheck-ko/hunspell-dict-ko](https://github.com/spellcheck-ko/hunspell-dict-ko/releases)**
>
> Korean spellchecking dictionary for Hunspell. Contribute to spellcheck-ko/hunspell-dict-ko development by creating an account on GitHub.

위 링크에서 ko-aff-dic 파일 받은 후 압축 해제

 ![스크린샷_2022-08-15_오후_7.44.20](https://discuss.pytorch.kr/uploads/default/original/1X/1226ea47720f5823e7ccc96b7e791f32275da9e4.png)  
압축 해제 후 나온 .aff 파일과 .dic 파일의 이름을 ko\_KR로 변경

 ![스크린샷_2022-08-15_오후_7.45.56](https://discuss.pytorch.kr/uploads/default/original/1X/31f1471fbf3d3ae8325805cb8148bc57490222e0.png)

 ![스크린샷_2022-08-15_오후_7.46.28](https://discuss.pytorch.kr/uploads/default/original/1X/f989228cc7690c9c5f6fd6dabc89e6deedbcb6d4.png)

ko\_KR.aff, ko\_KR.dic 파일을 홈/Library/Spelling 폴더로 이동

 ![스크린샷_2022-08-15_오후_7.49.15](https://discuss.pytorch.kr/uploads/default/original/1X/b185e39425e7a8a94a2e22cc539f21ba0f7bbb50.png)

추가 팁: Library 폴더가 안보이는 경우 Shift + command + . 키를 눌러 숨김 폴더를 보이게 하면 나옵니다.

 ![스크린샷_2022-08-15_오후_7.50.35](https://discuss.pytorch.kr/uploads/default/original/1X/1c759c52ba2226155ae183c4afdabba5bf3916a2.png)

설치 확인

```auto
hunspell -v

```

 ![스크린샷_2022-08-15_오후_7.51.26](https://discuss.pytorch.kr/uploads/default/original/1X/c896fe0710d9611f33f95d53da4637062130576b.png)

hunspell의 버전이 표시되면 설치 완료.

# ⏺ Hunspell 사용법

### 모든 명령어 보기

 ![스크린샷_2022-08-15_오후_7.41.25](https://discuss.pytorch.kr/uploads/default/original/1X/b8dbdb54869a006932725cd28f4573d4be94cb10.png)

```auto
hunspell -h

```

### 사용 방법

- 기본 사용법

```auto
hunspell -l "검사할 파일"

```

해당 파일속 오타를 출력한다.

- 정렬, 중복 제거, 저장

```auto
hunspell -l "검사할 파일" | sort | uniq > typos.txt

```

sort : 알파벳 순으로 정렬

uniq : 해당하는 오타를 한 번만 출력

“\> 저장 파일명": 해당 이름으로 저장

- 예시  
 ![스크린샷_2022-08-15_오후_8.49.21](https://discuss.pytorch.kr/uploads/default/original/1X/bb9da7b1a6cad7e36baaaa7e303f84cc9e96c4de.png)  
해당 폴더 속 .py 확장자를 가진 모든 파일을 검사, 정렬, 중복 제거, typos.txt 파일로 저장  
 ![스크린샷_2022-08-15_오후_8.50.07](https://discuss.pytorch.kr/uploads/default/original/1X/4afd88c7101e5050d4c0783e97e8864412949acf.png)

## 추가 명령어

### grep

리눅스에서 특정 파일 속 문자열을 찾는 명령어

```auto
# 특정 문자열 찾기
grep '찾을문자' 파일명

# 여러 파일에서 특정 문자열 찾기
grep '찾을문자' 파일명1 파일명2

```

응용 사용

```auto
# 특정 파일에서 문자열이 포함된 행을 찾기
grep '^[ab]' 파일명

# 특정 파일에서 a로 시작하는 모든 단어 찾기
grep 'a*' 파일명

# 특정 파일에서 a로 시작하고 z로 끝나는 5자리 단어 찾기
grep 'a...z' 파일명

# 특정 파일에서 a, b, c로 시작하는 모두 찾기
grep [a-c] 파일명

# 특정 파일에서 apple 또는 Apple로 시작하는 단어 모두 찾기
grep [aA]pple 파일명

# 특정 파일에서 a나 b로 시작되는 모든 행을 찾기
grep '^[ab]' 파일명

# 특정 파일에서 여러개 문자열 찾기
cat 파일명 | grep 'Apple' | grep 'Banana'

```

옵션

- **c :** 일치하는 행의 수를 출력한다.

- **i :** 대소문자를 구별하지 않는다.

- **v :** 일치하지 않는 행만 출력한다.

- **n :** 포함된 행의 번호를 함께 출력한다.

- **l :** 패턴이 포함된 파일의 이름을 출력한다.

- **w :** 단어와 일치하는 행만 출력한다.

- **x :** 라인과 일치하는 행만 출력한다.

- **r :** 하위 디렉토리를 포함한 모든 파일에서 검색한다.

- **m 숫자 :** 최대로 표시될 수 있는 결과를 제한한다.

- **E :** 찾을 패턴을 정규 표현식으로 찾는다.

- **F :** 찾을 패턴을 문자열로 찾는다.

hunspell 과 동시 사용 예시

```auto
grep '#*' ./*.py > test.txt ; hunspell -l test.txt > typos.txt

```

---

<div class="post-metadata">

**Author:** ![9bow](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/9bow/32/16301_2.png) [@9bow](https://discuss.pytorch.kr/u/9bow)\
**Post date:** [10월 5, 2022, 5:11오후 UTC](https://discuss.pytorch.kr/t/hunspell/624/2 "2022-10-05T17:11:07Z")

</div>

우와, 꼼꼼하게 잘 정리해주셔서 감사합니다!!!

---

<div class="post-metadata">

**Author:** ![ky\_p](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/ky_p/32/1406_2.png) [@ky\_p](https://discuss.pytorch.kr/u/ky_p)\
**Post date:** [3월 29, 2023, 6:41오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/3 "2023-03-29T06:41:37Z")

</div>

안녕하세요 hunspell-ko를 설치해봤는데도 작동은 안 하는데 혹시 왜 그런지 아시나요? 윈도우에서 wsl로 ubuntu20.04 설치하고 해봤는데 잘 안됩니다.

---

<div class="post-metadata">

**Author:** ![black33jo](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/black33jo/32/484_2.png) [@black33jo](https://discuss.pytorch.kr/u/black33jo)\
**Post date:** [3월 29, 2023, 7:07오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/4 "2023-03-29T07:07:04Z")

</div>

에러 메시지나 어떤 명령어를 주어 사용하셨는지 알려주시면 찾아보겠습니다!

---

<div class="post-metadata">

**Author:** ![ky\_p](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/ky_p/32/1406_2.png) [@ky\_p](https://discuss.pytorch.kr/u/ky_p)\
**Post date:** [3월 29, 2023, 7:21오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/5 "2023-03-29T07:21:42Z")

</div>

아 죄송합니다. hunspell -l hs.txt 이런 식으로 명령어를 setting하고 했었는데 다른 명령어를 추가하여 해결했습니다. 감사합니다.

---

<div class="post-metadata">

**Author:** ![imimbora](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/imimbora/32/3237_2.png) [@imimbora](https://discuss.pytorch.kr/u/imimbora)\
**Post date:** [8월 1, 2023, 9:36오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/6 "2023-08-01T09:36:39Z")

</div>

윈도우 환경에서 hunspell 버전 확인 및 테스트 해보았는데요.  
혹시 홈/Library/Spelling 이런 경로가 없는데 ko-aff-dic 파일들을 어디에 넣어줘야 하는걸까요?

---

<div class="post-metadata">

**Author:** ![black33jo](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/black33jo/32/484_2.png) [@black33jo](https://discuss.pytorch.kr/u/black33jo)\
**Post date:** [8월 2, 2023, 11:53오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/7 "2023-08-02T11:53:53Z")

</div>

임보라님! 일이 바빠서 답변이 늦어졌네요 ㅜㅜ  
윈도우 환경에서 WSL로 설치 하신건가요? WSL로 설치하셨으면 Linux용 설치법으로 따라하시면 됩니다.  
그런데 설명에 sudo apt-get install hunspell-ko 가 빠져있었네요;; 이 명령어 입력하시면 자동으로 hunspell 폴더에 ko\_KR.aff, ko\_KR.dic 파일 추가됩니다.  
Linux에서 해당 파일들 경로는 usr/share/hunspell 입니다.

---

<div class="post-metadata">

**Author:** ![black33jo](https://discuss.pytorch.kr/user_avatar/discuss.pytorch.kr/black33jo/32/484_2.png) [@black33jo](https://discuss.pytorch.kr/u/black33jo)\
**Post date:** [8월 2, 2023, 11:58오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/8 "2023-08-02T11:58:18Z")

</div>

# 추가 내용

Linux용 설치법에서 추가로

```Bash
sudo apt-get install hunspell-ko

```

입력하시면 자동으로 한국어 사전 파일이 추가됩니다!

---

<div class="post-metadata">

**Author:** ![shuz](https://discuss.pytorch.kr/letter_avatar_proxy/v4/letter/s/13edae/32.png) [@shuz](https://discuss.pytorch.kr/u/shuz)\
**Post date:** [1월 8, 2024, 1:42오전 UTC](https://discuss.pytorch.kr/t/hunspell/624/10 "2024-01-08T01:42:08Z")

</div>

안녕하세요.

혹시 어떤 명령어 추가하셨는지 알려주실 수 있을까요??
