@chaffjs/lang-ja 0.34.0 → 0.35.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 (62) hide show
  1. package/dist/english-list-line.d.ts +6 -0
  2. package/dist/english-list-line.d.ts.map +1 -0
  3. package/dist/english-list-line.js +91 -0
  4. package/dist/english-list-line.js.map +1 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +10 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/list-line.d.ts +12 -0
  9. package/dist/list-line.d.ts.map +1 -0
  10. package/dist/list-line.js +82 -0
  11. package/dist/list-line.js.map +1 -0
  12. package/lexicons/addressee-suffix.yaml +8 -0
  13. package/lexicons/any-year-marker.yaml +6 -0
  14. package/lexicons/breakdown-partial-word.yaml +7 -0
  15. package/lexicons/common-acronym.yaml +9 -0
  16. package/lexicons/company-form-latin.yaml +20 -0
  17. package/lexicons/comparative-baseline.yaml +21 -1
  18. package/lexicons/compound-slip-ignored.yaml +13 -0
  19. package/lexicons/count-title.yaml +13 -0
  20. package/lexicons/date-stamp-label.yaml +1 -0
  21. package/lexicons/definition-alternative.yaml +6 -0
  22. package/lexicons/duration-per-period.yaml +17 -0
  23. package/lexicons/figure-scale-joiner.yaml +8 -0
  24. package/lexicons/figure-scale-word.yaml +11 -0
  25. package/lexicons/headline-ending.yaml +9 -0
  26. package/lexicons/known-misspelling.yaml +23 -0
  27. package/lexicons/latin-bound-suffix.yaml +10 -0
  28. package/lexicons/latin-joiner.yaml +10 -0
  29. package/lexicons/list-note-lead.yaml +8 -0
  30. package/lexicons/literal-quote-cue.yaml +22 -0
  31. package/lexicons/memo-header-label.yaml +8 -0
  32. package/lexicons/mention-cue.yaml +11 -0
  33. package/lexicons/misconversion.yaml +13 -0
  34. package/lexicons/nado-closed-list.yaml +4 -0
  35. package/lexicons/nakaguro-word.yaml +13 -0
  36. package/lexicons/named-deadline.yaml +34 -0
  37. package/lexicons/negation-word.yaml +1 -1
  38. package/lexicons/notice-phrase.yaml +15 -0
  39. package/lexicons/organisation-form.yaml +13 -11
  40. package/lexicons/orthographic-variant-conjunction.yaml +13 -0
  41. package/lexicons/orthographic-variant-distinct.yaml +3 -0
  42. package/lexicons/orthographic-variant-idiom.yaml +14 -0
  43. package/lexicons/orthographic-variant-whole-word.yaml +17 -0
  44. package/lexicons/particle-run-break.yaml +23 -0
  45. package/lexicons/person-other-sense.yaml +6 -0
  46. package/lexicons/request-condition.yaml +4 -1
  47. package/lexicons/request-owner.yaml +3 -0
  48. package/lexicons/requirement-open-condition.yaml +9 -0
  49. package/lexicons/requirement-open-end.yaml +21 -0
  50. package/lexicons/requirement-open-question.yaml +18 -0
  51. package/lexicons/rounded-amount-unit.yaml +13 -0
  52. package/lexicons/self-prefix.yaml +1 -0
  53. package/lexicons/stated-deadline.yaml +4 -0
  54. package/lexicons/teki-fixed-term.yaml +12 -0
  55. package/lexicons/title-ending.yaml +6 -1
  56. package/lexicons/translationese.yaml +5 -0
  57. package/lexicons/unnumbered-heading.yaml +6 -0
  58. package/lexicons/vague-deadline.yaml +1 -0
  59. package/package.json +1 -1
  60. package/src/english-list-line.ts +106 -0
  61. package/src/index.ts +11 -1
  62. package/src/list-line.ts +99 -0
@@ -0,0 +1,8 @@
1
+ # 社内文書や通知(メモの形の文書)の頭に置く項目名。最初の文より前の頭の部分に、この語の後にコロンが続くか行が終わる行があれば
2
+ # メモの形とみなし、挨拶と結びを求めない。「宛先」「件名」はメールのヘッダーにも書くので入れない。
3
+ id: memo-header-label
4
+ language: ja
5
+ entries:
6
+ - pattern: 発信者
7
+ - pattern: 発信元
8
+ - pattern: 発信日
@@ -0,0 +1,11 @@
1
+ # 言い回しを使うのではなく、言葉として名指す語(「徹底解説」という言い方、「今さら聞けない」という表現)。
2
+ # group after は言い回しのすぐ後ろ(かぎ括弧を挟んでよい)、group before はすぐ前。
3
+ id: mention-cue
4
+ language: ja
5
+ entries:
6
+ - { pattern: という言い方, group: after }
7
+ - { pattern: という言葉, group: after }
8
+ - { pattern: という表現, group: after }
9
+ - { pattern: という言い回し, group: after }
10
+ - { pattern: といった言い方, group: after }
11
+ - { pattern: といった表現, group: after }
@@ -109,6 +109,19 @@ entries:
109
109
  instead_of: 依然として変わる
