@chaffjs/lang-ja 0.17.0 → 0.19.0

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 (129) hide show
  1. package/dist/citation.d.ts +6 -3
  2. package/dist/citation.d.ts.map +1 -1
  3. package/dist/citation.js +31 -9
  4. package/dist/citation.js.map +1 -1
  5. package/dist/lexicons.d.ts.map +1 -1
  6. package/dist/lexicons.js +4 -0
  7. package/dist/lexicons.js.map +1 -1
  8. package/dist/pos.d.ts +17 -1
  9. package/dist/pos.d.ts.map +1 -1
  10. package/dist/pos.js +69 -36
  11. package/dist/pos.js.map +1 -1
  12. package/dist/predicate-frame.d.ts +14 -0
  13. package/dist/predicate-frame.d.ts.map +1 -0
  14. package/dist/predicate-frame.js +22 -0
  15. package/dist/predicate-frame.js.map +1 -0
  16. package/dist/ra-dropped.d.ts +12 -0
  17. package/dist/ra-dropped.d.ts.map +1 -0
  18. package/dist/ra-dropped.js +18 -0
  19. package/dist/ra-dropped.js.map +1 -0
  20. package/dist/reduplication.d.ts +17 -5
  21. package/dist/reduplication.d.ts.map +1 -1
  22. package/dist/reduplication.js +85 -6
  23. package/dist/reduplication.js.map +1 -1
  24. package/dist/structure.d.ts.map +1 -1
  25. package/dist/structure.js +41 -21
  26. package/dist/structure.js.map +1 -1
  27. package/dist/well-formed.d.ts +4 -1
  28. package/dist/well-formed.d.ts.map +1 -1
  29. package/dist/well-formed.js +5 -2
  30. package/dist/well-formed.js.map +1 -1
  31. package/lexicons/absolute-word.yaml +12 -0
  32. package/lexicons/abstract-heading.yaml +11 -0
  33. package/lexicons/adversative-particle.yaml +6 -0
  34. package/lexicons/age-unit.yaml +6 -0
  35. package/lexicons/ai-tell.yaml +36 -0
  36. package/lexicons/approximate-marker.yaml +32 -0
  37. package/lexicons/birth-origin.yaml +5 -0
  38. package/lexicons/bookend-heading.yaml +33 -0
  39. package/lexicons/chat-citation-marker.yaml +11 -0
  40. package/lexicons/citation-author-joiner.yaml +14 -0
  41. package/lexicons/citation-not-author.yaml +15 -0
  42. package/lexicons/comparison-marker.yaml +7 -0
  43. package/lexicons/demonstrative-opener.yaml +19 -0
  44. package/lexicons/distributive-noun.yaml +14 -2
  45. package/lexicons/double-negative.yaml +32 -0
  46. package/lexicons/doubled-nado.yaml +15 -0
  47. package/lexicons/doubled-word.yaml +12 -0
  48. package/lexicons/duration-day.yaml +6 -0
  49. package/lexicons/duration-month.yaml +16 -0
  50. package/lexicons/duration-week.yaml +6 -0
  51. package/lexicons/duration-year.yaml +5 -0
  52. package/lexicons/elapsed-link.yaml +8 -0
  53. package/lexicons/elapsed-origin.yaml +12 -0
  54. package/lexicons/elapsed-unit.yaml +7 -0
  55. package/lexicons/enumeration-frame.yaml +32 -0
  56. package/lexicons/enumeration-joiner.yaml +15 -0
  57. package/lexicons/enumeration-negation.yaml +10 -0
  58. package/lexicons/exception-marker.yaml +11 -0
  59. package/lexicons/fact-attribute.yaml +6 -0
  60. package/lexicons/fact-label-vague.yaml +13 -0
  61. package/lexicons/fact-separator.yaml +8 -0
  62. package/lexicons/fact-value-end.yaml +16 -0
  63. package/lexicons/figure-in-text.yaml +7 -0
  64. package/lexicons/heading-form.yaml +64 -0
  65. package/lexicons/heading-number-label.yaml +30 -0
  66. package/lexicons/idiom-misuse.yaml +69 -0
  67. package/lexicons/item-number.yaml +38 -0
  68. package/lexicons/known-misspelling.yaml +72 -0
  69. package/lexicons/label-affix.yaml +9 -0
  70. package/lexicons/light-verb.yaml +10 -0
  71. package/lexicons/long-vowel-distinct.yaml +25 -0
  72. package/lexicons/long-vowel-drop-after.yaml +25 -0
  73. package/lexicons/misconversion.yaml +117 -0
  74. package/lexicons/month-name.yaml +29 -0
  75. package/lexicons/name-note.yaml +5 -1
  76. package/lexicons/nominalization-event-noun.yaml +13 -0
  77. package/lexicons/nominalization-light-verb.yaml +10 -0
  78. package/lexicons/numeral-counter.yaml +42 -0
  79. package/lexicons/numeral-kanji.yaml +20 -0
  80. package/lexicons/orthographic-variant-distinct.yaml +20 -0
  81. package/lexicons/paper-section-heading.yaml +18 -0
  82. package/lexicons/passive-predicate-frame.yaml +13 -0
  83. package/lexicons/person-form.yaml +23 -0
  84. package/lexicons/person-word.yaml +20 -0
  85. package/lexicons/placeholder-word.yaml +19 -0
  86. package/lexicons/pro-con-heading.yaml +19 -0
  87. package/lexicons/ra-dropped-verb.yaml +7 -0
  88. package/lexicons/redundant-expression.yaml +67 -0
  89. package/lexicons/reference-aside.yaml +18 -0
  90. package/lexicons/reference-list-heading.yaml +13 -0
  91. package/lexicons/reference-topic-link.yaml +14 -0
  92. package/lexicons/reference-topic-vague.yaml +16 -0
  93. package/lexicons/relative-after.yaml +5 -0
  94. package/lexicons/relative-before.yaml +5 -0
  95. package/lexicons/relative-link.yaml +8 -0
  96. package/lexicons/relative-year-unit.yaml +5 -0
  97. package/lexicons/requirement-either.yaml +13 -0
  98. package/lexicons/requirement-loophole.yaml +13 -0
  99. package/lexicons/requirement-marker.yaml +15 -0
  100. package/lexicons/requirement-modal-jis-z8301-2019.yaml +14 -0
  101. package/lexicons/requirement-not-marker.yaml +8 -0
  102. package/lexicons/requirement-open-end.yaml +6 -0
  103. package/lexicons/restating-opener.yaml +18 -0
  104. package/lexicons/sasete-itadaku.yaml +11 -0
  105. package/lexicons/summary-heading.yaml +11 -0
  106. package/lexicons/teki-suffix.yaml +6 -0
  107. package/lexicons/ten-mark.yaml +6 -0
  108. package/lexicons/translationese.yaml +38 -0
  109. package/lexicons/unit-data.yaml +28 -0
  110. package/lexicons/unit-length.yaml +24 -0
  111. package/lexicons/unit-mass.yaml +22 -0
  112. package/lexicons/unit-time.yaml +24 -0
  113. package/lexicons/unit-volume.yaml +16 -0
  114. package/lexicons/unnumbered-heading.yaml +28 -0
  115. package/lexicons/vague-clause-pointer.yaml +14 -0
  116. package/lexicons/vague-figure-pointer.yaml +23 -0
  117. package/lexicons/vague-link-text.yaml +23 -0
  118. package/lexicons/vague-word.yaml +32 -0
  119. package/lexicons/value-unit.yaml +61 -0
  120. package/lexicons/year-reference.yaml +19 -0
  121. package/package.json +1 -1
  122. package/src/citation.ts +35 -10
  123. package/src/lexicons.ts +4 -0
  124. package/src/pos.ts +78 -29
  125. package/src/predicate-frame.ts +28 -0
  126. package/src/ra-dropped.ts +29 -0
  127. package/src/reduplication.ts +119 -8
  128. package/src/structure.ts +42 -19
  129. package/src/well-formed.ts +5 -2
