@chaffjs/lang-ja 0.33.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.
- package/dist/citation.d.ts.map +1 -1
- package/dist/citation.js +22 -1
- package/dist/citation.js.map +1 -1
- package/dist/english-list-line.d.ts +6 -0
- package/dist/english-list-line.d.ts.map +1 -0
- package/dist/english-list-line.js +91 -0
- package/dist/english-list-line.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/index.js.map +1 -1
- package/dist/list-line.d.ts +12 -0
- package/dist/list-line.d.ts.map +1 -0
- package/dist/list-line.js +82 -0
- package/dist/list-line.js.map +1 -0
- package/dist/mixed-width-bracket.d.ts +3 -0
- package/dist/mixed-width-bracket.d.ts.map +1 -0
- package/dist/mixed-width-bracket.js +18 -0
- package/dist/mixed-width-bracket.js.map +1 -0
- package/lexicons/addressee-suffix.yaml +8 -0
- package/lexicons/advice-ending.yaml +8 -0
- package/lexicons/any-year-marker.yaml +22 -1
- package/lexicons/breakdown-partial-word.yaml +7 -0
- package/lexicons/capital-phrase.yaml +7 -0
- package/lexicons/carrier-name.yaml +11 -0
- package/lexicons/citation-series.yaml +11 -0
- package/lexicons/common-acronym.yaml +9 -0
- package/lexicons/company-form-latin.yaml +20 -0
- package/lexicons/comparative-baseline.yaml +21 -1
- package/lexicons/compound-slip-ignored.yaml +13 -0
- package/lexicons/count-title.yaml +13 -0
- package/lexicons/date-stamp-label.yaml +1 -0
- package/lexicons/dated-pair-label.yaml +6 -0
- package/lexicons/dated-pair-version-word.yaml +6 -0
- package/lexicons/definition-alternative.yaml +6 -0
- package/lexicons/duration-per-period.yaml +17 -0
- package/lexicons/figure-scale-joiner.yaml +8 -0
- package/lexicons/figure-scale-word.yaml +11 -0
- package/lexicons/headline-ending.yaml +9 -0
- package/lexicons/known-misspelling.yaml +23 -0
- package/lexicons/latin-bound-suffix.yaml +10 -0
- package/lexicons/latin-joiner.yaml +10 -0
- package/lexicons/legal-form.yaml +27 -0
- package/lexicons/list-note-lead.yaml +8 -0
- package/lexicons/literal-quote-cue.yaml +22 -0
- package/lexicons/memo-header-label.yaml +8 -0
- package/lexicons/mention-cue.yaml +11 -0
- package/lexicons/misconversion.yaml +13 -0
- package/lexicons/nado-closed-list.yaml +4 -0
- package/lexicons/nakaguro-word.yaml +13 -0
- package/lexicons/name-determiner.yaml +25 -0
- package/lexicons/name-prefix.yaml +7 -0
- package/lexicons/named-deadline.yaml +34 -0
- package/lexicons/negation-word.yaml +1 -1
- package/lexicons/notice-phrase.yaml +15 -0
- package/lexicons/organisation-form.yaml +41 -0
- package/lexicons/organisation-unit.yaml +68 -0
- package/lexicons/orthographic-variant-conjunction.yaml +13 -0
- package/lexicons/orthographic-variant-distinct.yaml +8 -0
- package/lexicons/orthographic-variant-idiom.yaml +14 -0
- package/lexicons/orthographic-variant-phrase-suffix.yaml +9 -0
- package/lexicons/orthographic-variant-whole-word.yaml +17 -0
- package/lexicons/page-marker.yaml +6 -0
- package/lexicons/parallel-definition.yaml +25 -0
- package/lexicons/particle-run-break.yaml +23 -0
- package/lexicons/person-other-sense.yaml +6 -0
- package/lexicons/placeholder-word.yaml +14 -0
- package/lexicons/reference-label.yaml +9 -0
- package/lexicons/request-condition.yaml +6 -0
- package/lexicons/request-contact.yaml +16 -0
- package/lexicons/request-deadline.yaml +2 -0
- package/lexicons/request-invitation.yaml +15 -0
- package/lexicons/request-owner.yaml +3 -0
- package/lexicons/request-timing.yaml +16 -0
- package/lexicons/requirement-open-condition.yaml +9 -0
- package/lexicons/requirement-open-end.yaml +21 -0
- package/lexicons/requirement-open-question.yaml +18 -0
- package/lexicons/rounded-amount-unit.yaml +13 -0
- package/lexicons/self-prefix.yaml +1 -0
- package/lexicons/stated-deadline.yaml +4 -0
- package/lexicons/street-suffix.yaml +16 -0
- package/lexicons/tax-code.yaml +6 -0
- package/lexicons/teki-fixed-term.yaml +12 -0
- package/lexicons/timed-pair-label.yaml +11 -0
- package/lexicons/title-ending.yaml +34 -0
- package/lexicons/translationese.yaml +5 -0
- package/lexicons/unnumbered-heading.yaml +18 -0
- package/lexicons/vague-deadline.yaml +1 -0
- package/package.json +1 -1
- package/src/citation.ts +23 -1
- package/src/english-list-line.ts +106 -0
- package/src/index.ts +13 -2
- package/src/list-line.ts +99 -0
- package/src/mixed-width-bracket.ts +19 -0
|
@@ -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: ":="
|
|
@@ -38,3 +38,17 @@ entries:
|
|
|
38
38
|
# group: instruction — 丸括弧の中の、書き手に向けた指示の書き出し((ここに会社名を書く))。丸括弧は、ほかの語では空欄と数えない。
|
|
39
39
|
- pattern: ここに
|
|
40
40
|
group: instruction
|
|
41
|
+
# group: template — 見出しにあれば、その節が雛形だと言う語(「## 雛形」「# 記入例」)。
|
|
42
|
+
# その見出しの下(同じ深さか浅い次の見出しまで)の空欄は雛形の役目なので数えない。
|
|
43
|
+
- pattern: 雛形
|
|
44
|
+
group: template
|
|
45
|
+
- pattern: ひな形
|
|
46
|
+
group: template
|
|
47
|
+
- pattern: ひながた
|
|
48
|
+
group: template
|
|
49
|
+
- pattern: テンプレート
|
|
50
|
+
group: template
|
|
51
|
+
- pattern: 記入例
|
|
52
|
+
group: template
|
|
53
|
+
- pattern: 文例
|
|
54
|
+
group: template
|
|
@@ -124,3 +124,12 @@ entries:
|
|
|
124
124
|
- { pattern: 会員IDは, group: member }
|
|
125
125
|
- { pattern: お客様番号, group: customer }
|
|
126
126
|
- { pattern: お客様番号は, group: customer }
|
|
127
|
+
# 障害報告書のインシデントの番号。管理番号は何の番号にも付く語なので、インシデント番号とは別の group にする。
|
|
128
|
+
- { pattern: インシデント番号, group: incident }
|
|
129
|
+
- { pattern: インシデント番号は, group: incident }
|
|
130
|
+
- { pattern: インシデントID, group: incident }
|
|
131
|
+
- { pattern: インシデントIDは, group: incident }
|
|
132
|
+
- { pattern: 障害番号, group: incident }
|
|
133
|
+
- { pattern: 障害番号は, group: incident }
|
|
134
|
+
- { pattern: 管理番号, group: control }
|
|
135
|
+
- { pattern: 管理番号は, group: control }
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 連絡先の行の札(「電話:」「ファックス番号:」)。後ろにコロンが続くときだけ数える。その行と同じ文の依頼は、連絡の手段の案内。
|
|
2
|
+
id: request-contact
|
|
3
|
+
language: ja
|
|
4
|
+
entries:
|
|
5
|
+
- pattern: 電話
|
|
6
|
+
- pattern: 電話番号
|
|
7
|
+
- pattern: tel
|
|
8
|
+
- pattern: ファックス
|
|
9
|
+
- pattern: ファックス番号
|
|
10
|
+
- pattern: ファクス
|
|
11
|
+
- pattern: fax
|
|
12
|
+
- pattern: fax番号
|
|
13
|
+
- pattern: メール
|
|
14
|
+
- pattern: メールアドレス
|
|
15
|
+
- pattern: e-mail
|
|
16
|
+
- pattern: email
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# 誘いの動詞。依頼の終わりの直前にあれば(「ご相談ください」「お越しください」)、来るかどうかは読み手しだいで、済ませる仕事ではない。
|
|
2
|
+
id: request-invitation
|
|
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: ご活用
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 依頼の文の中で、ほかの出来事を基準にいつするかを言う語(「ご提出いただく前に」「送信後、」「提出時に」)。
|
|
2
|
+
# 期限の日付が無くても、いつするかは決まっている。依頼の文そのものにあるときだけ数える(次の文の「その後、」は別の話)。
|
|
3
|
+
id: request-timing
|
|
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: 初めに
|
|
@@ -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
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# 番地と通りの名前の後ろに大文字で略して書く、通りの種類(512 Bayshore DR)。その位置でだけ見る。字面どおりに照らす。
|
|
2
|
+
id: street-suffix
|
|
3
|
+
language: ja
|
|
4
|
+
entries:
|
|
5
|
+
- pattern: "DR"
|
|
6
|
+
- pattern: "ST"
|
|
7
|
+
- pattern: "AVE"
|
|
8
|
+
- pattern: "BLVD"
|
|
9
|
+
- pattern: "RD"
|
|
10
|
+
- pattern: "LN"
|
|
11
|
+
- pattern: "CT"
|
|
12
|
+
- pattern: "PKWY"
|
|
13
|
+
- pattern: "HWY"
|
|
14
|
+
- pattern: "PL"
|
|
15
|
+
- pattern: "SQ"
|
|
16
|
+
- pattern: "TER"
|
|
@@ -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: 実質的支配者
|
|
@@ -69,3 +69,14 @@ entries:
|
|
|
69
69
|
- { pattern: "閉宴時間", group: banquet, position: after }
|
|
70
70
|
- { pattern: "閉宴時刻", group: banquet, position: after }
|
|
71
71
|
- { pattern: "お開き", group: banquet, position: after }
|
|
72
|
+
# 障害の報告。障害が起きてから、それに気づく。「復旧」は入れない。気づく前に戻っていた障害もある。
|
|
73
|
+
- { pattern: "発生", group: incident, position: before }
|
|
74
|
+
- { pattern: "発生時刻", group: incident, position: before }
|
|
75
|
+
- { pattern: "発生時間", group: incident, position: before }
|
|
76
|
+
- { pattern: "障害発生", group: incident, position: before }
|
|
77
|
+
- { pattern: "障害発生時刻", group: incident, position: before }
|
|
78
|
+
- { pattern: "検知", group: incident, position: after }
|
|
79
|
+
- { pattern: "検知時刻", group: incident, position: after }
|
|
80
|
+
- { pattern: "検知時間", group: incident, position: after }
|
|
81
|
+
- { pattern: "障害検知", group: incident, position: after }
|
|
82
|
+
- { pattern: "障害検知時刻", group: incident, position: after }
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# 題の付いたもの(要綱・法令・事業・制度・試験・計画・補助金・届け出の書式)の名前を閉じる語。漢字の連なりがこれで終わり、
|
|
2
|
+
# 題の置き方(括弧の中身を閉じる、すぐ後ろに補いの括弧が付く、文がその連なりだけ、見出しにある)をしていれば、
|
|
3
|
+
# 書き手が選んだ複合語ではなく、変えられない名前(大阪市鶴見区役所公募型比較見積実施要綱、国家公務員中途採用者選考試験)。
|
|
4
|
+
# 閉じる語は語の切れ目で始まり、前に 2 字以上の語が要る(解決方法の「法」、本事業は当たらない)。
|
|
5
|
+
# 文の中で使っただけの連なり(情報処理推進機構認定試験の受験者)は、文書のどこかで題として置かれていなければ数える。
|
|
6
|
+
id: title-ending
|
|
7
|
+
language: ja
|
|
8
|
+
entries:
|
|
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: 証明書
|
|
@@ -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: 最後に
|
|
@@ -21,6 +21,24 @@ entries:
|
|
|
21
21
|
- pattern: 変更履歴
|
|
22
22
|
- pattern: 更新履歴
|
|
23
23
|
- pattern: 改訂履歴
|
|
24
|
+
# 文書の末尾に置く連絡先(報道発表の「担当」「お問い合わせ先」)。
|
|
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
|
+
# 官公庁の報道発表が使う「照会先」。
|
|
41
|
+
- pattern: 照会先
|
|
24
42
|
- pattern: はしがき
|
|
25
43
|
- pattern: あとがき
|
|
26
44
|
- pattern: 序文
|
package/package.json
CHANGED
package/src/citation.ts
CHANGED
|
@@ -74,10 +74,32 @@ export const namedDocument = (text: string, reference: number, vocabulary: Citat
|
|
|
74
74
|
return { name, self };
|
|
75
75
|
};
|
|
76
76
|
|
|
77
|
+
/** 名前と番地のあいだの空白(「就業規則 第25条」)。 */
|
|
78
|
+
const SPACE_CHARS: ReadonlySet<string> = new Set([" ", "\t", "\u3000"]);
|
|
79
|
+
/** 名前と番地のあいだに置かれうる空白の長さ。後ろ向きに読む長さを抑える。 */
|
|
80
|
+
const MAX_SPACES = 4;
|
|
81
|
+
|
|
82
|
+
const spacesBefore = (text: string, at: number): number => {
|
|
83
|
+
let count = 0;
|
|
84
|
+
while (count < MAX_SPACES && SPACE_CHARS.has(text[at - count - 1] ?? "")) count += 1;
|
|
85
|
+
return count;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 空白を挟んで前に書かれた文書の名前(「就業規則 第25条」の就業規則)。空白を挟むと番地が名前の一部か分からないので、
|
|
90
|
+
* 種類の語で終わる名前だけを読む。この文書を指す名前(「本規則 第3条」)は名前にしない。
|
|
91
|
+
*/
|
|
92
|
+
const spacedName = (text: string, reference: number, vocabulary: CitationVocabulary): string | undefined => {
|
|
93
|
+
const spaces = spacesBefore(text, reference);
|
|
94
|
+
const named = spaces === 0 ? undefined : namedDocument(text, reference - spaces, vocabulary);
|
|
95
|
+
return named === undefined || named.self || !endsWithKind(named.name, vocabulary.kinds) ? undefined : named.name;
|
|
96
|
+
};
|
|
97
|
+
|
|
77
98
|
/** reference の直前に書かれた他の文書の名前。この文書を指すか、名前が無ければ undefined。 */
|
|
78
99
|
export const citedDocument = (text: string, reference: number, vocabulary: CitationVocabulary): string | undefined => {
|
|
79
100
|
const named = namedDocument(text, reference, vocabulary);
|
|
80
|
-
|
|
101
|
+
if (named !== undefined) return named.self ? undefined : named.name;
|
|
102
|
+
return spacedName(text, reference, vocabulary);
|
|
81
103
|
};
|
|
82
104
|
|
|
83
105
|
/** 自分を指す頭の語の長さの上限(この・本・当)。後ろ向きに読む長さを抑える。 */
|
|
@@ -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
|
@@ -3,11 +3,14 @@ import { closesSentence } from "./sentence-close.ts";
|
|
|
3
3
|
import { sentenceSpans } from "./sentence-split.ts";
|
|
4
4
|
import { isEnglishBoundary, isEnglishRun } from "./english-run.ts";
|
|
5
5
|
import { unmarkNumberStops } from "./number-stop.ts";
|
|
6
|
+
import { pairMixedWidthBrackets } from "./mixed-width-bracket.ts";
|
|
6
7
|
import { labelStops, unmarkLabelStops } from "./label-stop.ts";
|
|
7
8
|
import { splitAtQuotedStops } from "./quoted-stop.ts";
|
|
8
9
|
import { reattachClosingQuotes } from "./closing-quote.ts";
|
|
9
10
|
import { insideBrackets, startsWithCloser } from "./inside-brackets.ts";
|
|
10
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";
|
|
11
14
|
import { isReady, predicateOnly, prepare, readsAsCounter, readsAsOneAdverb, readsAsOneWord, tokenize } from "./pos.ts";
|
|
12
15
|
import { markSpacedCounters } from "./spaced-counter.ts";
|
|
13
16
|
import { tokensWithin } from "./tokens-within.ts";
|
|
@@ -44,6 +47,8 @@ const LINE_BREAK = /[\n\r]/u;
|
|
|
44
47
|
|
|
45
48
|
const ENGLISH: EmbeddedLanguage = { id: "en", lengthUnit: "word" };
|
|
46
49
|
|
|
50
|
+
const asListItem = (sentence: Sentence): Sentence => ({ ...sentence, listItem: true });
|
|
51
|
+
|
|
47
52
|
const withLanguage = (text: string, span: Span): Sentence => (isEnglishRun(text) ? { span, text, embeddedLanguage: ENGLISH } : { span, text });
|
|
48
53
|
|
|
49
54
|
/**
|
|
@@ -52,6 +57,10 @@ const withLanguage = (text: string, span: Span): Sentence => (isEnglishRun(text)
|
|
|
52
57
|
*/
|
|
53
58
|
const merge = (source: string, spans: readonly Span[]): Sentence[] => {
|
|
54
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);
|
|
55
64
|
return spans
|
|
56
65
|
.reduce<Span[]>((acc, span) => {
|
|
57
66
|
const last = acc.at(-1);
|
|
@@ -64,7 +73,9 @@ const merge = (source: string, spans: readonly Span[]): Sentence[] => {
|
|
|
64
73
|
else acc.push(span);
|
|
65
74
|
return acc;
|
|
66
75
|
}, [])
|
|
67
|
-
.
|
|
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));
|
|
68
79
|
};
|
|
69
80
|
|
|
70
81
|
/**
|
|
@@ -97,7 +108,7 @@ const LABEL_STOPS = labelStops((LEXICONS["abbreviated-label"] ?? []).map((entry)
|
|
|
97
108
|
* 英文の閉じ引用符の内側の句点で切り、文頭に取り残された閉じ引用符を前の文へ戻す。
|
|
98
109
|
*/
|
|
99
110
|
const spansOf = (text: string): Span[] => {
|
|
100
|
-
const spans = sentenceSpans(unmarkNumberStops(unmarkLabelStops(text, LABEL_STOPS)));
|
|
111
|
+
const spans = sentenceSpans(pairMixedWidthBrackets(unmarkNumberStops(unmarkLabelStops(text, LABEL_STOPS))));
|
|
101
112
|
const quotedStops = spans.flatMap((span) => (isEnglishRun(text.slice(span.start, span.end)) ? splitAtQuotedStops(text, span) : [span]));
|
|
102
113
|
return reattachClosingQuotes(text, quotedStops);
|
|
103
114
|
};
|