110
110
  - pattern: お侘び
111
111
  instead_of: お詫び
112
+ # 列挙を指す「あげる」(各号に掲げる・挙げる)。「旗を揚げる」「天ぷらを揚げる」と分けるため、指す先の語ごと書く
113
+ - pattern: 各号に揚げる
114
+ instead_of: 各号に掲げる
115
+ - pattern: 以下に揚げる
116
+ instead_of: 以下に掲げる
117
+ - pattern: 前項に揚げる
118
+ instead_of: 前項に掲げる
119
+ - pattern: 前条に揚げる
120
+ instead_of: 前条に掲げる
121
+ - pattern: 別表に揚げる
122
+ instead_of: 別表に掲げる
123
+ - pattern: 上記に揚げる
124
+ instead_of: 上記に掲げる
112
125
  # それ自体が誤りの形
113
126
  - pattern: 不可決
114
127
  instead_of: 不可欠
@@ -22,6 +22,10 @@ entries:
22
22
  - { pattern: に限定されない, group: not-limit }
23
23
  - { pattern: に限定せず, group: not-limit }
24
24
  - { pattern: に限定しない, group: not-limit }
25
+ - { pattern: に限ることなく, group: not-limit }
26
+ - { pattern: に限られることなく, group: not-limit }
27
+ - { pattern: に限定することなく, group: not-limit }
28
+ - { pattern: に限定されることなく, group: not-limit }
25
29
  - { pattern: のみならず, group: not-limit }
26
30
  - { pattern: のみでなく, group: not-limit }
27
31
  - { pattern: のみではなく, group: not-limit }
@@ -0,0 +1,13 @@
1
+ # 中黒を含めて 1 語として書く語。外来語の複合語で、中黒は語の中の切れ目であり、項目を並べてはいない(キャッシュ・フロー計算書)。
2
+ # no-nakaguro-parallel は、この語の中の中黒を数えない。会計・経営の文書に定まった書き方のある語だけを入れる。
3
+ id: nakaguro-word
4
+ language: ja
5
+ entries:
6
+ - pattern: キャッシュ・フロー
7
+ - pattern: ファイナンス・リース
8
+ - pattern: オペレーティング・リース
9
+ - pattern: ストック・オプション
10
+ - pattern: コーポレート・ガバナンス
11
+ - pattern: ワーク・ライフ・バランス
12
+ - pattern: サプライ・チェーン
13
+ - pattern: デュー・デリジェンス
@@ -0,0 +1,34 @@
1
+ # 日付を名指す期限の語(支払期日、納期)と、その日が時を決める行い(group: timed-duty の語)。義務と同じ条(条が無ければ同じ箇条書きか段落)に
2
+ # その行いの期限の語があれば、義務の時はその日で決まっている(obligation-without-deadline は指さない)。「乙は代金を支払う。」の後に
3
+ # 「支払期日までに支払うことができないときは…」と書く契約書。別の行いの日(納期のそばの支払う義務)は時を決めない。
4
+ id: named-deadline
5
+ language: ja
6
+ entries:
7
+ - { pattern: 支払期日, group: 支払 }
8
+ - { pattern: 支払い期日, group: 支払 }
9
+ - { pattern: 支払期限, group: 支払 }
10
+ - { pattern: 支払い期限, group: 支払 }
11
+ - { pattern: 支払期日, group: 振込 }
12
+ - { pattern: 支払期限, group: 振込 }
13
+ - { pattern: 振込期日, group: 振込 }
14
+ - { pattern: 振込期限, group: 振込 }
15
+ - { pattern: 支払期日, group: 振り込 }
16
+ - { pattern: 支払期限, group: 振り込 }
17
+ - { pattern: 振込期日, group: 振り込 }
18
+ - { pattern: 振込期限, group: 振り込 }
19
+ - { pattern: 納期, group: 納入 }
20
+ - { pattern: 納入期日, group: 納入 }
21
+ - { pattern: 納入期限, group: 納入 }
22
+ - { pattern: 納期, group: 納品 }
23
+ - { pattern: 納品期日, group: 納品 }
24
+ - { pattern: 納品期限, group: 納品 }
25
+ - { pattern: 引渡期日, group: 引渡 }
26
+ - { pattern: 引渡し期日, group: 引渡 }
27
+ - { pattern: 引き渡し期日, group: 引渡 }
28
+ - { pattern: 引渡期日, group: 引き渡 }
29
+ - { pattern: 引渡し期日, group: 引き渡 }
30
+ - { pattern: 引き渡し期日, group: 引き渡 }
31
+ - { pattern: 提出期日, group: 提出 }
32
+ - { pattern: 提出期限, group: 提出 }
33
+ - { pattern: 返還期日, group: 返還 }
34
+ - { pattern: 返還期限, group: 返還 }
@@ -1,4 +1,4 @@
1
- # 打ち消しの語。adverb-without-negation が読む。書いた形か原形で照らす。
1
+ # 打ち消しの語。adverb-without-negation と modal-conflict が読む。書いた形か原形で照らす。
2
2
  # 「違う」「異なる」「駄目」は打ち消しと同じ向きの語で、「全然違う」は辞書も認める。