@@ -0,0 +1,16 @@
1
+ # 話題にならない語(reference-topic-missing)。どの節にも当てはまる。
2
+ id: reference-topic-vague
3
+ language: ja
4
+ entries:
5
+ - pattern: "内容"
6
+ - pattern: "詳細"
7
+ - pattern: "事項"
8
+ - pattern: "規定"
9
+ - pattern: "方法"
10
+ - pattern: "手順"
11
+ - pattern: "概要"
12
+ - pattern: "例"
13
+ - pattern: "説明"
14
+ - pattern: "議論"
15
+ - pattern: "結果"
16
+ - pattern: "点"
@@ -0,0 +1,5 @@
1
+ # 期間のすぐ後ろに書いて、基準より後を指す語(relative-date-mismatch)。「3日後の10月5日」。
2
+ id: relative-after
3
+ language: ja
4
+ entries:
5
+ - pattern: "後"
@@ -0,0 +1,5 @@
1
+ # 期間のすぐ後ろに書いて、基準より前を指す語(relative-date-mismatch)。「3日前の10月2日」。
2
+ id: relative-before
3
+ language: ja
4
+ entries:
5
+ - pattern: "前"
@@ -0,0 +1,8 @@
1
+ # 相対の期間と日付のあいだに書いてよい語(relative-date-mismatch)。空白と区切りの記号(、()は書かなくてもよい。
2
+ id: relative-link
3
+ language: ja
4
+ entries:
5
+ - pattern: "の"
6
+ - pattern: "に"
7
+ - pattern: "となる"
8
+ - pattern: "である"
@@ -0,0 +1,5 @@
1
+ # 向きの語(後、前)が付くときだけ期間になる年の単位(relative-date-mismatch)。「1年前の2025年5月1日」。年だけでは年数か期間か決まらないので、duration-year には入れない。
2
+ id: relative-year-unit
3
+ language: ja
4
+ entries:
5
+ - pattern: "年"
@@ -0,0 +1,13 @@
1
+ # 「及び」と「又は」を重ねた書き方(Berry ほか 2003 の and/or)。両方なのか、片方でよいのかを読み手が決められない。
2
+ id: requirement-either
3
+ language: ja
4
+ entries:
5
+ - pattern: 及び/又は
6
+ - pattern: 及び/又は
7
+ - pattern: 及び又は
8
+ - pattern: および/または
9
+ - pattern: および/または
10
+ - pattern: およびまたは
11
+ - pattern: かつ/または
12
+ - pattern: かつ/または
13
+ - pattern: かつまたは
@@ -0,0 +1,13 @@
1
+ # 要求に抜け道を開ける言い方(Femmer ほか 2017 の loophole、ISO/IEC/IEEE 29148 の避ける語)。
2
+ # どこまでしたら満たしたことになるのかを、読み手が決められない。
3
+ id: requirement-loophole
4
+ language: ja
5
+ entries:
6
+ - pattern: 可能な限り
7
+ - pattern: できる限り
8
+ - pattern: 可能なかぎり
9
+ - pattern: できるかぎり
10
+ - pattern: できるだけ
11
+ - pattern: なるべく
12
+ - pattern: 必要に応じて
13
+ - pattern: 場合によっては
@@ -0,0 +1,15 @@
1
+ # 要求の文の目印。requirement-smell は、これで終わる文だけを要求として見る。
2
+ # 日本語の文は述語が終わりに来るので、目印はどれも文の終わりにあるときだけ当たる(position: after)。
3
+ # 文の途中の「回避されてはならないものとされる諸手段をいいます」は語の定義で、要求ではない。
4
+ id: requirement-marker
5
+ language: ja
6
+ entries:
7
+ - { pattern: なければならない, position: after }
8
+ - { pattern: なければなりません, position: after }
9
+ - { pattern: てはならない, position: after }
10
+ - { pattern: てはなりません, position: after }
11
+ - { pattern: ものとする, position: after }
12
+ - { pattern: ものとします, position: after }
13
+ - { pattern: 必要がある, position: after }
14
+ - { pattern: 必要があります, position: after }
15
+ - { pattern: こと, position: after }
@@ -0,0 +1,14 @@
1
+ # JIS Z 8301:2019 が規定の文末に使わない形と、代わりに使う形(instead_of)。requirement-modal の standard: jis-z8301-2019 が読む。
2
+ # 7.3(推奨事項): 文末の「…すべきである」「…すべきでない」は用いない。推奨は「…することが望ましい」、推奨しないは「…しないほうがよい」。
3
+ # 「べきではない」は「べきでない」に「は」を入れた同じ形。
4
+ # 7.4(許容事項)・7.5(可能性・能力事項): 文末の「…できる」「…できない」は用いない。許容は「…してもよい」、可能性は「…可能である」。
5
+ # 7.5 は、能力を示す「できる」を文の途中で使うのは認めるので、文の終わりだけを見る(position: after)。
6
+ # 出典は日本規格協会「JIS 原案作成のための手引」資料 7「JIS Z 8301:2019 の主な改正点」と、同書 Q&A 6-15 の修正例。
7
+ id: requirement-modal-jis-z8301-2019
8
+ language: ja
9
+ entries:
10
+ - { pattern: べきである, position: after, instead_of: することが望ましい }
11
+ - { pattern: べきでない, position: after, instead_of: しないほうがよい }
12
+ - { pattern: べきではない, position: after, instead_of: しないほうがよい }
13
+ - { pattern: できる, position: after, instead_of: してもよい(許容)、可能である(可能性) }
14
+ - { pattern: できない, position: after, instead_of: しなくてもよい(許容)、可能性がない(可能性) }
@@ -0,0 +1,8 @@
1
+ # 要求の目印(requirement-marker)に見えて、要求ではない文の終わり。
2
+ # 「〜のこと。」は語の説明(「サーバに保存すること。」は要求、「…を防ぐファイアウォールのこと。」は用語集の説明)。
3
+ # position: after は、文の終わりにあるときだけ当たる。
4
+ id: requirement-not-marker
5
+ language: ja
6
+ entries:
7
+ - pattern: のこと
8
+ position: after
@@ -0,0 +1,6 @@
1
+ # 列挙を閉じない語(Femmer ほか 2017 の open-ended terms)。要求の文にあると、ほかに何が含まれるのかを読み手が決められない。
2
+ id: requirement-open-end
3
+ language: ja
4
+ entries:
5
+ - pattern: 等
6
+ - pattern: など
@@ -0,0 +1,18 @@
1
+ # 段落の頭に置いて、前に書いたことを言い直すと告げる語。これで始まる段落が前の段落の語をほとんど繰り返すなら、言い直しだけの段落と読む。
2
+ # 読点まで書いたものは、読点が無いと別の言い方になる語(このようにして作る、以上のように定める)。
3
+ id: restating-opener
4
+ language: ja
5
+ entries:
6
+ - pattern: つまり
7
+ - pattern: 要するに
8
+ - pattern: 言い換えれば
9
+ - pattern: 言い換えると
10
+ - pattern: 換言すれば
11
+ - pattern: すなわち
12
+ - pattern: このように、
13
+ - pattern: 以上のように、
14
+ - pattern: まとめると
15
+ - pattern: 総じて
16
+ - pattern: 結局
17
+ - pattern: 繰り返しになりますが
18
+ - pattern: 改めて
@@ -1,7 +1,18 @@
1
1
  # 「させていただく」。1 度なら丁寧だが、重なると誰の判断なのかが消える。
