hanspell 0.2.2.0 → 0.2.3.0
raw patch · 5 files changed
+30/−24 lines, 5 filesdep ~bytestringPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: bytestring
API changes (from Hackage documentation)
Files
- README.md +10/−4
- app/Main.hs +4/−1
- hanspell.cabal +6/−6
- src/Language/Hanspell/PnuSpellChecker.hs +1/−1
- src/Language/Hanspell/Typo.hs +9/−12
README.md view
@@ -1,12 +1,11 @@ # hanspell-hs `hanspell-hs`는 (주)다음과 부산대학교 인공지능연구실/(주)나라인포테크의 웹 서비스를 이용한 한글 맞춤법 검사기입니다. -`hanspell-hs`는 자바스크립트로 작성한 [hanspell](https://github.com/9beach/hanspell)의-[하스켈](https://www.haskell.org/) 포트입니다. 참고하세요.+자바스크립트로 작성한 [hanspell](https://github.com/9beach/hanspell)도 있으니+참고하세요. [](https://hackage.haskell.org/package/hanspell) - [](https://travis-ci.org/9beach/hanspell-hs) ## 설치@@ -41,6 +40,9 @@ -p, --pnu 부산대학교 서비스를 이용해서 맞춤법을 교정합니다 -a, --all 두 서비스의 모든 결과를 반영해서 맞춤법을 교정합니다 -h, --info 도움말을 출력합니다++버그 리포트와 제안: <https://github.com/9beach/hanspell-hs/issues>+한스펠 홈 페이지: <https://github.com/9beach/hanspell-hs/> ``` 문장을 직접 입력하거나 클립보드에서 복사해서 맞춤법을 교정할 수 있습니다. 다음은@@ -116,7 +118,11 @@ ## 라이브러리 사용법 -`Language.Hanspell` 라이브러리는 `Typo` 자료구조와 관련 함수, 그리고 `spellCheckByDaum`, `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
app/Main.hs view
@@ -78,4 +78,7 @@ \ -d, --daum 다음 서비스를 이용해서 맞춤법을 교정합니다\n\ \ -p, --pnu 부산대학교 서비스를 이용해서 맞춤법을 교정합니다\n\ \ -a, --all [default] 두 서비스의 모든 결과를 반영해서 맞춤법을 교정합니다\n\-\ -h, --info 도움말을 출력합니다"+\ -h, --info 도움말을 출력합니다\n\+\\n\+\버그 리포트와 제안: <https://github.com/9beach/hanspell-hs/issues>\n\+\한스펠 홈 페이지: <https://github.com/9beach/hanspell-hs/>"
hanspell.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.33.0.+-- This file has been generated from package.yaml by hpack version 0.34.2. -- -- see: https://github.com/sol/hpack ----- hash: c8db3b070afbfe74d26c8106c1c36da23428201223748b67c04e37d9d496ecb2+-- hash: 8b546bd4516128f3b41c87be1007b0189c55601e3ddd380c9fe341f16c75aa9b name: hanspell-version: 0.2.2.0+version: 0.2.3.0 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@@ -45,7 +45,7 @@ aeson >=1.4.7 && <1.6 , async >=2.2.2 && <2.3 , base >=4.7 && <5- , bytestring >=0.10.8 && <0.11+ , bytestring >=0.10.8 && <0.12 , directory >=1.3.0 && <1.4 , html-entities >=1.1.4 && <1.2 , http-client >=0.6.4 && <0.8@@ -70,7 +70,7 @@ aeson >=1.4.7 && <1.6 , async >=2.2.2 && <2.3 , base >=4.7 && <5- , bytestring >=0.10.8 && <0.11+ , bytestring >=0.10.8 && <0.12 , directory >=1.3.0 && <1.4 , hanspell , html-entities >=1.1.4 && <1.2@@ -103,7 +103,7 @@ , aeson >=1.4.7 && <1.6 , async >=2.2.2 && <2.3 , base >=4.7 && <5- , bytestring >=0.10.8 && <0.11+ , bytestring >=0.10.8 && <0.12 , directory >=1.3.0 && <1.4 , hanspell , hspec
src/Language/Hanspell/PnuSpellChecker.hs view
@@ -146,7 +146,7 @@ -- Parses the response HTML to [Typo]. htmlToTypos :: String -> [Typo] htmlToTypos body =- case matchRegex (mkRegex "^\tdata = (.*);$") body of + case matchRegex (mkRegex "^\tdata = (.*);") body of Nothing -> [] Just [jsonText] -> map pnuTypoToTypo pnuTypos where
src/Language/Hanspell/Typo.hs view
@@ -50,20 +50,17 @@ -- greyed out. typoToStringWithStyle :: Bool -> Typo -> String typoToStringWithStyle isTTY typo = token typo- ++ grey isTTY " -> "- ++ intercalate (grey isTTY ", ") (suggestions typo)- ++ "\n"- ++ grey isTTY (info typo)+ ++ grey isTTY " -> "+ ++ intercalate (grey isTTY ", ") (suggestions typo)+ ++ "\n"+ ++ grey isTTY (info typo) -- | Removes the 'Typo's whose 'token's are duplicated. Order preserving and -- O(nlogn). rmdupTypos :: [Typo] -> [Typo]-rmdupTypos =- map snd . sortBy compareOrder . rmdup . sortBy compareToken . zip [1..]+rmdupTypos = map snd . sortBy compareOrder . map head . groupBy sameToken + . sortBy compareToken . zip [1..] where- compareToken (n, t) (n', t') = compare (token t) (token t')- compareOrder (n, t) (n', t') = compare n n'- rmdup (a:b:typos) = if compareToken a b == EQ- then rmdup (a:typos)- else a:rmdup (b:typos)- rmdup typos = typos+ sameToken (_, t) (_, t') = token t == token t'+ compareToken (_, t) (_, t') = compare (token t) (token t')+ compareOrder (n, _) (n', _) = compare n n'