@chaffjs/lang-ja 0.36.0 → 0.38.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 (125) hide show
  1. package/dist/english-run.d.ts.map +1 -1
  2. package/dist/english-run.js +2 -1
  3. package/dist/english-run.js.map +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +5 -2
  6. package/dist/index.js.map +1 -1
  7. package/dist/initial-stop.d.ts +23 -0
  8. package/dist/initial-stop.d.ts.map +1 -0
  9. package/dist/initial-stop.js +33 -0
  10. package/dist/initial-stop.js.map +1 -0
  11. package/dist/list-line.d.ts.map +1 -1
  12. package/dist/list-line.js +55 -7
  13. package/dist/list-line.js.map +1 -1
  14. package/dist/pos.d.ts.map +1 -1
  15. package/dist/pos.js +7 -1
  16. package/dist/pos.js.map +1 -1
  17. package/dist/quoted-line-stop.d.ts +4 -0
  18. package/dist/quoted-line-stop.d.ts.map +1 -0
  19. package/dist/quoted-line-stop.js +18 -0
  20. package/dist/quoted-line-stop.js.map +1 -0
  21. package/dist/structure.d.ts.map +1 -1
  22. package/dist/structure.js +5 -2
  23. package/dist/structure.js.map +1 -1
  24. package/lexicons/adversative-ga-causal.yaml +11 -0
  25. package/lexicons/ai-tell.yaml +41 -20
  26. package/lexicons/alternative-clause-label.yaml +7 -0
  27. package/lexicons/announcing-opener.yaml +4 -0
  28. package/lexicons/asker-heading.yaml +14 -0
  29. package/lexicons/bracket-annotation.yaml +8 -0
  30. package/lexicons/bracket-width.yaml +6 -0
  31. package/lexicons/case-party-joiner.yaml +7 -0
  32. package/lexicons/closing-cliche.yaml +22 -1
  33. package/lexicons/closing-exhortation.yaml +23 -0
  34. package/lexicons/cold-open.yaml +30 -0
  35. package/lexicons/common-acronym.yaml +17 -2
  36. package/lexicons/comparative-baseline.yaml +16 -1
  37. package/lexicons/condition-heading.yaml +14 -0
  38. package/lexicons/contact-line-opener.yaml +16 -0
  39. package/lexicons/contrast-amount.yaml +14 -0
  40. package/lexicons/contrast-lead.yaml +5 -0
  41. package/lexicons/contrast-turn.yaml +5 -0
  42. package/lexicons/count-hedge.yaml +5 -0
  43. package/lexicons/declaration-particle.yaml +14 -0
  44. package/lexicons/defined-term-group-suffix.yaml +6 -0
  45. package/lexicons/demonstrative-not-opener.yaml +14 -0
  46. package/lexicons/email-closing.yaml +5 -3
  47. package/lexicons/email-greeting.yaml +10 -3
  48. package/lexicons/empty-intensifier.yaml +2 -0
  49. package/lexicons/everyday-name.yaml +29 -0
  50. package/lexicons/final-period.yaml +27 -0
  51. package/lexicons/fixed-name-ending.yaml +25 -0
  52. package/lexicons/headnote-heading.yaml +9 -0
  53. package/lexicons/honorific-group.yaml +9 -0
  54. package/lexicons/humble-own-act.yaml +15 -0
  55. package/lexicons/intent-ending.yaml +33 -0
  56. package/lexicons/interviewer-mark.yaml +15 -0
  57. package/lexicons/kanji-known-word.yaml +14 -0
  58. package/lexicons/licence-word.yaml +7 -0
  59. package/lexicons/link-label-ending.yaml +11 -0
  60. package/lexicons/list-conjunction.yaml +13 -0
  61. package/lexicons/list-continues.yaml +7 -0
  62. package/lexicons/list-note-lead.yaml +2 -0
  63. package/lexicons/list-suffix.yaml +6 -0
  64. package/lexicons/name-capitals-prefix.yaml +15 -0
  65. package/lexicons/name-copula.yaml +17 -0
  66. package/lexicons/name-direction-word.yaml +8 -0
  67. package/lexicons/name-title-head.yaml +23 -0
  68. package/lexicons/navigation-line.yaml +14 -0
  69. package/lexicons/necessity-purpose.yaml +13 -0
  70. package/lexicons/neutral-request.yaml +9 -0
  71. package/lexicons/neutral-wish.yaml +8 -0
  72. package/lexicons/newsletter-issue.yaml +10 -0
  73. package/lexicons/ngram-fixed-ending.yaml +22 -0
  74. package/lexicons/organisation-unit.yaml +8 -0
  75. package/lexicons/orthographic-variant-conjunction.yaml +4 -0
  76. package/lexicons/orthographic-variant-distinct.yaml +5 -0
  77. package/lexicons/orthographic-variant-idiom.yaml +3 -0
  78. package/lexicons/orthographic-variant-judging.yaml +4 -1
  79. package/lexicons/orthographic-variant-katakana-sense.yaml +8 -0
  80. package/lexicons/orthographic-variant-law-number.yaml +7 -0
  81. package/lexicons/orthographic-variant-light-verb.yaml +8 -0
  82. package/lexicons/orthographic-variant-means.yaml +9 -0
  83. package/lexicons/orthographic-variant-name-ending.yaml +10 -0
  84. package/lexicons/orthographic-variant-two-readings.yaml +14 -0
  85. package/lexicons/orthographic-variant-voice.yaml +8 -0
  86. package/lexicons/orthographic-variant-whole-word.yaml +12 -0
  87. package/lexicons/padded-intro.yaml +11 -0
  88. package/lexicons/placeholder-division.yaml +8 -0
  89. package/lexicons/placeholder-word.yaml +63 -1
  90. package/lexicons/prepositive-abbreviation.yaml +9 -0
  91. package/lexicons/product-name.yaml +9 -0
  92. package/lexicons/quote-label.yaml +16 -0
  93. package/lexicons/quoted-wording-cue.yaml +14 -0
  94. package/lexicons/reference-prefix.yaml +12 -0
  95. package/lexicons/rejected-wording.yaml +18 -0
  96. package/lexicons/relative-start.yaml +8 -0
  97. package/lexicons/request-deadline-section.yaml +12 -0
  98. package/lexicons/request-prohibition.yaml +9 -0
  99. package/lexicons/requirement-open-end.yaml +8 -0
  100. package/lexicons/sentence-start-word.yaml +59 -0
  101. package/lexicons/set-polite-phrase.yaml +13 -0
  102. package/lexicons/spelling-mention.yaml +9 -0
  103. package/lexicons/statute-article-opener.yaml +6 -0
  104. package/lexicons/superlative-goal.yaml +16 -0
  105. package/lexicons/superlative-owner.yaml +6 -0
  106. package/lexicons/superlative-phrase.yaml +18 -0
  107. package/lexicons/superlative-realm.yaml +14 -0
  108. package/lexicons/superlative-viewpoint.yaml +6 -0
  109. package/lexicons/takeup-opener.yaml +13 -0
  110. package/lexicons/telling-cue.yaml +12 -0
  111. package/lexicons/template-heading.yaml +32 -0
  112. package/lexicons/term-source-marker.yaml +11 -0
  113. package/lexicons/text-message-verb.yaml +11 -0
  114. package/lexicons/title-ending.yaml +18 -1
  115. package/lexicons/topic-clause-close.yaml +11 -0
  116. package/lexicons/unnumbered-heading.yaml +3 -0
  117. package/lexicons/unprompted-denial.yaml +99 -0
  118. package/package.json +1 -1
  119. package/src/english-run.ts +2 -1
  120. package/src/index.ts +8 -2
  121. package/src/initial-stop.ts +58 -0
  122. package/src/list-line.ts +66 -8
  123. package/src/pos.ts +14 -1
  124. package/src/quoted-line-stop.ts +20 -0
  125. package/src/structure.ts +5 -2