3
3
  # group: prefix は語の頭に付く打ち消し(不十分、未定、無理、非公開)。
4
4
  id: negation-word
@@ -0,0 +1,15 @@
1
+ # 断り書き(免責・変更の予告・転載の断り)の語。これを含む段落は、本文とは別の声で書く決まり文句の段落として、文末の調子を本文と比べない。
2
+ # 動詞は原形で書く(「負う」は「負わない」「負いません」に当たる)。
3
+ id: notice-phrase
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: 無断で複製
@@ -1,5 +1,7 @@
1
1
  # 組織の名前の前に立つ形(法人格と、国立・県立のような設置者)。漢字の連なりがこれで始まり、組織の単位(organisation-unit)で
2
2
  # 閉じれば、その連なりは 1 つの組織の正式名称(国立研究開発法人産業技術総合研究所)。書き手が割れる複合語ではない。
3
+ # position: before の語(設置者)は名前の前にしか立たない。それ以外の法人格は名前の後ろにも立ち、連なりを閉じれば
4
+ # その連なりも 1 つの名前(東日本自動車販売株式会社)。
3
5
  id: organisation-form
4
6
  language: ja
5
7
  entries:
@@ -26,14 +28,14 @@ entries:
26
28
  - pattern: 合同会社
27
29
  - pattern: 合資会社
28
30
  - pattern: 合名会社
29
- - pattern: 国立
30
- - pattern: 公立
31
- - pattern: 私立
32
- - pattern: 都立
33
- - pattern: 道立
34
- - pattern: 府立
35
- - pattern: 県立
36
- - pattern: 市立
37
- - pattern: 区立
38
- - pattern: 町立
39
- - pattern: 村立
31
+ - { pattern: 国立, position: before }
32
+ - { pattern: 公立, position: before }
33
+ - { pattern: 私立, position: before }
34
+ - { pattern: 都立, position: before }
35
+ - { pattern: 道立, position: before }
36
+ - { pattern: 府立, position: before }
37
+ - { pattern: 県立, position: before }
38
+ - { pattern: 市立, position: before }
39
+ - { pattern: 区立, position: before }
40
+ - { pattern: 町立, position: before }
41
+ - { pattern: 村立, position: before }
@@ -0,0 +1,13 @@
1
+ # 文の頭で、て形に読点を続けると接続詞になる動詞(あわせて、/加えて、/続いて、)。辞書の形で、漢字とかなの両方を挙げる。
2
+ # 公用文は接続詞をかなで書き(あわせて)、動詞は漢字で書く(日程を合わせる)ので、orthographic-variant はこの二つを別に比べる。
3
+ # ほかの動詞のて形(みて、驚いた)は、文の頭でも動詞として比べる。
4
+ id: orthographic-variant-conjunction
5
+ language: ja
6
+ entries:
7
+ - pattern: あわせる
8
+ - pattern: 合わせる
9
+ - pattern: 併せる
10
+ - pattern: 加える
11
+ - pattern: くわえる
12
+ - pattern: 続く
13
+ - pattern: つづく
@@ -29,3 +29,6 @@ entries:
29
29
  # 法令は所在を「在る」(店舗に在る物品、船舶の中に在った者)、存在を「ある」と書き分ける。ほかのジャンルでは書き方のゆれ。
30
30
  - pattern: 在る
31
31
  genres: [legal]
32
+ # 「係る」は関係する(本業務に係る報酬)、「かかる」は費用や時間を要する(引渡しにかかる費用)。公用文は前者を漢字、
33
+ # 後者をかなで書くので、一つの文書に両方あっても書き分け。「掛かる」と「かかる」は比べる。
34
+ - pattern: 係る
@@ -23,3 +23,17 @@ entries:
23
23
  - pattern: 決着を付ける
24
24
  - pattern: 難癖をつける
25
25
  - pattern: 難癖を付ける
