hanspell 0.9.2 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,17 +8,16 @@
8
8
 
9
9
  ## 설치
10
10
 
11
- 먼저 [Node.js](https://nodejs.org/ko/)를 설치한 뒤, 다음을 실행하면 `hanspell`을
12
- 설치합니다.
11
+ [Node.js](https://nodejs.org/ko/)를 설치한 뒤, 다음을 실행하면 `hanspell`을 설치합니다.
13
12
 
14
13
  ```sh
15
- sudo npm install -g hanspell
14
+ npm install -g hanspell
16
15
  ```
17
16
 
18
- 설치 환경에 따라 `sudo` 명령어를 빼야 수 있습니다.
17
+ Node.js 환경에 따라 `sudo` 명령이 필요할 수도 있습니다..
19
18
 
20
19
  ```sh
21
- npm install -g hanspell
20
+ sudo npm install -g hanspell
22
21
  ```
23
22
 
24
23
  ## 명령어 사용법
@@ -53,7 +52,7 @@ $ hanspell-cli
53
52
  ...</font>
54
53
  </pre>
55
54
 
56
- ![스크린샷](https://raw.githubusercontent.com/9beach/hanspell/master/hanspell-screenshot.png '한스펠 스크린샷')
55
+ ![스크린숏](https://raw.githubusercontent.com/9beach/hanspell/master/hanspell-screenshot.png '한스펠 스크린숏')
57
56
 
58
57
  파일의 맞춤법을 교정하려면 다음과 같이 명령합니다.
59
58
 
@@ -76,7 +75,7 @@ $ cat your-text | hanspell-cli 2> /dev/null
76
75
  cat your-text | hanspell-cli 2>&1 > /dev/null | grep '->'
77
76
  ```
78
77
 
79
- 클립보드에 복사된 문장을 교정하려면, 맥OS 사용자는 `pbpaste`,
78
+ 클립보드에 복사된 문장을 교정하려면, macOS 사용자는 `pbpaste`,
80
79
  X 윈도 시스템 사용자는 `xclip -o`, 마이크로소프트 윈도우 사용자는
81
80
  `powershell.exe Get-Clipboard` 명령을 이용할 수 있습니다.
82
81
 
@@ -86,7 +85,7 @@ pbpaste | hanspell-cli
86
85
 
87
86
  `~/.hanspell-ignore` 파일에 교정 대상에서 제외할 문자열을
88
87
  [글로브 패턴](<https://ko.wikipedia.org/wiki/글로브_(프로그래밍)>)으로 지정할 수
89
- 있습니다. "그로떼스끄"로 시작하는 문자열과 "빠이"를 교정 대상에서 제외하려면
88
+ 있습니다. ‘그로떼스끄’로 시작하는 문자열과 ‘빠이’를 교정 대상에서 제외하려면
90
89
  다음과 같이 설정하세요.
91
90
 
92
91
  ```txt
@@ -105,20 +104,15 @@ pbpaste | hanspell-cli
105
104
  ...
106
105
  ```
107
106
 
108
- 리눅스나 OS 환경이라면 간단한 스크립트로 자주 틀리는 순으로 정렬할 있습니다.
107
+ 아래는 사용자가 자주 틀리는 맞춤법을 빈도순으로 보여주는 스크립트입니다. 리눅스나 macOS 환경에서만 작동합니다.
109
108
 
110
109
  ```console
111
- $ sort < ~/.hanspell-history | uniq -c | sort -nr | head
110
+ $ sort < ~/.hanspell-history | uniq -c | sort -nr | head -n 5
112
111
  17 모래속에 -> 모래 속에
113
- 13 곤색이다 -> 감색이다
114
- 13 곤색의 -> 감색의
112
+ 13 뿐만 -> 그뿐만
113
+ 13 했는 -> 했는지
115
114
  13 한바퀴 -> 한 바퀴
116
- 13 돌껀데 -> 돌 건데
117
- 10 리랜드는 -> 이랜드는
118
- 9 말했더만 -> 말했더구먼
119
- 7 주름투성이 -> 주름 투성이
120
- 7 암소여서도 -> 암소 여서도
121
- 7 열두살 -> 열두 살
115
+ 7 내노라하는 -> 내로라하는
122
116
  ```
123
117
 
124
118
  ## 마이크로소프트 윈도우 환경
@@ -133,14 +127,13 @@ type your-text.utf-8 | hanspell-cli
133
127
 
134
128
  ## 라이브러리 사용법
135
129
 
136
- Node.js 프로젝트에서 `hanspell` 라이브러리를 사용하려면 먼저 다음을 실행하세요.
130
+ Node.js 프로젝트에서 `hanspell` 라이브러리를 사용하려면 다음을 실행하세요.
137
131
 
138
132
  ```bash
139
133
  cd my-project && npm install --save hanspell
140
134
  ```
141
135
 
142
- `hanspell` 라이브러리는 `spellCheckByDAUM`과 `spellCheckByPNU`, 개의
143
- 함수를 제공합니다. 다음은 사용 예입니다.
136
+ `hanspell` 라이브러리에는 `spellCheckByDAUM` 함수와 `spellCheckByPNU` 함수가 있습니다. 다음은 사용 예입니다.
144
137
 
145
138
  ```javascript
146
139
  // hanspell-example.js
@@ -186,7 +179,11 @@ hanspell.spellCheckByPNU(sentence, 6000, console.log, end, error);
186
179
  ```
187
180
 
188
181
  두 함수의 호출 결과는 모두 `token`, `suggestions` 속성을 가집니다.
189
- `spellCheckByDAUM`의 결과는 `type`, `context` 속성을, `spellCheckByPNU`의 결과는 `info` 속성을 추가로 가집니다.
182
+ `spellCheckByDAUM`은 `type`, `context` 속성을, `spellCheckByPNU`는 `info` 속성을 추가로 가집니다.
190
183
 
191
184
  위의 예시에서 `sentence`가 300 단어 또는 1000자를 넘으면, 인자로 전달된
192
- `console.log`는 여러 번 호출되지만 `end`는 항상 마지막에 한 번만 호출됩니다.
185
+ `console.log`는 여러 번 호출되지만 `end`는 마지막에 한 번만 호출됩니다.
186
+
187
+ ## 라이선스 고지
188
+
189
+ 이 프로그램의 소스 코드는 MIT 라이선스를 따르지만, 부산대학교 인공지능연구실/(주)나라인포테크의 맞춤법 웹 서비스는 권리자가 고지한 대로 개인이나 학생만 무료로 사용할 수 있습니다.
@@ -66,6 +66,7 @@ function parseJSON(response) {
66
66
 
67
67
  const DAUM_URL = 'https://dic.daum.net/grammar_checker.do';
68
68
  const DAUM_MAX_CHARS = 1000;
69
+ const DAUM_MIN_INTERVAL = 400;
69
70
 
70
71
  // Splits a long sentence, and makes spell check requests to the server.
71
72
  // `check` is called at each short sentence with the parsed JSON parameter.
@@ -101,18 +102,27 @@ function spellCheck(sentence, timeout, check, end, error) {
101
102
  if (count === 0 && end !== null) end();
102
103
  };
103
104
 
104
- data.forEach((part) =>
105
+ let i = 0;
106
+
107
+ function post() {
105
108
  request.post(
106
109
  {
107
110
  url: DAUM_URL,
108
111
  timeout,
109
112
  form: {
110
- sentence: part,
113
+ sentence: data[i],
111
114
  },
112
115
  },
113
116
  getResponse,
114
- ),
115
- );
117
+ );
118
+
119
+ i += 1;
120
+ if (i < data.length) {
121
+ setTimeout(post, DAUM_MIN_INTERVAL);
122
+ }
123
+ }
124
+
125
+ post();
116
126
  }
117
127
 
118
128
  module.exports = spellCheck;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hanspell",
3
- "version": "0.9.2",
3
+ "version": "0.9.5",
4
4
  "description": "(주)다음과 부산대학교 인공지능연구실/(주)나라인포테크의 온라인 서비스를 이용한 한글 맞춤법 검사기.",
5
5
  "homepage": "https://github.com/9beach/hanspell",
6
6
  "author": {
@@ -42,7 +42,7 @@
42
42
  "html-entities": "^1.2.1",
43
43
  "minimatch": "^3.0.4",
44
44
  "readline": "^1.3.0",
45
- "request": "^2.87.0",
45
+ "request": "^2.65.0",
46
46
  "unescape": "^1.0.1"
47
47
  },
48
48
  "devDependencies": {
@@ -51,7 +51,7 @@
51
51
  "eslint-config-prettier": "^7.2.0",
52
52
  "eslint-plugin-import": "^2.22.1",
53
53
  "eslint-plugin-prettier": "^3.3.1",
54
- "mocha": "^6.0.0",
54
+ "mocha": "^9.1.2",
55
55
  "prettier": "^2.2.1"
56
56
  }
57
57
  }