@@ -0,0 +1,12 @@
1
+ # 前に書いたもの(または後に書くもの)を指して語の頭に付く語(上記暗号資産交換業者、当該保険契約)。
2
+ # max-kanji-continuous は、漢字の連なりの頭にこの語があり、解析が別の語に分けたときは、この語を数えない。
3
+ id: reference-prefix
4
+ language: ja
5
+ entries:
6
+ - pattern: 上記
7
+ - pattern: 下記
8
+ - pattern: 前記
9
+ - pattern: 後記
10
+ - pattern: 当該
11
+ - pattern: 前述
12
+ - pattern: 後述
@@ -0,0 +1,18 @@
1
+ # 鉤括弧で引いた言い方のすぐ後ろに来て、その言い方を「書かない」と退ける語(「風雨が強い」とはせずに、…)。「X」とは、の定義に
2
+ # 見えても定義ではないので、unused-definition はその語を指さない。字面どおりに照らす。
3
+ id: rejected-wording
4
+ language: ja
5
+ entries:
6
+ - pattern: とはせず
7
+ - pattern: とはしない
8
+ - pattern: とは書かず
9
+ - pattern: とは書かない
10
+ - pattern: とは言わず
11
+ - pattern: とは言わない
12
+ - pattern: とはいわず
13
+ - pattern: とはいわない
14
+ # 「X」とは言えない・とは限らない も、その語に当たらないと言っていて、定義ではない。
15
+ - pattern: とは言え
16
+ - pattern: とはいえ
17
+ - pattern: とは限ら
18
+ - pattern: とは呼べ
@@ -0,0 +1,8 @@
1
+ # 期間のすぐ前に置いて、その前の名前を期間の起点にする語(relative-date-mismatch)。基準の日付の後ろで読点が入り、期間の前に
2
+ # 「名前 + この語」があれば、期間は前の日付ではなくその名前から数えている(…まで存続し、今井が死亡した年の翌年から起算して38年後の…)。
3
+ id: relative-start
4
+ language: ja
5
+ entries:
6
+ - pattern: から
7
+ - pattern: から起算して
8
+ - pattern: から数えて
@@ -0,0 +1,12 @@
1
+ # 文書の締め切りを一度だけ書く節の見出し(それだけで書いた見出し)。その節に締め切りの語と日付があれば、文書の中の
2
+ # 依頼はどれもその締め切りを持つ。見出し全体と比べる(終わりの「:」は除く)。
3
+ id: request-deadline-section
4
+ language: ja
5
+ entries:
6
+ - pattern: 日程
7
+ - pattern: 期限
8
+ - pattern: 締切
9
+ - pattern: 締め切り
10
+ - pattern: 提出期限
11
+ - pattern: 応募期限
12
+ - pattern: 募集期間
@@ -0,0 +1,9 @@
1
+ # しないように頼む書き方(「メールでは送らないでください」)は禁止で、期限までに済ませることが無い。
2
+ id: request-prohibition
3
+ language: ja
4
+ entries:
5
+ - pattern: ないでください
6
+ - pattern: ないようにしてください
7
+ - pattern: ないようお願い
8
+ - pattern: ご遠慮ください
9
+ - pattern: お控えください
@@ -25,3 +25,11 @@ entries:
25
25
  - { pattern: 場合, group: scope-condition }
