hanspell 0.2.6.0 → 0.2.6.1
raw patch · 5 files changed
+76/−46 lines, 5 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- README.md +61/−44
- hanspell-screenshot.png binary
- hanspell.cabal +1/−2
- test/DaumSpellCheckerSpec.hs +7/−0
- test/PnuSpellCheckerSpec.hs +7/−0
README.md view
@@ -1,6 +1,6 @@ # hanspell-hs-`hanspell-hs`는 (주)다음과 부산대학교 인공지능연구실/(주)나라인포테크의 웹 서비스를 이용한 한글 맞춤법 검사기입니다. +`hanspell-hs`는 (주)다음과 부산대학교 인공지능연구실/(주)나라인포테크의 웹 서비스를 이용한 한글 맞춤법 검사기입니다. [비주얼 스튜디오 코드 한스펠](https://github.com/9beach/vscode-hanspell)과 자바스크립트로 작성한 [hanspell](https://github.com/9beach/hanspell)도 있으니 참고하세요.@@ -10,31 +10,24 @@ [](https://travis-ci.org/9beach/hanspell-hs) ## 설치+ [카발](https://www.haskell.org/cabal/)을 이용해서 아래와 같이 설치하세요. ```sh-$ cabal update && cabal install hanspell-$ # `~/.cabal/bin/hanspell` created+cabal update && cabal install hanspell ``` [스택](https://docs.haskellstack.org)을 이용해서 다음과 같이 설치할 수도 있습니다. ```sh-$ stack update && stack install hanspell-$ # `~/.local/bin/hanspell` created-```--일부 배포본에서는 위의 명령을 실행하기 전에 다음을 먼저 실행해야 할 수도 있습니다.--```sh-$ sudo apt install libz-dev+stack update && stack install hanspell ``` ## 명령어 사용법 -```+```console $ hanspell -h-사용법: hanspell [-d | -p | -a | -h] +사용법: hanspell [-d | -p | -a | -h] 옵션: -d, --daum [default] 다음 서비스를 이용해서 맞춤법을 교정합니다@@ -49,7 +42,7 @@ 문장을 직접 입력하거나 클립보드에서 복사해서 맞춤법을 교정할 수 있습니다. 다음은 사용 예시입니다. `CTRL + D`는 줄을 바꾸고 맨 앞에서 입력해야 합니다. -```+```console $ hanspell 나는 차가운 모래속에 두 손을 넣고 검게 빛나는 바다를 바라본다. 우주의 가장자리 같다.@@ -65,65 +58,84 @@  파일의 맞춤법을 교정하려면 다음과 같이 명령합니다.-```-$ cat your-text | hanspell++```sh+cat your-text | hanspell ```+ 로그는 생략한 채 교정된 문장만 보려면 다음과 같이 명령합니다.-```++```console $ cat your-text | hanspell 2> /dev/null 나는 차가운 모래 속에 두 손을 넣고 검게 빛나는 바다를 바라본다. 우주의 가장자리 같다. 쇼코는 해변에 서 있으면 이 세상의 변두리에 선 느낌이 든다고 말했었다. ```+ 교정 제안만 보려면 다음과 같이 명령합니다.-```-$ cat your-text | hanspell 2>&1 > /dev/null | grep '->'++```sh+cat your-text | hanspell 2>&1 > /dev/null | grep '->' ```-클립보드에 복사된 문장을 입력 없이 바로 교정하려면, 맥OS 사용자는 `pbpaste`, -X 윈도 시스템 사용자는 `xclip -o`, 마이크로소프트 윈도우 사용자는 ++클립보드에 복사된 문장을 교정하려면, macOS 사용자는 `pbpaste`,+X 윈도 시스템 사용자는 `xclip -o`, 마이크로소프트 윈도우 사용자는 `powershell.exe Get-Clipboard` 명령을 이용할 수 있습니다.-```-$ pbpaste | hanspell++```sh+pbpaste | hanspell ```-`~/.hanspell-ignore` 파일에 교정 대상에서 제외할 문자열을 -[글로브 패턴](https://ko.wikipedia.org/wiki/글로브_(프로그래밍))으로 지정할 수-있습니다. "그로떼스끄"로 시작하는 문자열과 "빠이"를 교정 대상에서 제외하려면++`~/.hanspell-ignore` 파일에 교정 대상에서 제외할 문자열을+[글로브 패턴](<https://ko.wikipedia.org/wiki/글로브_(프로그래밍)>)으로 지정할 수+있습니다. ‘그로떼스끄’로 시작하는 문자열과 ‘빠이’를 교정 대상에서 제외하려면 다음과 같이 설정하세요.-```++```txt 그로떼스끄* 빠이 ```-`~/.hanspell-history` 파일에 교정 내역이 기록됩니다.++`~/.hanspell-history` 파일에는 맞춤법 교정 내용이 기록됩니다.++```txt+내노라하는 -> 내로라하는+전세계 -> 전 세계+그 뿐만 -> 그뿐만+때 마다 -> 때마다+했는 지 -> 했는지+... ```-$ sort < ~/.hanspell-history | uniq -c | sort -nr | head ++아래는 사용자가 자주 틀리는 맞춤법을 빈도순으로 보여주는 셸 스크립트입니다.++```console+$ sort < ~/.hanspell-history | uniq -c | sort -nr | head -n 5 17 모래속에 -> 모래 속에- 13 곤색이다 -> 감색이다- 13 곤색의 -> 감색의+ 13 그 뿐만 -> 그뿐만+ 13 했는 지 -> 했는지 13 한바퀴 -> 한 바퀴- 13 돌껀데 -> 돌 건데- 10 리랜드는 -> 이랜드는- 9 말했더만 -> 말했더구먼- 7 주름투성이 -> 주름 투성이- 7 암소여서도 -> 암소 여서도- 7 열두살 -> 열두 살+ 7 내노라하는 -> 내로라하는 ``` ## 터미널 및 파일 인코딩 `hanspell`은 UTF-8으로 설정된 터미널에서만 테스트되었습니다.-```-$ cat your-text.utf-8 | hanspell++```sh+cat your-text.utf-8 | hanspell ``` 홈 디렉터리의 `.hanspell-ignore` 파일 또한 UTF-8 인코딩으로 저장해야 합니다. ## 라이브러리 사용법 -[Language.Hanspell](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html) 라이브러리는 -[Typo](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#t:Typo) 자료구조와 관련 함수, 그리고 -[spellCheckByDaum](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#v:spellCheckByDaum), -[spellCheckByPnu](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#v:spellCheckByPnu) +[Language.Hanspell](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html) 라이브러리는+[Typo](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#t:Typo) 자료구조와 관련 함수, 그리고+[spellCheckByDaum](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#v:spellCheckByDaum),+[spellCheckByPnu](https://hackage.haskell.org/package/hanspell/docs/Language-Hanspell.html#v:spellCheckByPnu) 함수를 제공합니다. 다음은 사용 예입니다.+ ```haskell module HanspellExample where @@ -136,7 +148,8 @@ ``` 다음의 결과가 예상됩니다.-```++```txt 위에계신분, -> 위에 계신 분, 뒤에 오는 명사를 수식하는 관형격 어미 ‘-ㄴ’, ‘-는’, ‘-던’, ‘-ㄹ’ 등과 의존명사는 띄어 쓰는 것이 옳습니다. (예)@@ -151,3 +164,7 @@ 옷을 잘 차려입고 나서니 딴사람 같구나. 다음 대화를 잘 듣고 물음에 답하세요. ```++## 라이선스 고지++이 프로그램의 소스 코드는 MIT 라이선스를 따르지만, 부산대학교 인공지능연구실/(주)나라인포테크의 맞춤법 웹 서비스는 권리자가 고지한 대로 개인이나 학생만 무료로 사용할 수 있습니다.
− hanspell-screenshot.png
binary file changed (197479 → absent bytes)
hanspell.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack name: hanspell-version: 0.2.6.0+version: 0.2.6.1 synopsis: Korean spell checker description: This package includes @hanspell@, a simple command line spell check program and a library, @Language.Hanspell@. Both of them are based on DAUM spell check web service and Pusan National University spell check web service. category: language,korean,spellchecker@@ -19,7 +19,6 @@ build-type: Simple extra-source-files: README.md- hanspell-screenshot.png test/long-paragraph-sample.txt source-repository head
test/DaumSpellCheckerSpec.hs view
@@ -24,12 +24,19 @@ sampleText = "안녕 하세요.자줏 빛 합니다.호호 하세요. 삐리릿!" sampleTextFixed = "안녕하세요. 자주 빛 합니다. 호호하세요. 삐리릿!" sampleTextCorrect = "안녕하세요."+sampleTextEmpty = "" sampleTextLn = "\n" spec :: Spec spec = do describe "spellCheckByDaum correct sample text test" $ it "returns 0 typos" $ do+ typos <- liftIO (spellCheckByDaum sampleTextEmpty)+ length typos `shouldBe` 0++ Just typos' <- runMaybeT $ spellCheckByDaum sampleTextEmpty+ typos `shouldBe` typos'+ typos <- liftIO (spellCheckByDaum sampleTextCorrect) length typos `shouldBe` 0
test/PnuSpellCheckerSpec.hs view
@@ -24,12 +24,19 @@ sampleText = "안녕 하세요.자줏 빛 합니다.호호 하세요. 삐리릿!" sampleTextFixed = "안녕 하세요. 자줏 빛 합니다.호호 하세요. 삐리릭!" sampleTextCorrect = "안녕하세요."+sampleTextEmpty = "" sampleTextLn = "\n" spec :: Spec spec = do describe "spellCheckByPnu correct sample text test" $ it "returns 0 typos" $ do+ typos <- liftIO (spellCheckByPnu sampleTextEmpty)+ length typos `shouldBe` 0++ Just typos' <- runMaybeT $ spellCheckByPnu sampleTextEmpty+ typos `shouldBe` typos'+ typos <- liftIO (spellCheckByPnu sampleTextCorrect) length typos `shouldBe` 0