hanlint 0.0.18 → 0.0.19

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.
Files changed (125) hide show
  1. package/README.md +17 -16
  2. package/data/calqueFrame.json +20 -20
  3. package/data/cliches.json +33 -33
  4. package/data/confusable.json +20 -20
  5. package/data/easyWords.json +12 -12
  6. package/data/exemplars.json +30 -30
  7. package/data/hiddenDeps.txt +11 -11
  8. package/data/japaneseLoan.json +27 -27
  9. package/data/koreanProse.txt +31 -31
  10. package/data/patterns.json +26 -26
  11. package/data/phraseRepeat.json +2 -2
  12. package/data/platformApis.txt +11 -11
  13. package/data/redundantPair.json +16 -16
  14. package/data/ruleDocs.json +56 -56
  15. package/data/screenNarration.json +10 -10
  16. package/data/screenSentence.json +12 -12
  17. package/data/screenTone.json +6 -6
  18. package/data/screenWord.json +70 -70
  19. package/data/spacing.json +11 -11
  20. package/data/spelling.json +29 -29
  21. package/data/translationese.json +23 -24
  22. package/data/usageCounts.report.json +2 -2
  23. package/data/version.json +1 -1
  24. package/package.json +1 -1
  25. package/src/analysis/grammar/ending.js +1 -1
  26. package/src/analysis/grammar/hangul.js +4 -4
  27. package/src/analysis/grammar/josa.js +1 -1
  28. package/src/analysis/grammar/register.js +1 -1
  29. package/src/analysis/grammar/voice.js +1 -1
  30. package/src/analysis/index.js +2 -2
  31. package/src/analysis/josa.js +1 -1
  32. package/src/analysis/splitSentences.js +1 -1
  33. package/src/analysis/tokenize.js +13 -13
  34. package/src/baseline/store.js +8 -8
  35. package/src/cli/help.js +11 -11
  36. package/src/cli/main.js +135 -124
  37. package/src/cli/walk.js +1 -1
  38. package/src/cli/welcome.js +8 -8
  39. package/src/config/loadConfig.js +3 -3
  40. package/src/config/patch.js +6 -6
  41. package/src/config/readerContract.js +26 -26
  42. package/src/config/settings.js +30 -28
  43. package/src/config/toml.js +9 -9
  44. package/src/data/exemplars.js +21 -21
  45. package/src/data/load.js +6 -6
  46. package/src/data/operations.js +14 -14
  47. package/src/data/patches.js +10 -10
  48. package/src/data/patterns.js +5 -5
  49. package/src/data/profiles.js +5 -5
  50. package/src/data/prose.js +5 -5
  51. package/src/document/model.js +4 -4
  52. package/src/document/parseMarkdown.js +7 -7
  53. package/src/document/plainText.js +3 -3
  54. package/src/document/sourceText.js +24 -24
  55. package/src/edit/applyFixes.js +0 -0
  56. package/src/fingerprint/build.js +6 -6
  57. package/src/fingerprint/codeBlocks.js +3 -3
  58. package/src/fingerprint/codeMarkers.js +4 -4
  59. package/src/fingerprint/dictionaries.js +7 -7
  60. package/src/fingerprint/markers.js +7 -7
  61. package/src/fingerprint/readerState.js +9 -9
  62. package/src/fingerprint/sourceSentence.js +1 -1
  63. package/src/fingerprint/topics.js +1 -1
  64. package/src/guard/contract.js +6 -6
  65. package/src/guard/editLocality.js +1 -1
  66. package/src/guard/outline.js +1 -1
  67. package/src/guard/receipt.js +13 -13
  68. package/src/guard/surface.js +4 -4
  69. package/src/index.js +6 -6
  70. package/src/learn/edits.js +2 -2
  71. package/src/learn/operations.js +1 -1
  72. package/src/regex.js +2 -2
  73. package/src/report/compactReport.js +3 -3
  74. package/src/report/fingerprintJson.js +2 -2
  75. package/src/report/githubReport.js +1 -1
  76. package/src/report/jsonReport.js +2 -2
  77. package/src/report/registerMatch.js +2 -2
  78. package/src/report/sheet.js +16 -16
  79. package/src/report/textReport.js +12 -12
  80. package/src/report/writingSpec.js +15 -15
  81. package/src/rules/code/inputFileSource.js +1 -1
  82. package/src/rules/code/installImport.js +2 -2
  83. package/src/rules/code/platformApi.js +1 -1
  84. package/src/rules/document/countMismatch.js +2 -1
  85. package/src/rules/document/enoughOnce.js +2 -1
  86. package/src/rules/document/fieldEcho.js +10 -6
  87. package/src/rules/document/keywordHeading.js +1 -1
  88. package/src/rules/document/keywordMissing.js +1 -1
  89. package/src/rules/document/noQuestion.js +2 -2
  90. package/src/rules/document/promiseRecall.js +1 -1
  91. package/src/rules/document/tableOddCell.js +1 -1
  92. package/src/rules/finding.js +4 -4
  93. package/src/rules/paragraph/factListParagraph.js +1 -1
  94. package/src/rules/paragraph/paraFragment.js +1 -1
  95. package/src/rules/readerDebt.js +1 -1
  96. package/src/rules/registry.js +26 -26
  97. package/src/rules/sentence/connectorRepeat.js +2 -1
  98. package/src/rules/sentence/danglingDeixis.js +1 -1
  99. package/src/rules/sentence/dash.js +1 -1
  100. package/src/rules/sentence/deixis.js +1 -1
  101. package/src/rules/sentence/doubleNegative.js +2 -1
  102. package/src/rules/sentence/doublePassive.js +2 -1
  103. package/src/rules/sentence/draftHistory.js +2 -1
  104. package/src/rules/sentence/endingRepeat.js +3 -2
  105. package/src/rules/sentence/euiChain.js +1 -1
  106. package/src/rules/sentence/fillerOpener.js +1 -1
  107. package/src/rules/sentence/imperativePeriod.js +1 -1
  108. package/src/rules/sentence/longSentence.js +1 -1
  109. package/src/rules/sentence/negationRedefine.js +1 -1
  110. package/src/rules/sentence/numberOrphan.js +1 -1
  111. package/src/rules/sentence/outsideProfile.js +8 -3
  112. package/src/rules/sentence/phraseRepeat.js +2 -1
  113. package/src/rules/shared/candidates.js +2 -2
  114. package/src/rules/shared/dictionaryRule.js +9 -2
  115. package/src/rules/shared/repeat.js +2 -2
  116. package/src/rules/structure/bridgeRepeat.js +3 -3
  117. package/src/rules/structure/emojiBullet.js +1 -1
  118. package/src/rules/structure/headingSkip.js +1 -1
  119. package/src/rules/structure/headingUniform.js +2 -1
  120. package/src/rules/structure/loneSubheading.js +1 -1
  121. package/src/rules/structure/moreLater.js +1 -1
  122. package/src/text.js +2 -2
  123. package/src/usage/counts.js +3 -3
  124. package/src/usage/index.js +3 -3
  125. package/src/usage/sentences.js +17 -17