26
26
  - { pattern: 際, group: scope-condition }
27
27
  - { pattern: とき, group: scope-condition }
28
+ # group: scope-topic は、述語で終わる節が説明する名詞のすぐ後ろの「は」(…を行う個人間融資は)。一覧はその名詞の説明の中にあって、
29
+ # 要求が何についてかを言っているだけで、果たす義務の中にはない。「は」の後ろに読点があるときだけ。
30
+ # group: scope-nominal は、その名詞が行い自体を名指すとき(提出することは、提出する義務は)。一覧は義務の中にある。
31
+ - { pattern: は, group: scope-topic }
32
+ - { pattern: こと, group: scope-nominal }
33
+ - { pattern: 義務, group: scope-nominal }
34
+ - { pattern: 責任, group: scope-nominal }
35
+ - { pattern: 必要, group: scope-nominal }
@@ -0,0 +1,59 @@
1
+ # 文の頭に立ち、姓にはならない英語の機能語。大文字と点の頭文字の後ろ(Regulation C. The Guide、Appendix B. In 2020)では、
2
+ # 点で文が終わる。日本語の文書の中の英文も同じ分割器で切るので、英語と同じ語を置く。字面どおりに照らす。
3
+ id: sentence-start-word
4
+ language: ja
5
+ entries:
6
+ - pattern: The
7
+ - pattern: This
8
+ - pattern: That
9
+ - pattern: These
10
+ - pattern: Those
11
+ - pattern: A
12
+ - pattern: An
13
+ - pattern: It
14
+ - pattern: Its
15
+ - pattern: In
16
+ - pattern: On
17
+ - pattern: At
18
+ - pattern: For
19
+ - pattern: From
20
+ - pattern: With
21
+ - pattern: By
22
+ - pattern: As
23
+ - pattern: If
24
+ - pattern: When
25
+ - pattern: While
26
+ - pattern: Although
27
+ - pattern: However
28
+ - pattern: Thus
29
+ - pattern: Therefore
30
+ - pattern: We
31
+ - pattern: They
32
+ - pattern: He
33
+ - pattern: She
34
+ - pattern: You
35
+ - pattern: Our
36
+ - pattern: Their
37
+ - pattern: There
38
+ - pattern: Here
39
+ - pattern: Each
40
+ - pattern: Every
41
+ - pattern: All
42
+ - pattern: Some
43
+ - pattern: Many
44
+ - pattern: Most
45
+ - pattern: But
46
+ - pattern: And
47
+ - pattern: So
48
+ - pattern: Yet
49
+ - pattern: Also
50
+ - pattern: Then
51
+ - pattern: After
52
+ - pattern: Before
53
+ - pattern: Under
54
+ - pattern: To
55
+ - pattern: Such
56
+ - pattern: What
57
+ - pattern: Which
58
+ - pattern: How
59
+ - pattern: Why
@@ -0,0 +1,13 @@
1
+ # 丁寧な形でしか言わない挨拶と礼の決まり文句。no-mixed-desumasu が、この語で終わる文(農業まつり、お疲れ様でした。)を、
2
+ # である調の文書の中でも指さない(数には入れる)。相手に向けた挨拶は、地の文がである調でもこの形で言う。
3
+ # 依頼(ご覧ください。)は入れない。である調の文書の中の依頼は、ですます調の少数派として今までどおり指す。
4
+ id: set-polite-phrase
5
+ language: ja
6
+ entries:
7
+ - pattern: お疲れ様でした
8
+ - pattern: お疲れさまでした
9
+ - pattern: ご苦労様でした
10
+ - pattern: ご苦労さまでした
11
+ - pattern: ありがとうございました
12
+ - pattern: ありがとうございます
13
+ - pattern: おめでとうございます
@@ -0,0 +1,9 @@
1
+ # 別の書き方があると言う語句(用語集の「(曇)とも書く。」)。orthographic-variant は、この語句の前の丸括弧に入れた語を、
2
+ # 書き方そのものを話題にした語と読み、本文の書き方とは比べない。
3
+ id: spelling-mention
4
+ language: ja
5
+ entries:
6
+ - pattern: とも書く
7
+ - pattern: とも書きます
8
+ - pattern: とも表記する
9
+ - pattern: とも表記します
@@ -0,0 +1,6 @@
1
+ # 法令の条の書き出し(正規表現)。法令や契約でない文書(手引き、報告)がこの形で始まる文を載せていれば、それは条文をそのまま引いたもので、
2
+ # 書き手が直せる文ではない。topic-predicate-distance はその文を数えない。法令・契約の文書では条文が文書そのものなので、そのまま数える。
3
+ id: statute-article-opener
4
+ language: ja
5
+ entries:
6
+ - pattern: "^第[0-90-9〇一二三四五六七八九十百千]+条(?:の[0-90-9〇一二三四五六七八九十百千]+)*[  ]"
@@ -0,0 +1,16 @@
1
+ # 最上級を、言い切った主張ではなく、求めるもの・あるべき姿として受ける述語。最上級より後ろに来る
2
+ # (最高の規律が求められる・最高の栄誉が与えられるべき・最高の栄誉が与えられなければならない)。
3
+ # 同じ文の最上級より後ろにあれば unqualified-superlative は指さない。動詞は原形で書く。
4
+ id: superlative-goal
5
+ language: ja
6
+ entries:
7
+ - pattern: 求める
8
+ position: after
9
+ - pattern: 目指す
10
+ position: after
11
+ - pattern: べき
12
+ position: after
13
+ - pattern: なければ
14
+ position: after
15
+ - pattern: ねば
16
+ position: after
@@ -0,0 +1,6 @@
1
+ # 最上級のすぐ前で、持ち主の名前を受ける語。「芭蕉の最も有名な作品」「国連の最も大事な目的」は、芭蕉の作品・国連の目的の
2
+ # 中で最もなのかを言っている。前の語が名前で、名前と最上級に空白を挟まずに付いたときだけ。
3
+ id: superlative-owner
4
+ language: ja
5
+ entries:
6
+ - pattern: の
@@ -0,0 +1,18 @@
1
+ # 最上級を含むが、何かが一番だと言ってはいない決まった言い方。最上級がこの中にあれば unqualified-superlative は指さない。
2
+ # 職名・機関名(最高裁判所・最高経営責任者)は名前。「最も近い」「最も遠い」は書いている場所からの距離。
3
+ # 「最も重要なことは」「最も大切なのは」は、書き手が自分の話のうち何を先に言うかを示す言い方。
4
+ id: superlative-phrase
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: 最も大切なのは
@@ -0,0 +1,14 @@
1
+ # 名前ではないが、範囲の「で」の前で何の中の最もなのかを言う、場や分野の名詞。「世界で唯一の」「業界で最も」。
2
+ # 「費用で最大の効果」の「費用」のような手段の名詞は入れない。
3
+ id: superlative-realm
4
+ language: ja
5
+ entries:
6
+ - pattern: 世界
7
+ - pattern: 国内
8
+ - pattern: 海外
9
+ - pattern: 業界
10
+ - pattern: 社内
11
+ - pattern: 県内
12
+ - pattern: 市内
13
+ - pattern: 都内
14
+ - pattern: 史上
@@ -0,0 +1,6 @@
1
+ # 誰にとっての最もなのかを言う語。同じ節(読点を挟まない)で最上級より前にあれば、範囲が書かれている
2
+ # (俺にとって今日は最高のクリスマスだ)。
3
+ id: superlative-viewpoint
4
+ language: ja
5
+ entries:
6
+ - pattern: にとって
@@ -0,0 +1,13 @@
1
+ # 前の文が言った場面や行いをまるごと受けて文を始める語(PDFが送れない。そんなときの対処法を…/…と書いて送る。これだけで…)。
2
+ # no-mixed-desumasu が、この語で始まる文のすぐ前の常体の文を、場面を差し出す書き出しとして指さない(数には入れる)。
3
+ # 文の頭の語をつないで照らすので、「これだけ」は「これ」「だけ」と分かれていても当たる。
4
+ # 「これ」「その」だけでは前の文の一部を受けることが多く、書き損じた常体の文の後ろにも来るので入れない。
5
+ id: takeup-opener
6
+ language: ja
7
+ entries:
8
+ - pattern: そんな
9
+ - pattern: こんな
10
+ - pattern: そういう
11
+ - pattern: こういう
12
+ - pattern: これだけ
13
+ - pattern: それだけ
@@ -0,0 +1,12 @@
1
+ # 引用した言葉を、誰がいつ言ったかを名指す語。「申し込んだら、「…」と言われています」「業者から「…」と言われている」の
2
+ # 「と言われている」は、名前の無い大勢の説ではなく、その場で相手から言われた言葉。weasel-word はこの形の言い回しを指さない。
3
+ # group: occasion は引用より前のどこかにあれば、言われた場面を名指す(〜たら、・〜ところ、)。group: sayer は引用の直前に
4
+ # あれば、言った人を名指す(業者から「)。
5
+ id: telling-cue
6
+ language: ja
7
+ entries:
8
+ - { pattern: たら、, group: occasion }
9
+ - { pattern: だら、, group: occasion }
10
+ - { pattern: ところ、, group: occasion }
11
+ - { pattern: から, group: sayer }
12
+ - { pattern: より, group: sayer }
@@ -0,0 +1,32 @@
1
+ # 教科書どおりの提案書・報告書の節。見出しがこの語で始まれば、その組に数えます。本物の提案書にも 1 つ 2 つはあるので、
2
+ # ai-structure は 4 つの組がそろったときに定型の構成として数えます。
3
+ id: template-heading
4
+ language: ja
5
+ entries:
6
+ - { pattern: 概要, group: summary }
7
+ - { pattern: 要旨, group: summary }
8
+ - { pattern: 背景, group: background }
9
+ - { pattern: 提案の背景, group: background }
10
+ - { pattern: 現状, group: background }
11
+ - { pattern: 現状と課題, group: background }
12
+ - { pattern: 現状の課題, group: background }
13
+ - { pattern: 提案, group: proposal }
14
+ - { pattern: 提案内容, group: proposal }
15
+ - { pattern: 解決策, group: proposal }
16
+ - { pattern: 期待される効果, group: benefits }
17
+ - { pattern: 導入効果, group: benefits }
18
+ - { pattern: 効果, group: benefits }
19
+ - { pattern: 費用, group: costs }
20
+ - { pattern: コスト, group: costs }
21
+ - { pattern: 予算, group: costs }
22
+ - { pattern: スケジュール, group: implementation }
23
+ - { pattern: 導入スケジュール, group: implementation }
24
+ - { pattern: 実施計画, group: implementation }
25
+ - { pattern: 導入計画, group: implementation }
26
+ - { pattern: リスク, group: risks }
27
+ - { pattern: リスクと対策, group: risks }
28
+ - { pattern: 懸念点, group: risks }
29
+ - { pattern: 今後の進め方, group: next }
30
+ - { pattern: 今後の対応, group: next }
31
+ - { pattern: 今後の予定, group: next }
32
+ - { pattern: まとめ, group: next }
@@ -0,0 +1,11 @@
1
+ # 語の前に置いて、その語の意味がどこで決まっているかを言う言葉(措置法69条の3所定の小規模宅地等、同法2条に規定する事業者)。
2
+ # この言葉に続く語は、出どころを示して書いた所なので、後で同じ語を定義しても、定義より前の使用に数えない(use-before-definition)。
3
+ id: term-source-marker
4
+ language: ja
5
+ entries:
6
+ - pattern: 所定の
7
+ - pattern: に規定する
8
+ - pattern: に規定される
9
+ - pattern: に規定された
10
+ - pattern: に定める
11
+ - pattern: に定められた
@@ -0,0 +1,11 @@
1
+ # ショートメッセージでキーワードを送る動詞(text GNPCGS to 333111)。動詞と短い番号の間の大文字は、そのまま打ち込む
2
+ # キーワードで、展開を待つ略語ではない。英文の案内をそのまま載せた文書のために、英語の動詞を置く。大小を問わずに照らす。
3
+ id: text-message-verb
4
+ language: ja
5
+ entries:
6
+ - pattern: text
7
+ - pattern: texts
8
+ - pattern: texting
9
+ - pattern: txt
10
+ - pattern: reply
11
+ - pattern: replying
@@ -2,7 +2,12 @@
2
2
  # 題の置き方(括弧の中身を閉じる、すぐ後ろに補いの括弧が付く、文がその連なりだけ、見出しにある)をしていれば、