26
+ # 「〜をもって」は、気持ちや心構えを添えて行う言い方(目的をもって開発する、責任をもって管理する)。公用文はかなで書き、
27
+ # 物を持つ(鍵を持つ、権限を持つ)とは書き分ける。
28
+ - pattern: 目的をもつ
29
+ - pattern: 目的を持つ
30
+ - pattern: 責任をもつ
31
+ - pattern: 責任を持つ
32
+ - pattern: 誠意をもつ
33
+ - pattern: 誠意を持つ
34
+ - pattern: 敬意をもつ
35
+ - pattern: 敬意を持つ
36
+ - pattern: 自信をもつ
37
+ - pattern: 自信を持つ
38
+ - pattern: 余裕をもつ
39
+ - pattern: 余裕を持つ
@@ -25,3 +25,20 @@ entries:
25
25
  - { pattern: ご苦労さま, group: ご苦労様 }
26
26
  - { pattern: お世話様, group: お世話様 }
27
27
  - { pattern: お世話さま, group: お世話様 }
28
+ # 表外の漢字をかなにした交ぜ書きの語で、辞書が漢字とかなに切るもの。切られたかな(証ひょうの「ひょう」)が、同じ読みの別の語
29
+ # (一覧表の「表」)と比べられてしまう。辞書が一語に持つ交ぜ書き(漏えい、改ざん、補てん)は挙げない。
30
+ - { pattern: 証憑, group: 証憑 }
31
+ - { pattern: 証ひょう, group: 証憑 }
32
+ - { pattern: 頒布, group: 頒布 }
33
+ - { pattern: はん布, group: 頒布 }
34
+ - { pattern: 塡補, group: 塡補 }
35
+ - { pattern: 填補, group: 塡補 }
36
+ - { pattern: てん補, group: 塡補 }
37
+ - { pattern: 貼付, group: 貼付 }
38
+ - { pattern: ちょう付, group: 貼付 }
39
+ - { pattern: 蛋白, group: 蛋白 }
40
+ - { pattern: たん白, group: 蛋白 }
41
+ # 「をもとに」(based on)は複合の助詞で、かなで書くことが多い。名詞の「元」(元となる値)とは別に、自分の書き方どうし(を元に、を基に)とだけ比べる。
42
+ - { pattern: をもとに, group: を基に }
43
+ - { pattern: を元に, group: を基に }
44
+ - { pattern: を基に, group: を基に }
@@ -0,0 +1,23 @@
1
+ # 句と句の間に置いて、助詞の連なりを切る記号(no-doubled-joshi)。
2
+ # 「インスタンス名の制限=タグの制限のため」の「=」の前と後ろは別の句で、「の」は続いていない。
3
+ # 全角の=・:・→ は読点と同じく句読点として切れるが、半角の = や : は名詞として読まれるので、ここで切る。
4
+ id: particle-run-break
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: ":="
@@ -0,0 +1,6 @@
1
+ # 自分を呼ぶ語のうち、別のものも指す語。本社は「この会社」のほかに「本店の建物・所在地」も指す(本社(東京都港区)、本社・工場)。
2
+ # 当社と書く文書の本社はたいてい建物のほうなので、person-consistency はこの語を、文書がふだんその語で自分を呼ぶときだけ数える。
3
+ id: person-other-sense
4
+ language: ja
5
+ entries:
6
+ - pattern: 本社
@@ -14,6 +14,9 @@ entries:
14
14
  - pattern: 時は
15
15
  - pattern: 必要に応じて
16
16
  - pattern: よろしければ
17
+ # 頼む相手を、ある人たちに絞る(「申請する方は」「申し込まれた方は」「お持ちでない方は」)。その人たちへの案内で、全員への依頼ではない。
17
18
  - pattern: たい方は
18
19
  - pattern: 希望の方は
19
- - pattern: 希望する方は
20
+ - pattern: る方は
21
+ - pattern: た方は
22
+ - pattern: ない方は
@@ -37,3 +37,6 @@ entries:
37
37
  - pattern: 参加者
38
38
  - pattern: 受講者
39
39
  - pattern: 学生
40
+ # 〜者を主語に立てた依頼(「広告依頼者が作成してください」「出店者は」)。品詞があれば「者」が語の切れ目にあるときだけ。
41
+ - pattern: 者が
42
+ - pattern: 者は
@@ -0,0 +1,9 @@
1
+ # 条件を言う語。この語のすぐ後ろの括弧の中の「等」「など」(必要ない場合(単一テーブルへの SELECT 等)も付与すること)は、
2
+ # 要求がいつ当てはまるかの例で、要求の範囲を開いたままにしているのではない。requirement-smell が読む。
3
+ # 「時」は入れない。同時・当時のような語の終わりと文字では見分けられない。
4
+ id: requirement-open-condition
5
+ language: ja
6
+ entries:
7
+ - pattern: 場合
8
+ - pattern: とき
9
+ - pattern: 際
@@ -1,6 +1,27 @@
1
1
  # 列挙を閉じない語(Femmer ほか 2017 の open-ended terms)。要求の文にあると、ほかに何が含まれるのかを読み手が決められない。