@@ -1,8 +1,8 @@
1
1
  // @ts-check
2
2
  /**
3
- * 문장 역인덱스. 뜻과 파일 꼴은 파이썬 usage/sentences.py 가 소유한다. 같은 글에서 같은 바이트를 만들고 같은 순서로 답한다.
3
+ * 문장 역인덱스. 뜻과 파일 꼴은 파이썬 usage/sentences.py가 정한다. 같은 글에서 같은 바이트를 만들고 같은 순서로 답한다.
4
4
  * 토큰은 조사를 뗀 어절과 한글 어절의 글자 두 개짜리 조각, 순서는 BM25 (k1 1.5, b 0.75) 값, 값은 SCORE_SCALE 배의
5
- * 정수로 내려 견준다 (두 구현의 log 가 마지막 자리에서 다를 수 있다). 만들기는 문장 표를 바로 쓰고 postings 를 조각으로
5
+ * 정수로 내려 비교한다 (두 구현의 log가 마지막 자리에서 다를 수 있다). 만들기는 문장 표를 바로 쓰고 postings를 조각으로
6
6
  * 내렸다가 병합한다 (파이썬과 같은 조각 크기, 같은 병합 결과). 함께 쓰는 말은 조회 때 postings 앞 문장을 읽어 센다.
7
7
  */
8
8
  import { createHash } from "node:crypto";
@@ -66,7 +66,7 @@ export function defaultRoot() {
66
66
  return join(homedir(), ".cache", "hanlint", "usage");
67
67
  }
68
68
 