3
3
  # 書き手が選んだ複合語ではなく、変えられない名前(大阪市鶴見区役所公募型比較見積実施要綱、国家公務員中途採用者選考試験)。
4
4
  # 閉じる語は語の切れ目で始まり、前に 2 字以上の語が要る(解決方法の「法」、本事業は当たらない)。
5
- # 文の中で使っただけの連なり(情報処理推進機構認定試験の受験者)は、文書のどこかで題として置かれていなければ数える。
5
+ # 文の中で使っただけの連なり(情報処理推進機構認定試験の受験者)は、文書のどこかで題として置かれているか、
6
+ # 文書の中で同じ連なりを繰り返していなければ数える。法令・制度・給付の名前は、置き方を問わない fixed-name-ending にもある。
7
+ # 一覧は、ファイルへのリンクに付く書類の題の名前(電子化手数料対象書類一覧(PDF:397KB))、
8
+ # 会合・会同・演習・訓練・窓口は催しや受け付けの名前(G7仙台科学技術大臣会合、自衛隊高級幹部会同、緊急災害現地対策本部運営訓練、区役所就学事務担当窓口)、
9
+ # 地震は法令や気象庁が名付けた地震の名前(日本海溝・千島海溝周辺海溝型地震)、
10
+ # 戦略・基金・審議会・協議会・機構は計画や機関の名前(保険契約者保護機構)。
6
11
  id: title-ending