2
+ # group: class-link と class-suffix は語ではなく、一覧のすぐ後ろで種類を名指す目印。「印刷等、二次的に利用」「印刷等の二次的利用」は、
3
+ # 「等」のすぐ後ろ(class-link)の名詞が「的」(class-suffix)で種類を名指していて、一覧はその例なので開いていない。
2
4
  id: requirement-open-end
3
5
  language: ja
4
6
  entries:
5
7
  - pattern: 等
6
8
  - pattern: など
9
+ - { pattern: 、, group: class-link }
10
+ - { pattern: の, group: class-link }
11
+ - { pattern: 的, group: class-suffix }
12
+ # group: scope-* も語ではなく、一覧が何に属するかの目印。「ログ等を保存すること」の一覧は果たす義務の中にあって開いている。
13
+ # 条件(訂正等を行った際に)、与える権利(消去できるものとします)、禁止や免責(転載等をしてはならない、責任を負わないものとします)
14
+ # の中の一覧は、わざと広く取った契約の普通の書き方。「等」の後ろで最初に当たった目印が決める。条件の語は、述語のすぐ後ろにあって、
15
+ # 一覧の節が読点で閉じる前(消去し、の前)のときだけ数える。
16
+ - { pattern: なければならない, group: scope-duty }
17
+ - { pattern: なければなりません, group: scope-duty }
18
+ - { pattern: 必要がある, group: scope-duty }
19
+ - { pattern: ものとする, group: scope-duty }
20
+ - { pattern: できるものとする, group: scope-permission }
21
+ - { pattern: 出来るものとする, group: scope-permission }
22
+ - { pattern: てはならない, group: scope-prohibition }
23
+ - { pattern: てはなりません, group: scope-prohibition }
24
+ - { pattern: ないものとする, group: scope-prohibition }
25
+ - { pattern: 場合, group: scope-condition }
26
+ - { pattern: 際, group: scope-condition }
27
+ - { pattern: とき, group: scope-condition }
@@ -0,0 +1,18 @@
1
+ # 列挙の例のすぐ後ろで、読み手に選ばせる問い(〜措置など、どのような措置を求めるのか)。例は問いへの答えの見本で、一覧が開いているのは書き手の意図(requirement-smell)。
2
+ # group: interrogative は問いを始める語(何を選ぶかを聞く語)、question-end は問いを閉じる助詞、not-interrogative は同じ書き出しでやり方を聞く語、universal-mark は問いの語を「どれでも」に変える助詞。
3
+ id: requirement-open-question
4
+ language: ja
5
+ entries:
6
+ - { pattern: どのような, group: interrogative }
7
+ - { pattern: どんな, group: interrogative }
8
+ - { pattern: どの, group: interrogative }
9
+ - { pattern: いかなる, group: interrogative }
10
+ # 何らか(何らかの措置)は問いではないので、助詞まで含めて書く。
11
+ - { pattern: 何を, group: interrogative }
12
+ - { pattern: 何が, group: interrogative }
13
+ - { pattern: 何に, group: interrogative }
14
+ - { pattern: か, group: question-end }
15
+ # やり方を聞く問い。どの・どのような と同じ書き出しだが、一覧の答えを選ばせない。
16
+ - { pattern: どのように, group: not-interrogative }
17
+ # 問いの語を「どれでも」に変える助詞(どの部署でも、何をも)。これが か より前にあれば問いではない。
18
+ - { pattern: も, group: universal-mark }
@@ -0,0 +1,13 @@
1
+ # 丸めた桁で書く金額の単位(6,655百万円、3.1億円)。total-mismatch は、文の中の合計と内訳のどれもがこの単位なら、内訳の和と合計の
2
+ # ずれが(内訳の数 − 1)× 最後の桁一つ分までなら丸めのずれと読む。万円は端数の無い額にも使うので入れない。
3
+ id: rounded-amount-unit
4
+ language: ja
5
+ entries:
6
+ - pattern: 千円
7
+ - pattern: 百万円
8
+ - pattern: 億円
9
+ - pattern: 千ドル
10
+ - pattern: 百万ドル
11
+ - pattern: 億ドル
12
+ - pattern: million
13
+ - pattern: billion
@@ -1,4 +1,5 @@
1
1
  # この文書自身を指す名前の頭(「本契約」「当規約」「この法律」)。「同法」は前に出た別の文書なので入れない。
2
+ # 文書自身の名前を定義した語(この就業規則(以下「規則」))は、この頭を付ければ定義より前でも使ってよい(use-before-definition)。
2
3
  id: self-prefix
3
4
  language: ja
4
5
  entries:
@@ -11,3 +11,7 @@ entries:
11
11
  - pattern: ただちに
12
12
  - pattern: 同時に
13
13
  - pattern: 当日
