hanspell 0.9.3 → 0.9.6
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/lib/daum-spell-check.js +14 -4
- package/lib/pnu-spell-check.js +4 -2
- package/package.json +2 -2
package/lib/daum-spell-check.js
CHANGED
|
@@ -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
|
-
|
|
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:
|
|
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/lib/pnu-spell-check.js
CHANGED
|
@@ -23,8 +23,10 @@ function parseJSON(response) {
|
|
|
23
23
|
}
|
|
24
24
|
const info = pnutypo.help
|
|
25
25
|
.replace(/< *[bB][rR] *\/>/g, '\n')
|
|
26
|
-
.replace(/\n\n
|
|
27
|
-
.replace(/\n\(예\)
|
|
26
|
+
.replace(/\n\n/g, '\n')
|
|
27
|
+
.replace(/\n\(예\) /g, '\n(예)\n')
|
|
28
|
+
.replace(/ \(예\) /g, '\n(예)\n')
|
|
29
|
+
.replace(/ */g, '\n');
|
|
28
30
|
|
|
29
31
|
return {
|
|
30
32
|
token: decode(pnutypo.orgStr),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hanspell",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.6",
|
|
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.
|
|
45
|
+
"request": "^2.65.0",
|
|
46
46
|
"unescape": "^1.0.1"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|