7
12
  language: ja
8
13
  entries:
@@ -32,3 +37,15 @@ entries:
32
37
  - pattern: 届出書
33
38
  - pattern: 報告書
34
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: 機構
@@ -0,0 +1,11 @@
1
+ # 述語のすぐ後ろに付いて、主題(〜は)の節を閉じる言い回し。topic-predicate-distance が読む。
2
+ # 「学校は地域の核となることから、…」「気持ちはしっかり受け止めつつ、…」のように、主題から言い回しまでに別の主語(〜が、〜は、
3
+ # 〜ことは)が無く、後ろに読点が続くとき、主題の述語はこの節にある。後ろの節は別のもの(国、書き手、読み手)について言う。
4
+ # 理由の「ため」「ので」は、目的の「ため」や主題が最後まで続く文(〜を把握するため、…を公表している)と見分けられないので入れない。
5
+ id: topic-clause-close
6
+ language: ja
7
+ entries:
8
+ - pattern: ことから
9
+ - pattern: つつ
10
+ - pattern: としても
11
+ - pattern: こととし
@@ -44,3 +44,6 @@ entries:
44
44
  - pattern: 序文
45
45
  - pattern: References
46
46
  - pattern: Abstract
47
+ # 見出しにした図と表の題(「図 データモデル」「表1 費用」)。本文の節ではないので番号の並びに入らない。
48
+ - pattern: 図
49
+ - pattern: 表
@@ -0,0 +1,99 @@
1
+ # 誰も言っていない前提を打ち消して終わる文。group は unprompted-denial.ts の読み方:
2
+ # end 文がこの語で閉じれば打ち消し(〜の話ではありません、〜材料になりません、〜の余地がありません)
3
+ # exempt end の直前にあれば数えない語。「だけではない」は足し算、「べきではない」は禁止、「簡単ではない」は評価、
4
+ # 「この限りではない」は決まった言い回しで、前提の打ち消しではない
5
+ # basis 同じ文にあれば数えない語。理由を添えた打ち消しは事実を言っている
6
+ # reason 文がこの語で閉じれば、basis を見ない。「性能が同じだから並ぶのではありません」は理由そのものを打ち消している
7
+ # premise 前の文にあれば数えない語。打ち消す相手(〜と思うかもしれません)が文書の中にある
8
+ # question 前の文がこの語で閉じれば数えない(問いに答える打ち消し)
9
+ id: unprompted-denial
10
+ language: ja
11
+ entries:
12
+ - pattern: ではありません
13
+ group: end
14
+ - pattern: ではない
15
+ group: end
16
+ - pattern: じゃありません
17
+ group: end
18
+ - pattern: じゃない
19
+ group: end
20
+ - pattern: ではないのです
21
+ group: end
22
+ - pattern: ではないんです
23
+ group: end
24
+ - pattern: になりません
25
+ group: end
26
+ - pattern: にはなりません
27
+ group: end
28
+ - pattern: にならない
29
+ group: end
30
+ - pattern: にはならない
31
+ group: end
32
+ - pattern: 余地がありません
33
+ group: end
34
+ - pattern: 余地はありません
35
+ group: end
36
+ - pattern: 余地がない
37
+ group: end
38
+ - pattern: 余地はない
39
+ group: end
40
+ - pattern: だけ
41
+ group: exempt
42
+ - pattern: ばかり
43
+ group: exempt
44
+ - pattern: のみ
45
+ group: exempt
46
+ - pattern: べき
47
+ group: exempt
48
+ - pattern: 簡単
49
+ group: exempt
50
+ - pattern: 容易
51
+ group: exempt
52
+ - pattern: 明確
53
+ group: exempt
54
+ - pattern: 適切
55
+ group: exempt
56
+ - pattern: 十分
57
+ group: exempt
58
+ - pattern: 過言
59
+ group: exempt
60
+ - pattern: ゼロ
61
+ group: exempt
62
+ - pattern: 限り
63
+ group: exempt
64
+ - pattern: ので
65
+ group: basis
66
+ - pattern: ため
67
+ group: basis
68
+ - pattern: から
69
+ group: basis
70
+ - pattern: により
71
+ group: basis
72
+ - pattern: によって
73
+ group: basis
74
+ - pattern: 以上、
75
+ group: basis
76
+ - pattern: のではありません
77
+ group: reason
78
+ - pattern: のではない
79
+ group: reason
80
+ - pattern: と思う
81
+ group: premise
82
+ - pattern: と思わ
83
+ group: premise
84
+ - pattern: と思い
85
+ group: premise
86
+ - pattern: と考え
87
+ group: premise
88
+ - pattern: と言われ
89
+ group: premise
90
+ - pattern: といわれ
91
+ group: premise
92
+ - pattern: かもしれ
93
+ group: premise
94
+ - pattern: と感じ
95
+ group: premise
96
+ - pattern: と誤解
97
+ group: premise
98
+ - pattern: か
99
+ group: question
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chaffjs/lang-ja",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "description": "Japanese language adapter for chaff",
5
5
  "license": "MIT",