2
+ # 「いただける」は可能の形(させていただけますか・させていただけない)で、別の語に解析されるので別に書く。
3
+ # 「せていただく」は五段動詞の形(読ませていただく・休ませていただく)。「させていただく」と重なっても終わる位置で一回に数える。
2
4
  id: sasete-itadaku
3
5
  language: ja
4
6
  entries:
5
7
  - pattern: させていただく
6
8
  - pattern: させて頂く
7
9
  - pattern: させて戴く
10
+ - pattern: させていただける
11
+ - pattern: させて頂ける
12
+ - pattern: させて戴ける
13
+ - pattern: せていただく
14
+ - pattern: せて頂く
15
+ - pattern: せて戴く
16
+ - pattern: せていただける
17
+ - pattern: せて頂ける
18
+ - pattern: せて戴ける
@@ -0,0 +1,11 @@
1
+ # 要約の節の見出し(summary-fact-mismatch)。この節の値を本文の同じ名前の値と比べる。見出しの頭の番号は除いて、まるごと同じときだけ。
2
+ id: summary-heading
3
+ language: ja
4
+ entries:
5
+ - pattern: 概要
6
+ - pattern: 要約
7
+ - pattern: 要旨
8
+ - pattern: 要点
9
+ - pattern: まとめ
10
+ - pattern: サマリー
11
+ - pattern: 概略
@@ -0,0 +1,6 @@
1
+ # 名詞に付いて形容動詞を作る接尾の「的」(効果的、具体的)。teki-overuse が一文の中の数を数える。
2
+ # 語として読むので、「目的」「的確」のように「的」で一語になったものは数えない。
3
+ id: teki-suffix
4
+ language: ja
5
+ entries:
6
+ - pattern: 的
@@ -0,0 +1,6 @@
1
+ # 読点。max-ten が一文の中の数を数える。カンマ(,)で書く文書もあるので両方。
2
+ id: ten-mark
3
+ language: ja
4
+ entries:
5
+ - pattern: 、
6
+ - pattern: ,
@@ -0,0 +1,38 @@
1
+ # 翻訳調。英語の構文をそのまま写した言い回し(enable X to → 〜を可能にする、play an important role in → 重要な役割を果たす)。
2
+ # translationese-density が文書の長さあたりの数で読む。一つ一つは誤りではないので、重なったときだけ言う。
3
+ # 人の書いた技術記事でもふつうに使う言い回し(〜を提供する、〜に焦点を当てる、〜することができる)は載せない。
4
+ # 一つの文に二つの語が当たると二つと数えるので、ほかの語を含む長い形(することを可能にする)は載せない。
5
+ # 動詞は原形で書けば活用した形(可能にします、果たしている)にも当たる。rewrite は日本語として素直な言い方の例。
6
+ id: translationese
7
+ language: ja
8
+ entries:
9
+ - pattern: を可能にする
10
+ rewrite: 〜ができる、〜ができるようになる
11
+ - pattern: 重要な役割を果たす
12
+ rewrite: 大きく関わる、〜に欠かせない
13
+ - pattern: されることができる
14
+ rewrite: 〜できる、〜される
15
+ - pattern: を確実にする
16
+ rewrite: 必ず〜する、〜を確かめる
17
+ - pattern: であることに注意してください
18
+ rewrite: 〜です(注意が要る理由を書く)
19
+ - pattern: することを忘れないでください
20
+ rewrite: 必ず〜してください
21
+ - pattern: ように設計されている
22
+ rewrite: 〜のために作られている、〜できる
23
+ - pattern: という事実
24
+ rewrite: こと
25
+ - pattern: アクセスを持つ
26
+ rewrite: 使える、見られる
27
+ - pattern: という特徴を持つ
28
+ rewrite: 〜が特徴だ
29
+ - pattern: という利点を持つ
30
+ rewrite: 〜という利点がある
31
+ - pattern: あなたは
32
+ rewrite: 主語を省く、または「読者は」「利用者は」
33
+ - pattern: あなたの
34
+ rewrite: 主語を省く、または「自分の」
35
+ - pattern: 彼女は
36
+ rewrite: 名前で呼ぶ、または主語を省く
37
+ - pattern: 彼らは
38
+ rewrite: 名前で呼ぶ、または主語を省く
@@ -0,0 +1,28 @@
1
+ # データの量(基準はバイト。KB から TB は 1000 倍と 1024 倍の両方)の単位(unit-mismatch)。weight は基準の単位への倍率。同じ単位を二度書けば倍率が二つで、どちらで合ってもよい。
2
+ id: unit-data
3
+ language: ja
4
+ entries:
5
+ - pattern: "KB"
6
+ weight: 1000
7
+ - pattern: "KB"
8
+ weight: 1024
9
+ - pattern: "MB"
10
+ weight: 1000000
11
+ - pattern: "MB"
12
+ weight: 1048576
13
+ - pattern: "GB"
14
+ weight: 1000000000
15
+ - pattern: "GB"
16
+ weight: 1073741824
17
+ - pattern: "TB"
18
+ weight: 1000000000000
19
+ - pattern: "TB"
20
+ weight: 1099511627776
21
+ - pattern: "KiB"
22
+ weight: 1024
23
+ - pattern: "MiB"
24
+ weight: 1048576
25
+ - pattern: "GiB"
26
+ weight: 1073741824
27
+ - pattern: "TiB"
28
+ weight: 1099511627776
@@ -0,0 +1,24 @@
1
+ # 長さ(基準はメートル)の単位(unit-mismatch)。weight は基準の単位への倍率。同じ単位を二度書けば倍率が二つで、どちらで合ってもよい。
2
+ id: unit-length
3
+ language: ja
4
+ entries:
5
+ - pattern: "km"
6
+ weight: 1000
7
+ - pattern: "m"
8
+ weight: 1
9
+ - pattern: "cm"
10
+ weight: 0.01
11
+ - pattern: "mm"
12
+ weight: 0.001
13
+ - pattern: "キロメートル"
14
+ weight: 1000
15
+ - pattern: "メートル"
16
+ weight: 1
17
+ - pattern: "センチメートル"
18
+ weight: 0.01
19
+ - pattern: "センチ"
20
+ weight: 0.01
21
+ - pattern: "ミリメートル"
22
+ weight: 0.001
23
+ - pattern: "ミリ"
24
+ weight: 0.001
@@ -0,0 +1,22 @@
1
+ # 重さ(基準はグラム)の単位(unit-mismatch)。weight は基準の単位への倍率。同じ単位を二度書けば倍率が二つで、どちらで合ってもよい。
2
+ id: unit-mass
3
+ language: ja
4
+ entries:
5
+ - pattern: "t"
6
+ weight: 1000000
7
+ - pattern: "kg"
8
+ weight: 1000
9
+ - pattern: "g"
10
+ weight: 1
11
+ - pattern: "mg"
12
+ weight: 0.001
13
+ - pattern: "トン"
14
+ weight: 1000000
15
+ - pattern: "キログラム"
16
+ weight: 1000
17
+ - pattern: "キロ"
18
+ weight: 1000
19
+ - pattern: "グラム"
20
+ weight: 1
21
+ - pattern: "ミリグラム"
22
+ weight: 0.001
@@ -0,0 +1,24 @@
1
+ # 時間(基準は秒)の単位(unit-mismatch)。weight は基準の単位への倍率。同じ単位を二度書けば倍率が二つで、どちらで合ってもよい。
2
+ id: unit-time
3
+ language: ja
4
+ entries:
5
+ - pattern: "時間"
6
+ weight: 3600
7
+ - pattern: "分間"
8
+ weight: 60
9
+ - pattern: "分"
10
+ weight: 60
11
+ - pattern: "秒間"
12
+ weight: 1
13
+ - pattern: "秒"
14
+ weight: 1
15
+ - pattern: "ミリ秒"
16
+ weight: 0.001
17
+ - pattern: "h"
18
+ weight: 3600
19
+ - pattern: "min"
20
+ weight: 60
21
+ - pattern: "s"
22
+ weight: 1
23
+ - pattern: "ms"
24
+ weight: 0.001
@@ -0,0 +1,16 @@
1
+ # 体積(基準はリットル)の単位(unit-mismatch)。weight は基準の単位への倍率。同じ単位を二度書けば倍率が二つで、どちらで合ってもよい。
2
+ id: unit-volume
3
+ language: ja
4
+ entries:
5
+ - pattern: "L"
6
+ weight: 1
7
+ - pattern: "l"
8
+ weight: 1
9
+ - pattern: "mL"
10
+ weight: 0.001
11
+ - pattern: "ml"
12
+ weight: 0.001
13
+ - pattern: "リットル"
14
+ weight: 1
15
+ - pattern: "ミリリットル"
16
+ weight: 0.001
@@ -0,0 +1,28 @@
1
+ # 本文の前後に置き、番号を付けないのがふつうの見出し(目次、参考文献)。heading-numbering-mix は兄弟の数に入れない。
2
+ # 見出しの言葉全体がこの語か、この語に区切り(「付録: 用語」「付録 A」)が続くときだけ。本文の見出しになりうる語(概要、まとめ、はじめに)は置かない。
3
+ id: unnumbered-heading
4
+ language: ja
5
+ entries:
6
+ - pattern: 目次
7
+ - pattern: 要旨
8
+ - pattern: 要約
9
+ - pattern: 参考文献
10
+ - pattern: 引用文献
11
+ - pattern: 文献
12
+ - pattern: 謝辞
13
+ - pattern: 付録
14
+ - pattern: 附則
15
+ - pattern: 別表
16
+ - pattern: Appendix
17
+ - pattern: 索引
18
+ - pattern: 注
19
+ - pattern: 脚注
20
+ - pattern: 著者紹介
21
+ - pattern: 変更履歴
22
+ - pattern: 更新履歴
23
+ - pattern: 改訂履歴
24
+ - pattern: はしがき
25
+ - pattern: あとがき
26
+ - pattern: 序文
27
+ - pattern: References
28
+ - pattern: Abstract
@@ -0,0 +1,14 @@
1
+ # 箇条を、番号ではなく置き場所で指す言い方(JIS Z 8301:2019 10.6 が避ける「以下の箇条」)。
2
+ # instead_of は、メッセージで言う種類。文書が条か章に番号を付けているとき(構造の木に番号付きの条か章があるとき)だけ見る。
3
+ id: vague-clause-pointer
4
+ language: ja
5
+ entries:
6
+ - { pattern: 以下の箇条, instead_of: 箇条 }
7
+ - { pattern: 以上の箇条, instead_of: 箇条 }
8
+ - { pattern: 上記の箇条, instead_of: 箇条 }
9
+ - { pattern: 下記の箇条, instead_of: 箇条 }
10
+ - { pattern: 上の箇条, instead_of: 箇条 }
11
+ - { pattern: 下の箇条, instead_of: 箇条 }
12
+ - { pattern: 前記の箇条, instead_of: 箇条 }
13
+ - { pattern: 前述の箇条, instead_of: 箇条 }
14
+ - { pattern: 後述の箇条, instead_of: 箇条 }
@@ -0,0 +1,23 @@
1
+ # 図や表を、番号ではなく置き場所で指す言い方(JIS Z 8301:2019 10.6 が避ける「上記の図」)。
2
+ # instead_of は、指している種類。figure-label の種類(図、表)と同じ名前で書く。文書がその種類に番号を付けているときだけ見る。
3
+ id: vague-figure-pointer
4
+ language: ja
5
+ entries:
6
+ - { pattern: 上記の図, instead_of: 図 }
7
+ - { pattern: 下記の図, instead_of: 図 }
8
+ - { pattern: 上の図, instead_of: 図 }
9
+ - { pattern: 下の図, instead_of: 図 }
10
+ - { pattern: 以下の図, instead_of: 図 }
11
+ - { pattern: 以上の図, instead_of: 図 }
12
+ - { pattern: 前記の図, instead_of: 図 }
13
+ - { pattern: 前述の図, instead_of: 図 }
14
+ - { pattern: 後述の図, instead_of: 図 }
15
+ - { pattern: 上記の表, instead_of: 表 }
16
+ - { pattern: 下記の表, instead_of: 表 }
17
+ - { pattern: 上の表, instead_of: 表 }
18
+ - { pattern: 下の表, instead_of: 表 }
19
+ - { pattern: 以下の表, instead_of: 表 }
20
+ - { pattern: 以上の表, instead_of: 表 }
21
+ - { pattern: 前記の表, instead_of: 表 }
22
+ - { pattern: 前述の表, instead_of: 表 }
23
+ - { pattern: 後述の表, instead_of: 表 }
@@ -0,0 +1,23 @@
1
+ # リンクの言葉がこれだけのとき、行き先を言っていない。vague-link-text が読む。
2
+ # 言葉全体がこの語のときだけ当たる(「料金表はこちら」は行き先を言っているので当たらない)。強調の印・鉤括弧・終わりの句読点は外して比べる。
3
+ id: vague-link-text
4
+ language: ja
5
+ entries:
6
+ - pattern: こちら
7
+ - pattern: ここ
8
+ - pattern: コチラ
9
+ - pattern: こちらから
10
+ - pattern: ここから
11
+ - pattern: こちらをクリック
12
+ - pattern: ここをクリック
13
+ - pattern: こちらをご覧ください
14
+ - pattern: こちらを参照
15
+ - pattern: こちらのページ
16
+ - pattern: このページ
17
+ - pattern: このリンク
18
+ - pattern: リンク
19
+ - pattern: クリック
20
+ - pattern: 詳しくはこちら
21
+ - pattern: 詳細はこちら
22
+ - pattern: もっと見る
23
+ - pattern: 続きを読む
@@ -0,0 +1,32 @@
1
+ # あいまいな語。どこまで・いつまで・何をしたら済むのかを、読み手が決めることになる語。vague-word-density が文書の長さに対して数える。
2
+ # 一つ二つは普通の言い方。重なると、文書の言っていることの多くを読み手が決めることになる。
3
+ # 要求の文の中の「可能な限り」「必要に応じて」は requirement-smell も見る(こちらは文書全体の密度)。
4
+ id: vague-word
5
+ language: ja
6
+ entries:
7
+ - pattern: 適宜
8
+ - pattern: 適切に
9
+ - pattern: 適切な
10
+ - pattern: 適正に
11
+ - pattern: 適正な
12
+ - pattern: なるべく
13
+ - pattern: 極力
14
+ - pattern: 必要に応じて
15
+ - pattern: 状況に応じて
16
+ - pattern: 場合によっては
17
+ - pattern: 可能な限り
18
+ - pattern: できる限り
19
+ - pattern: できるだけ
20
+ - pattern: ある程度
21
+ - pattern: 一定の
22
+ - pattern: 相当の
23
+ - pattern: 若干
24
+ - pattern: 随時
25
+ - pattern: 適時
26
+ - pattern: しかるべき
27
+ - pattern: 然るべき
28
+ - pattern: 柔軟に
29
+ - pattern: 前向きに
30
+ - pattern: 鋭意
31
+ - pattern: 早急に
32
+ - pattern: 早めに
@@ -0,0 +1,61 @@
1
+ # 数のすぐ後ろに付く単位と助数詞。number-without-unit が、数の後ろの語を単位と読むかを決める。
2
+ # ここに無い語が続く数(「3件目」「2位」)は、値として数えない。measure-unit・percent-unit・currency-code の語も単位と読む。
3
+ id: value-unit
4
+ language: ja
5
+ entries:
6
+ - pattern: 円
7
+ - pattern: 万円
8
+ - pattern: 千円
9
+ - pattern: 億円
10
+ - pattern: 円/月
11
+ - pattern: ドル
12
+ - pattern: ユーロ
13
+ - pattern: 人
14
+ - pattern: 名
15
+ - pattern: 件
16
+ - pattern: 個
17
+ - pattern: 回
18
+ - pattern: 式
19
+ - pattern: 台
20
+ - pattern: 枚
21
+ - pattern: 本
22
+ - pattern: 冊
23
+ - pattern: 部
24
+ - pattern: 社
25
+ - pattern: 店
26
+ - pattern: 校
27
+ - pattern: 点
28
+ - pattern: 倍
29
+ - pattern: 割
30
+ - pattern: 度
31
+ - pattern: 階
32
+ - pattern: 歳
33
+ - pattern: 年
34
+ - pattern: か月
35
+ - pattern: ヶ月
36
+ - pattern: カ月
37
+ - pattern: 週
38
+ - pattern: 週間
39
+ - pattern: 日
40
+ - pattern: 日間
41
+ - pattern: 時間
42
+ - pattern: 分
43
+ - pattern: 秒
44
+ - pattern: 字
45
+ - pattern: 文字
46
+ - pattern: 行
47
+ - pattern: ページ
48
+ - pattern: 坪
49
+ - pattern: 畳
50
+ - pattern: 泊
51
+ - pattern: kg
52
+ - pattern: g
53
+ - pattern: km
54
+ - pattern: m
55
+ - pattern: cm
56
+ - pattern: mm
57
+ - pattern: GB
58
+ - pattern: MB
59
+ - pattern: KB
60
+ - pattern: TB
61
+ - pattern: px
@@ -0,0 +1,19 @@
1
+ # 日付の直前で、年を語で言う言葉。date-without-year は、これが前にある年の無い日付を指さない。
2
+ # 「同年12月28日」は年が決まっていて、「毎年4月1日」「その年の12月31日」はどの年にも当てはまる日付。
3
+ id: year-reference
4
+ language: ja
5
+ entries:
6
+ - pattern: 同年
7
+ - pattern: 翌年
8
+ - pattern: 前年
9
+ - pattern: 昨年
10
+ - pattern: 本年
11
+ - pattern: 今年
12
+ - pattern: 来年
13
+ - pattern: 当年
14
+ - pattern: 毎年
15
+ - pattern: 例年
16
+ - pattern: 各年
17
+ - pattern: その年
18
+ - pattern: 年度の
19
+ - pattern: 年の
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-ja",
3
- "version": "0.17.0",
3
+ "version": "0.19.0",
4
4
  "description": "Japanese language adapter for chaff",