69
- /** 파이썬 sorted() 와 같은 코드 포인트 순. @param {string} a @param {string} b */
69
+ /** 파이썬 sorted()와 같은 코드 포인트 순. @param {string} a @param {string} b */
70
70
  export function compareCodePoints(a, b) {
71
71
  const left = [...a];
72
72
  const right = [...b];
@@ -78,7 +78,7 @@ export function compareCodePoints(a, b) {
78
78
  return left.length - right.length;
79
79
  }
80
80
 
81
- /** 두 구현이 같은 글자를 보게 한다. 뜻은 파이썬 normalized 가 소유한다. @param {string} text */
81
+ /** 두 구현이 같은 글자를 보게 한다. 뜻은 파이썬 normalized가 정한다. @param {string} text */
82
82
  export function normalized(text) {
83
83
  return text.replace(BOM, "").replace(STRAY, " ");
84
84
  }
@@ -104,7 +104,7 @@ export function indexTokens(text) {
104
104
  return found;
105
105
  }
106
106
 
107
- /** 함께 쓰는 말을 물을 낱말. 뜻은 파이썬 queryCores 가 소유한다. @param {string} text @returns {string[]} */
107
+ /** 함께 쓰는 말을 물을 단어. 뜻은 파이썬 queryCores가 정한다. @param {string} text @returns {string[]} */
108
108
  export function queryCores(text) {
109
109
  /** @type {string[]} */
110
110
  const found = [];
@@ -120,7 +120,7 @@ export function sentenceKey(text) {
120
120
  return text.replace(SPACE, " ").trim().replace(DIGITS, "0");
121
121
  }
122
122
 
123
- /** 접는 꼴의 64비트 해시 (SHA-256 앞 8바이트, little endian). 파이썬 keyHash 와 같은 값이다. @param {string} key */
123
+ /** 접는 꼴의 64비트 해시 (SHA-256 앞 8바이트, little endian). 파이썬 keyHash와 같은 값이다. @param {string} key */
124
124
  export function keyHash(key) {
125
125
  return createHash("sha256").update(key, "utf-8").digest().readBigUInt64LE(0);
126
126
  }
@@ -186,8 +186,8 @@ export function decodeVarints(data) {
186
186
  }
187
187
 
188
188
  /**
189
- * 폴더 (하위 포함) 의 txt 와 md 는 파일 하나가 문서 하나, jsonl 은 줄 하나가 문서 하나. 폴더 기준 posix 경로의 코드 포인트
190
- * 순이라 파이썬 readDocuments 와 같은 차례다. 큰 jsonl 을 통째로 들지 않게 generator 다.
189
+ * 폴더(하위 포함)의 txt와 md는 파일 하나가 문서 하나, jsonl은 줄 하나가 문서 하나. 폴더 기준 posix 경로의 코드 포인트
190
+ * 순이라 파이썬 readDocuments와 같은 차례다. 큰 jsonl을 통째로 들지 않게 generator다.
191
191
  * @param {string} folder @returns {Generator<[string, string]>}
192
192
  */
193
193
  export function* readDocuments(folder) {
@@ -213,7 +213,7 @@ export function* readDocuments(folder) {
213
213
  }
214
214
  }
215
215
 
216
- /** jsonl 을 줄 단위로 읽는다. 위키백과처럼 1 GB 가 넘는 파일을 한 번에 들지 않는다. @param {string} path @returns {Generator<[string, string]>} */
216
+ /** jsonl을 줄 단위로 읽는다. 위키백과처럼 1 GB가 넘는 파일을 한 번에 들지 않는다. @param {string} path @returns {Generator<[string, string]>} */
217
217
  function* readJsonl(path) {
218
218
  const fd = openSync(path, "r");
219
219
  const chunk = Buffer.alloc(1 << 20);
@@ -254,7 +254,7 @@ function littleEndian(values) {
254
254
  }
255
255
 
256
256
  /**
257
- * 조각 하나. 토큰 순 terms 줄과 (절대 문장 번호, 빈도) varint 덩어리. 뜻은 파이썬 writeShard 가 소유한다.
257
+ * 조각 하나. 토큰 순 terms 줄과 (절대 문장 번호, 빈도) varint 덩어리. 뜻은 파이썬 writeShard가 정한다.
258
258
  * @param {string} work @param {number} index @param {Map<string, number[]>} postingIds @param {Map<string, number[]>} postingTfs
259
259
  */
260
260
  function writeShard(work, index, postingIds, postingTfs) {
@@ -295,7 +295,7 @@ function shardLines(path) {
295
295
  }
296
296
 
297
297
  /**
298
- * 조각들을 토큰 순으로 병합해 postings.bin, terms.tsv, termOffsets.bin 을 쓴다. 뜻은 파이썬 mergeShards 가 소유한다.
298
+ * 조각들을 토큰 순으로 병합해 postings.bin, terms.tsv, termOffsets.bin을 쓴다. 뜻은 파이썬 mergeShards가 정한다.
299
299
  * @param {string} work @param {string[]} shards @param {string} target @returns {number}
300
300
  */
301
301
  function mergeShards(work, shards, target) {
@@ -462,7 +462,7 @@ function collocationStops() {
462
462
  }
463
463
 
464
464
  /**
465
- * 용언 어절의 어간. 뜻은 파이썬 predicateStem 이 소유한다. 용언이 아니면 null, 어간이 한 글자면 "".
465
+ * 용언 어절의 어간. 뜻은 파이썬 predicateStem이 정한다. 용언이 아니면 null, 어간이 한 글자면 "".
466
466
  * @param {string} core @returns {string | null}
467
467
  */
468
468
  export function predicateStem(core) {
@@ -483,7 +483,7 @@ export function predicateStem(core) {
483
483
  return [...stem].length >= 2 && HANGUL_WORD.test(stem) ? stem : "";
484
484
  }
485
485
 
486
- /** 이웃 어절을 [부류, 낱말] 로. 뜻은 파이썬 neighbourOf 가 소유한다. @param {string} core @returns {["predicate" | "noun", string] | null} */
486
+ /** 이웃 어절을 [묶음, 단어]로. 뜻은 파이썬 neighbourOf가 정한다. @param {string} core @returns {["predicate" | "noun", string] | null} */
487
487
  export function neighbourOf(core) {
488
488
  if (collocationStops().has(core) || nonNouns().has(core)) return null;
489
489
  const stem = predicateStem(core);
@@ -504,7 +504,7 @@ export class UsageIndex {
504
504
  constructor(folder) {
505
505
  this.folder = folder;
506
506
  this.meta = JSON.parse(readFileSync(join(folder, "meta.json"), "utf-8"));
507
- if (this.meta.format !== FORMAT) throw new Error(`${folder} 의 색인 format 이 ${this.meta.format} 이다. ${FORMAT} 으로 다시 만든다`);
507
+ if (this.meta.format !== FORMAT) throw new Error(`색인 format이 지금 버전과 다르다: ${folder} (색인 ${this.meta.format}, 지금 ${FORMAT}). hanlint usage build로 다시 만든다`);
508
508
  const lengthBytes = readFileSync(join(folder, "lengths.bin"));
509
509
  this.lengths = new Uint32Array(lengthBytes.buffer, lengthBytes.byteOffset, lengthBytes.length / 4);
510
510
  const documentBytes = readFileSync(join(folder, "documents.bin"));
@@ -535,7 +535,7 @@ export class UsageIndex {
535
535
  }
536
536
  }
537
537
 
538
- /** offsetsName 의 index 번째 위치에서 name 의 한 줄. @param {string} name @param {string} offsetsName @param {number} index */
538
+ /** offsetsName의 index 번째 위치에서 name의 한 줄. @param {string} name @param {string} offsetsName @param {number} index */
539
539
  lineAt(name, offsetsName, index) {
540
540
  const offset = Number(this.readAt(offsetsName, index * 8, 8).readBigUInt64LE(0));
541
541
  const size = statSync(join(this.folder, name)).size;
@@ -550,7 +550,7 @@ export class UsageIndex {
550
550
  }
551
551
 
552
552
  /**
553
- * [문서 빈도, postings 위치, 바이트 수]. 토큰 표를 코드 포인트 순으로 이분 탐색한다. 뜻은 파이썬 lookup 이 소유한다.
553
+ * [문서 빈도, postings 위치, 바이트 수]. 토큰 표를 코드 포인트 순으로 이분 탐색한다. 뜻은 파이썬 lookup이 정한다.
554
554
  * @param {string} term @returns {[number, number, number] | null}
555
555
  */
556
556
  lookup(term) {
@@ -618,7 +618,7 @@ export class UsageIndex {
618
618
  });
619
619
  }
620
620
 
621
- /** 그 낱말 바로 앞뒤에 오는 말. 뜻은 파이썬 collocations 가 소유한다. @param {string} term @returns {Collocation | null} */
621
+ /** 그 단어 바로 앞뒤에 오는 말. 뜻은 파이썬 collocations가 정한다. @param {string} term @returns {Collocation | null} */
622
622
  collocations(term) {
623
623
  const found = this.lookup(term);
624
624
  if (!found) return null;