6
6
  "author": "isamu",
@@ -4,7 +4,8 @@
4
4
  * 漢字だけなら含んでよい(英文の中の「東京」)。仮名があれば和文の一部と読む。
5
5
  */
6
6
  const KANA = /[\p{Script=Hiragana}\p{Script=Katakana}]/u;
7
- const LATIN = /\p{Script=Latin}/gu;
7
+ /** 全角の英字(TEL)は和文の組み方で、英文は使わない。英字に数えない。 */
8
+ const LATIN = /(?![A-Za-z])\p{Script=Latin}/gu;
8
9
  const LETTER = /\p{L}/gu;
9
10
  // 英文の文末。閉じ括弧・引用符が続いてよい。断片の末尾だけを見る。
10
11
  const ENGLISH_STOP_AT_END = /[.?!][)\]"'”’]{0,3}$/u;
package/src/index.ts CHANGED
@@ -5,8 +5,10 @@ import { isEnglishBoundary, isEnglishRun } from "./english-run.ts";
5
5
  import { unmarkNumberStops } from "./number-stop.ts";
6
6
  import { pairMixedWidthBrackets } from "./mixed-width-bracket.ts";
7
7
  import { labelStops, unmarkLabelStops } from "./label-stop.ts";
8
+ import { initialStops, unmarkInitialStops } from "./initial-stop.ts";
8
9
  import { splitAtQuotedStops } from "./quoted-stop.ts";