14
+ # 「事前に」「あらかじめ」は、決まった出来事(変更、作業)より前と時を決める(英語の before、prior to と同じ)。
15
+ - pattern: 事前に
16
+ - pattern: あらかじめ
17
+ - pattern: 予め
@@ -0,0 +1,12 @@
1
+ # 法令が定めた語で、「的」が語の一部になっているもの(電磁的方法、反社会的勢力)。teki-overuse は、この語の中の「的」を数えない。
2
+ # 書き手が選んだ形容ではなく、言い換えると別の語になるため。形態素解析が「電磁|的|方法」と分けるものだけを書く(知的財産、私的独占は一語に読む)。
3
+ id: teki-fixed-term
4
+ language: ja
5
+ entries:
6
+ - pattern: 電磁的記録
7
+ - pattern: 電磁的方法
8
+ - pattern: 電磁的方式
9
+ - pattern: 反社会的勢力
10
+ - pattern: 技術的保護手段
11
+ - pattern: 技術的利用制限手段
12
+ - pattern: 実質的支配者
@@ -1,4 +1,4 @@
1
- # 題の付いたもの(要綱・法令・事業・制度・試験・計画・補助金)の名前を閉じる語。漢字の連なりがこれで終わり、
1
+ # 題の付いたもの(要綱・法令・事業・制度・試験・計画・補助金・届け出の書式)の名前を閉じる語。漢字の連なりがこれで終わり、
2
2
  # 題の置き方(括弧の中身を閉じる、すぐ後ろに補いの括弧が付く、文がその連なりだけ、見出しにある)をしていれば、
3
3
  # 書き手が選んだ複合語ではなく、変えられない名前(大阪市鶴見区役所公募型比較見積実施要綱、国家公務員中途採用者選考試験)。
4
4
  # 閉じる語は語の切れ目で始まり、前に 2 字以上の語が要る(解決方法の「法」、本事業は当たらない)。
@@ -27,3 +27,8 @@ entries:
27
27
  - pattern: 奨励金
28
28
  - pattern: 給付金
29
29
  - pattern: 案件
30
+ - pattern: 申込書
31
+ - pattern: 申請書
32
+ - pattern: 届出書
33
+ - pattern: 報告書
34
+ - pattern: 証明書
@@ -3,6 +3,8 @@
3
3
  # 人の書いた技術記事でもふつうに使う言い回し(〜を提供する、〜に焦点を当てる、〜することができる)は載せない。
4
4
  # 一つの文に二つの語が当たると二つと数えるので、ほかの語を含む長い形(することを可能にする)は載せない。
5
5
  # 動詞は原形で書けば活用した形(可能にします、果たしている)にも当たる。rewrite は日本語として素直な言い方の例。
6
+ # group address は読み手への呼びかけ(あなたの)。行動規範や案内のように読み手に語りかける文書では書き手の選んだ書き方なので、
7
+ # ほかの言い回しと一緒のときだけ数える。
6
8
  id: translationese
7
9
  language: ja
8
10
  entries:
@@ -29,8 +31,10 @@ entries:
29
31
  - pattern: という利点を持つ
30
32
  rewrite: 〜という利点がある
31
33
  - pattern: あなたは
34
+ group: address
32
35
  rewrite: 主語を省く、または「読者は」「利用者は」
33
36
  - pattern: あなたの
37
+ group: address
34
38
  rewrite: 主語を省く、または「自分の」
35
39
  - pattern: 彼女は
36
40
  rewrite: 名前で呼ぶ、または主語を省く
@@ -45,6 +49,7 @@ entries:
45
49
  - pattern: 驚くべきことに
46
50
  rewrite: 省く、または何が意外なのかを書く
47
51
  - pattern: あなた自身
52
+ group: address
48
53
  rewrite: 自分、または主語を省く
49
54
  - pattern: 最後になりましたが
50
55
  rewrite: 最後に
@@ -33,6 +33,12 @@ entries:
33
33
  - pattern: お問い合わせ先
34
34
  - pattern: 問合せ先
35
35
  - pattern: お問合せ先
36
+ - pattern: 問合わせ先
37
+ - pattern: お問合わせ先
38
+ - pattern: 問い合わせ窓口
39
+ - pattern: お問い合わせ窓口
40
+ # 官公庁の報道発表が使う「照会先」。
41
+ - pattern: 照会先
36
42
  - pattern: はしがき
37
43
  - pattern: あとがき
38
44
  - pattern: 序文
@@ -7,6 +7,7 @@ entries:
7
7
  - pattern: すみやかに
8
8
  - pattern: 可及的速やかに
9
9
  - pattern: 遅滞なく
10
+ - pattern: 遅延なく
10
11
  - pattern: 早急に
11
12
  - pattern: 相当の期間内に
12
13
  - pattern: 相当期間内に
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-ja",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "description": "Japanese language adapter for chaff",
5
5
  "license": "MIT",
6
6
  "author": "isamu",