5
5
  "license": "MIT",
6
6
  "author": "isamu",
package/src/citation.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Lexicon } from "chaffjs/plugin";
1
+ import type { Lexicon, NamedDocument } from "chaffjs/plugin";
2
2
 
3
3
  // 他の文書を指す参照。「民法第709条」の第709条はこの文書の条ではない。どの語が文書の名前を作るかは語彙表が持つ。
4
4
 
@@ -31,8 +31,8 @@ const TITLE_CHAR = /[\p{Script=Han}\p{Script=Katakana}\p{Script=Hiragana}ー・A
31
31
  /** 名前は長くても数十字。後ろ向きに読む長さを抑え、長い行で遅くならないようにする。 */
32
32
  const MAX_NAME_LENGTH = 30;
33
33
 
34
- /** 名前の後ろの括弧書きが収まる長さ。後ろ向きに読む長さを抑える。 */
35
- const MAX_NOTE_LENGTH = 100;
34
+ /** 名前の後ろの括弧書きが収まる長さ。name-note の最も長い形(略称・公布の番号・「以下…という。」)が収まり、後ろ向きに読む長さを抑える。 */
35
+ const MAX_NOTE_LENGTH = 130;
36
36
 
37
37
  const nameBefore = (text: string, at: number, char: RegExp): string => {
38
38
  let start = at;
@@ -51,15 +51,40 @@ const beforeJoiner = (text: string, at: number, joiners: readonly string[]): num
51
51
  return joiner === undefined ? at : at - joiner.length;
52
52
  };
53
53
 
54
+ /** 名前が種類の語で終わり、種類の語より長い(「民法」。「契約」だけではどの文書か決まらない)。 */
55
+ const endsWithKind = (name: string, kinds: readonly string[]): boolean => {
56
+ const kind = kinds.find((candidate) => name.endsWith(candidate));
57
+ return kind !== undefined && name.length > kind.length;
58
+ };
59
+
54
60
  /**
55
- * reference の直前に書かれた文書名。「民法第709条」「民法の第709条」なら「民法」。この文書の条を指すなら undefined。
56
- * 名前が種類の語だけ(「契約第3条」)のときも、どの文書か決まらないので undefined にする。
61
+ * reference の直前に書かれた文書名。「民法第709条」「民法の第709条」なら「民法」、「この規則の別表」「本規約第3条」ならこの文書(self)。
62
+ * 名前が種類の語だけ(「契約第3条」)のときは、どの文書か決まらないので undefined にする。
63
+ * 公布の番号を添えた名前(「…に関する基準(昭和五十八年厚生省告示第十四号)第二条」)は、種類の語が無くても文書の名前。
57
64
  */
58
- export const citedDocument = (text: string, reference: number, vocabulary: CitationVocabulary): string | undefined => {
59
- const at = beforeNote(text, beforeJoiner(text, reference, vocabulary.joiners), vocabulary.notes);
65
+ export const namedDocument = (text: string, reference: number, vocabulary: CitationVocabulary): NamedDocument | undefined => {
66
+ const afterName = beforeJoiner(text, reference, vocabulary.joiners);
67
+ const at = beforeNote(text, afterName, vocabulary.notes);
60
68
  const plain = nameBefore(text, at, NAME_CHAR);
61
69
  const name = vocabulary.kanaTitleKinds.includes(plain) ? nameBefore(text, at, TITLE_CHAR) : plain;
62
- const kind = vocabulary.kinds.find((candidate) => name.endsWith(candidate));
63
- if (kind === undefined || name.length === kind.length) return undefined;
64
- return vocabulary.selfPrefixes.some((prefix) => name.startsWith(prefix)) ? undefined : name;
70
+ const self = namesThisDocument(text, at - name.length, name, vocabulary.selfPrefixes);
71
+ if (self && vocabulary.kinds.some((kind) => name.endsWith(kind))) return { name, self };
72
+ const numbered = at !== afterName && name !== "";
73
+ if (!numbered && !endsWithKind(name, vocabulary.kinds)) return undefined;
74
+ return { name, self };
75
+ };
76
+
77
+ /** reference の直前に書かれた他の文書の名前。この文書を指すか、名前が無ければ undefined。 */
78
+ export const citedDocument = (text: string, reference: number, vocabulary: CitationVocabulary): string | undefined => {
79
+ const named = namedDocument(text, reference, vocabulary);
80
+ return named === undefined || named.self ? undefined : named.name;
81
+ };
82
+
83
+ /** 自分を指す頭の語の長さの上限(この・本・当)。後ろ向きに読む長さを抑える。 */
84
+ const MAX_PREFIX_LENGTH = 4;
85
+
86
+ /** 名前が自分を指す頭の語で始まるか、そのすぐ前に仮名の頭の語がある(「この基準(…号)第9条」の「この」)。 */
87
+ const namesThisDocument = (text: string, nameStart: number, name: string, selfPrefixes: readonly string[]): boolean => {
88
+ const lead = text.slice(Math.max(0, nameStart - MAX_PREFIX_LENGTH), nameStart);
89
+ return selfPrefixes.some((prefix) => name.startsWith(prefix) || lead.endsWith(prefix));
65
90
  };
package/src/lexicons.ts CHANGED
@@ -14,11 +14,15 @@ const toEntry = (raw: unknown): LexiconEntry | undefined => {
14
14
  if (!isRecord(raw) || typeof raw["pattern"] !== "string") return undefined;
15
15
  const weight = raw["weight"];
16
16
  const instead = raw["instead_of"];
17
+ const rewrite = raw["rewrite"];
18
+ const group = raw["group"];
17
19
  return {
18
20
  pattern: raw["pattern"],
19
21
  weight: typeof weight === "number" ? weight : undefined,
20
22
  instead_of: typeof instead === "string" ? instead : undefined,
21
23
  position: POSITIONS.find((position) => position === raw["position"]),
24
+ rewrite: typeof rewrite === "string" ? rewrite : undefined,
25
+ ...(typeof group === "string" ? { group } : {}),
22
26
  };
23
27
  };
24
28