9
10
  import { reattachClosingQuotes } from "./closing-quote.ts";
11
+ import { splitAtQuotedLineEnds } from "./quoted-line-stop.ts";
10
12
  import { insideBrackets, startsWithCloser } from "./inside-brackets.ts";
11
13
  import { structure } from "./structure.ts";
12
14
  import { cutAtBreaks, lineVocabulary, listItemHeads, listLineBreaks, startsListItem } from "./list-line.ts";
@@ -105,15 +107,19 @@ const patternsOf = (id: string): string[] => (LEXICONS[id] ?? []).map((entry) =>
105
107
  const LINE_VOCABULARY = lineVocabulary(patternsOf("numbering-counter"), patternsOf("line-head-tag"));
106
108
 
107
109
  const LABEL_STOPS = labelStops((LEXICONS["abbreviated-label"] ?? []).map((entry) => entry.pattern));
110
+ const INITIAL_STOPS = initialStops(
111
+ (LEXICONS["sentence-start-word"] ?? []).map((entry) => entry.pattern),
112
+ (LEXICONS["prepositive-abbreviation"] ?? []).map((entry) => entry.pattern),
113
+ );
108
114
 
109
115
  /**
110
116
  * 英語のアダプタと同じ手当てを英文にも当てる。番号の前の略した名前(FIG. 1)の点で切らず、
111
117
  * 英文の閉じ引用符の内側の句点で切り、文頭に取り残された閉じ引用符を前の文へ戻す。
112
118
  */
113
119
  const spansOf = (text: string): Span[] => {
114
- const spans = sentenceSpans(pairMixedWidthBrackets(unmarkNumberStops(unmarkLabelStops(text, LABEL_STOPS))));
120
+ const spans = sentenceSpans(pairMixedWidthBrackets(unmarkInitialStops(unmarkNumberStops(unmarkLabelStops(text, LABEL_STOPS)), INITIAL_STOPS)));
115
121
  const quotedStops = spans.flatMap((span) => (isEnglishRun(text.slice(span.start, span.end)) ? splitAtQuotedStops(text, span) : [span]));
116
- return reattachClosingQuotes(text, quotedStops);
122
+ return reattachClosingQuotes(text, quotedStops).flatMap((span) => splitAtQuotedLineEnds(text, span));
117
123
  };
118
124
 
119
125
  export const adapter: LanguageAdapter = {
@@ -0,0 +1,58 @@
1
+ // lang-en/src/initial-stop.ts の写し。アダプタは互いに依存しないので、和文の中の英文に同じ手当てをするために置く。元とのずれは test_mixed_language_stops.ts で比べる。
2
+ import { escapeRegExp } from "./regexp.ts";
3
+
4
+ /**
5
+ * sentence-splitter reads a capital and a full stop as an initial and never ends a sentence there: "Regulation C. The
6
+ * Guide applies" and "Appendix B. In 2020 …" were one sentence. It also ends a sentence after an abbreviation such as
7
+ * "U.S." before any capital, so "the U.S. Census Bureau" was two. Both are decided by the word after the full stop:
8
+ * - capitals with full stops (C., D.C.) before a sentence-start-word (The, In) end the sentence. Their capitals are
9
+ * replaced with a plain letter, which the splitter does not read as an initial;
10
+ * - a prepositive abbreviation (U.S.) before any other capitalised word does not end it, unless a comma follows that
11
+ * word ("in the U.S. Yesterday, …"). Its last full stop is replaced with a letter;
12
+ * - capitals with full stops (J., U.K.) before a word in lower case ("J. meacham", "Hart, K. and J. Reed") do not end
13
+ * it, since no sentence opens in lower case. A word that is lower case only at its head (iPhone) may be a name that
14
+ * opens one, so it is left out. Their last full stop is replaced with a letter.
15
+ * The length does not change, so the spans fit the original text. Initials first on their line are a list's labels
16
+ * (A. The first item) and are left as they are.
17
+ */
18
+
19
+ export type InitialStops = { readonly ends: RegExp | undefined; readonly joins: RegExp | undefined };
20
+
21
+ const EDGE_BEFORE = String.raw`(?<![\p{L}\p{N}_.'’])`;
22
+ const WORD_END = String.raw`(?![\p{L}\p{N}_.'’-])`;
23
+ const PLAIN_LETTER = "n";
24
+ const CAPITAL = /\p{Lu}/gu;
25
+ const BEFORE_LOWER_CASE = new RegExp(String.raw`${EDGE_BEFORE}(?:\p{Lu}\.){1,3}(?=[ \t\r\n]+\p{Ll}(?!\p{Lu}))`, "gu");
26
+
27
+ const oneOf = (words: readonly string[]): string => `(?:${words.map(escapeRegExp).join("|")})`;
28
+
29
+ /** Built once from the lexicons. */
30
+ export const initialStops = (startWords: readonly string[], prepositive: readonly string[]): InitialStops => {
31
+ if (startWords.length === 0) return { ends: undefined, joins: undefined };
32
+ const start = String.raw`\s+${oneOf(startWords)}${WORD_END}`;
33
+ const ends = new RegExp(String.raw`${EDGE_BEFORE}(?:\p{Lu}\.){1,3}(?=${start})`, "gu");
34
+ if (prepositive.length === 0) return { ends, joins: undefined };
35
+ return { ends, joins: new RegExp(String.raw`${EDGE_BEFORE}${oneOf(prepositive)}(?=\s+\p{Lu})(?!${start})(?!\s+\p{Lu}\p{L}*,)`, "gu") };
36
+ };
37
+
38
+ /** Only a list's marker, or nothing, before the initials on their line (A. The first item; - B. The second item). */
39
+ const LABEL_HEAD = /^[ \t]*(?:[-*+•][ \t]+)?$/u;
40
+
41
+ const lineStartOf = (text: string, index: number): number => Math.max(text.lastIndexOf("\n", index - 1), text.lastIndexOf("\r", index - 1)) + 1;
42
+
43
+ const isFirstOnLine = (text: string, index: number): boolean => LABEL_HEAD.test(text.slice(lineStartOf(text, index), index));
44
+
45
+ const withoutLastStop = (abbreviation: string): string => `${abbreviation.slice(0, -1)}${PLAIN_LETTER}`;
46
+
47
+ /** Initials before a word in lower case, not first on their line (a list's label stays as it is), rewritten. */
48
+ const joinedBeforeLowerCase = (text: string): string =>
49
+ text.replace(BEFORE_LOWER_CASE, (initials: string, index: number) => (isFirstOnLine(text, index) ? initials : withoutLastStop(initials)));
50
+
51
+ /** The text with every initial that ends a sentence, and every prepositive abbreviation or initial that does not, rewritten. */
52
+ export const unmarkInitialStops = (text: string, stops: InitialStops): string => {
53
+ const ended =
54
+ stops.ends === undefined
55
+ ? text
56
+ : text.replace(stops.ends, (initials: string, index: number) => (isFirstOnLine(text, index) ? initials : initials.replace(CAPITAL, PLAIN_LETTER)));
57
+ return joinedBeforeLowerCase(stops.joins === undefined ? ended : ended.replace(stops.joins, withoutLastStop));
58
+ };