@@ -0,0 +1,106 @@
1
+ import type { Span } from "chaffjs/plugin";
2
+
3
+ // 英語のアダプタの list-line.ts の写し(英文だけの段落を英語のアダプタと同じに切るため)。アダプタは互いに依存しない。
4
+
5
+ /**
6
+ * Items written one per line with no blank line between them ("(a) …;\n(b) …", plain-text "1." or "-" lines, lines that
7
+ * were `<br>`). An item seldom ends in a full stop, so the splitter reads the whole run as one sentence.
8
+ *
9
+ * English is hard-wrapped, and a wrapped line can start like an item ("in Section 2\n(a) of this Agreement", "in
10
+ * RFC\n793. It"). So a break before an item is cut only on a cue: the line before ends a lead-in or an item, the next
11
+ * marker continues the list ("-" after "-", "(b)" after "(a)"), both lines are items and the next starts with a capital,
12
+ * or a bracketed marker is followed by a capital. A break after
13
+ * an item into a line with no marker is never cut: that line continues the item as often as it starts new text.
14
+ */
15
+
16
+ const PAREN = String.raw`\((?:\d{1,3}[A-Z]?|[a-z]{1,2}|[A-Z]|[ivxlc]{2,6}|[IVXLC]{2,6})\)`;
17
+ const NUMBER = String.raw`\d{1,3}(?:\.\d{1,3})*[.)]|\d{1,3}(?:\.\d{1,3})+`;
18
+ const LETTER = String.raw`[a-z][.)]`;
19
+ /** An appendix's numbered part ("A.1.", "B.2.3"), as an RFC writes it in the body and in its contents. */
20
+ const APPENDIX = String.raw`[A-Z](?:\.\d{1,3})+\.?`;
21
+ const BULLET = "[-–•●▪◦‣*·]";
22
+
23
+ /** The marker, then the first character of the item's text. A marker other than a bracketed one needs a space after it. */
24
+ const MARKER = new RegExp(String.raw`^[ \t]*(?:(${PAREN})[ \t]*|(${NUMBER}|${APPENDIX}|${LETTER}|${BULLET})[ \t]+)(\S)?`, "u");
25
+
26
+ /** marker: as written ("(a)", "2.", "-"). capital: the item's text starts with a capital or a digit. */
27
+ type Item = { readonly marker: string; readonly bracketed: boolean; readonly capital: boolean };
28
+
29
+ const itemOf = (line: string): Item | undefined => {
30
+ const match = MARKER.exec(line);
31
+ if (match === null) return undefined;
32
+ return { marker: match[1] ?? match[2] ?? "", bracketed: match[1] !== undefined, capital: /[\p{Lu}\d]/u.test(match[3] ?? "") };
33
+ };
34
+
35
+ const BULLET_ONLY = new RegExp(`^${BULLET}$`, "u");
36
+
37
+ /** A number or a single letter between the same brackets or before the same stop ("(a)", "2.", "b)"). */
38
+ const SEQUENCED = /^(\(?)(\d{1,3}|[a-zA-Z])([.)]?)$/u;
39
+
40
+ const nextLabel = (label: string): string => (/\d/u.test(label) ? String(Number(label) + 1) : String.fromCharCode(label.charCodeAt(0) + 1));
41
+
42
+ /** The second marker continues the first: the same bullet ("-", "-"), or the next number or letter written alike ("(a)", "(b)"). */
43
+ const continuesList = (first: string, second: string): boolean => {
44
+ if (BULLET_ONLY.test(first)) return first === second;
45
+ const [, open, label, close] = SEQUENCED.exec(first) ?? [];
46
+ if (label === undefined) return false;
47
+ return second === `${open ?? ""}${nextLabel(label)}${close ?? ""}`;
48
+ };
49
+
50
+ /** Whether the line starts with a list marker. */
51
+ const startsWithListMarker = (line: string): boolean => itemOf(line) !== undefined;
52
+
53
+ /** The end of a line, without a Markdown hard break ("\" or trailing spaces). */
54
+ const endOf = (line: string): string => {
55
+ const trimmed = line.trimEnd();
56
+ return trimmed.endsWith("\\") ? trimmed.slice(0, -1).trimEnd() : trimmed;
57
+ };
58
+
59
+ /** A lead-in or an item that ends here: the next item is a new sentence whatever it starts with. */
60
+ const LEAD_IN_END = /(?:[:;—–]|[;,:][ \t]*(?:and|or|and\/or|but|then))$/u;
61
+ /** Ends the line's own item: a comma or a conjunction after it, when the line is an item too. */
62
+ const ITEM_END = /(?:,|\b(?:and|or))$/u;
63
+ /** A full stop the splitter may have read as an abbreviation ("Inc.", "U.S."). */
64
+ const STOP_END = /[.?!]["”’)]?$/u;
65
+
66
+ const isCut = (previous: string, next: string): boolean => {
67
+ const item = itemOf(next);
68
+ if (item === undefined) return false;
69
+ const end = endOf(previous);
70
+ const before = itemOf(previous);
71
+ const previousIsItem = before !== undefined;
72
+ if (LEAD_IN_END.test(end)) return true;
73
+ if (before !== undefined && continuesList(before.marker, item.marker)) return true;
74
+ if (previousIsItem && ITEM_END.test(end)) return true;
75
+ if (!item.capital) return false;
76
+ return previousIsItem || item.bracketed || STOP_END.test(end);
77
+ };
78
+
79
+ type Line = { readonly start: number; readonly end: number; readonly text: string };
80
+
81
+ const NEWLINE = /\r?\n/gu;
82
+
83
+ const linesOf = (text: string): Line[] => {
84
+ const breaks = [...text.matchAll(NEWLINE)];
85
+ const starts = [0, ...breaks.map((match) => match.index + match[0].length)];
86
+ return starts.map((start, index) => {
87
+ const end = breaks[index]?.index ?? text.length;
88
+ return { start, end, text: text.slice(start, end) };
89
+ });
90
+ };
91
+
92
+ const indentOf = (line: Line): number => line.text.length - line.text.trimStart().length;
93
+
94
+ /** The line breaks that end a sentence: from the end of the line before to the first character of the item. */
95
+ export const listLineBreaks = (text: string): Span[] => {
96
+ const lines = linesOf(text);
97
+ return lines.slice(1).flatMap((next, index) => {
98
+ const previous = lines[index];
99
+ if (previous === undefined || previous.text.trim() === "" || !isCut(previous.text, next.text)) return [];
100
+ return [{ start: previous.end, end: next.start + indentOf(next) }];
101
+ });
102
+ };
103
+
104
+ /** Each item's head: from the start of its line to the marker's first character. A sentence starting here starts an item. */
105
+ export const listItemHeads = (text: string): Span[] =>
106
+ linesOf(text).flatMap((line) => (startsWithListMarker(line.text) ? [{ start: line.start, end: line.start + indentOf(line) + 1 }] : []));
package/src/index.ts CHANGED
@@ -9,6 +9,8 @@ import { splitAtQuotedStops } from "./quoted-stop.ts";
9
9
  import { reattachClosingQuotes } from "./closing-quote.ts";
10
10
  import { insideBrackets, startsWithCloser } from "./inside-brackets.ts";
11
11
  import { structure } from "./structure.ts";
12
+ import { cutAtBreaks, listItemHeads, listLineBreaks, startsListItem } from "./list-line.ts";
13
+ import { listItemHeads as englishListItemHeads, listLineBreaks as englishListLineBreaks } from "./english-list-line.ts";
12
14
  import { isReady, predicateOnly, prepare, readsAsCounter, readsAsOneAdverb, readsAsOneWord, tokenize } from "./pos.ts";
13
15
  import { markSpacedCounters } from "./spaced-counter.ts";
14
16
  import { tokensWithin } from "./tokens-within.ts";
@@ -45,6 +47,8 @@ const LINE_BREAK = /[\n\r]/u;
45
47
 
46
48
  const ENGLISH: EmbeddedLanguage = { id: "en", lengthUnit: "word" };
47
49
 
50
+ const asListItem = (sentence: Sentence): Sentence => ({ ...sentence, listItem: true });
51
+
48
52
  const withLanguage = (text: string, span: Span): Sentence => (isEnglishRun(text) ? { span, text, embeddedLanguage: ENGLISH } : { span, text });
49
53
 
50
54
  /**
@@ -53,6 +57,10 @@ const withLanguage = (text: string, span: Span): Sentence => (isEnglishRun(text)
53
57
  */
54
58
  const merge = (source: string, spans: readonly Span[]): Sentence[] => {
55
59
  const open = insideBrackets(source);
60
+ // 英文だけの段落は英語のアダプタと同じに切る(項目の印も英語の読み方で)。行頭の「J.」は人名の頭文字で、項目の印ではない。
61
+ const english = isEnglishRun(source);
62
+ const listBreaks = english ? englishListLineBreaks(source) : listLineBreaks(source);
63
+ const itemHeads = english ? englishListItemHeads(source) : listItemHeads(source);
56
64
  return spans
57
65
  .reduce<Span[]>((acc, span) => {
58
66
  const last = acc.at(-1);
@@ -65,7 +73,9 @@ const merge = (source: string, spans: readonly Span[]): Sentence[] => {
65
73
  else acc.push(span);
66
74
  return acc;
67
75
  }, [])
68
- .map((span) => withLanguage(source.slice(span.start, span.end), span));
76
+ .flatMap((span) => cutAtBreaks(span, listBreaks))
77
+ .map((span) => withLanguage(source.slice(span.start, span.end), span))
78
+ .map((sentence) => (startsListItem(itemHeads, sentence.span.start) ? asListItem(sentence) : sentence));
69
79
  };
70
80
 
71
81
  /**