diff --git a/text/packages/chaff/rules/max-kanji-continuous.yaml b/text/packages/chaff/rules/max-kanji-continuous.yaml index 22a2830f5..37b7c1ddb 100644 --- a/text/packages/chaff/rules/max-kanji-continuous.yaml +++ b/text/packages/chaff/rules/max-kanji-continuous.yaml @@ -19,7 +19,7 @@ uses: [pos] # (児童相談所虐待対応ダイヤル / 189)も同じに読み、文の中ではその名前の後ろで割る。法令の題(〜に関する法律)を囲む括弧の中の連なりも数えない。 # 文書が単独で使う法令・制度の名前(政治資金規正法)と、法令が名に取った語(愛玩動物看護師法の「愛玩動物看護師」)は、連なりの中でも割る。 # 職名(kanji-known-word)のすぐ前か後ろの人の姓と名も割る。元号の付いた年(令和元年)と、仮名へ続く接続の語の漢字(及び の「及」)は外す。 -# 連なりの中ほどの list-suffix(高齢運転者等専用駐車区間の「等」)は語の終わりを見せるので、そこでも割る。range-suffix(以外、以上)も同じに読む。 +# 連なりの中ほどの list-suffix(高齢運転者等専用駐車区間の「等」)は語の終わりを見せるので、そこでも割る。range-suffix(以外、以上)と breakdown-suffix(年齢階級別の「別」)も同じに読む。 # 中ほどの reference-prefix(苗関連事業当連結会計年度の「当」)は語の頭を見せるので、そこでも割る。 # すぐ後ろに designation-phrase(として認定)が続く連なりは、制度が決めた区分の名前なので数えない。 # 文を閉じる印の無い一行が notice-title-ending(お知らせ、ご案内、議題の「について」)で終われば、その行の連なりは送り手が付けた題の名前なので数えない。 @@ -40,6 +40,7 @@ extra_word_lists: reference-prefix, list-suffix, range-suffix, + breakdown-suffix, kanji-known-word, designation-phrase, notice-title-ending, @@ -99,8 +100,8 @@ example: after: 来週、新しい顧客を増やす施策を話し合う会議を開きます。 not_flagged: - ja: 組織の正式名称(国立研究開発法人産業技術総合研究所、経済産業省製造産業局自動車課、東日本青葉自動車販売株式会社)、字の半分以上が地名・組織名・人名でできた名前(東北地方太平洋沖地震、阪神淡路大震災)、題の名前(要綱・試験・事業・法令などで終わり、一行だけで書くか括弧でくくるか見出しにあるか、文書の中で繰り返すもの。大阪市鶴見区役所公募型比較見積実施要綱など)、法令・制度・給付・基金・指定区域の名前(住民基本台帳法施行令、勤労者財産形成貯蓄制度、社会資本整備総合交付金、地域医療介護総合確保基金、特定復興再生拠点区域。文のどこにあっても)、chaff.yaml の names に書いた組織名や製品名、法令の条番号(第二十二条第二項、学校教育法第三十条第二項の「第三十条第二項」)は数えません。空白を挟んで法人格か組織の区切りの後ろに立つ組織の名前(一般社団法人 全国〜センター、〜局 〜課 〜係)と、鉤括弧の中身が漢字の連なりとカタカナや英数字の語だけの名前(「登録業者情報検索入力ページ」)と、語のすぐ後ろの丸括弧を埋める言い換えや展開(EBITDA+(減価償却他調整前営業利益)、修士の学位(大学院修士課程修了程度))も数えません。頭の、前を指す語(上記、当該)と代の序数(第百二代、初代)と漢数字の日付(令和七年六月二十三日、令和元年)、尻の「等」と範囲を示す語(自動車保険契約以外の「以外」、基準以上の「以上」)と、仮名へ続く接続の語の漢字(方針及び基本構想の「及」)は数えません。連なりの中ほどの「等」と範囲を示す語(高齢運転者等専用駐車区間、関係者以外立入禁止)は語の終わりを、前を指す語(見出しと文が一行に詰まった 苗関連事業当連結会計年度の「当」)は語の頭を見せるので、その前と後ろを別に数えます。文書のどこかで括弧でまるごとくくった名前(「署名用電子証明書確認画面」、[当事者系審判請求人])と、番号や内容の行の上に一行で置いた名前(児童相談所虐待対応ダイヤルの下に 189)は文の中で使っても数えず、法令の題を囲む括弧((〜に関する法律))の中の連なりも数えません。文書が単独で使う法令の名前(政治資金規正法)と法令が名に取った語(愛玩動物看護師法の「愛玩動物看護師」)、職名のすぐ前か後ろの人の姓と名(小泉純一郎内閣総理大臣、内閣総理大臣石破茂)は、連なりを割ります。序数で始まる組織の単位(方式審査室第三担当、東京電力福島第一原子力発電所)と、中黒の後ろで組織の語で閉じる名前の前半(社会保障審議会企業年金・個人年金部会の「社会保障審議会企業年金」)も数えません。頭の地名や固有名詞で始まる組織の名前(国連安全保障理事会改革の「国連安全保障理事会」、東京電力福島第一原子力発電所事故の「東京電力福島第一原子力発電所」)、文書がほかで単独で使う組織や書式の名前(安全保障理事会常任理事国の「安全保障理事会」、提供依頼申出書作成説明会の「提供依頼申出書」)、連なりを閉じる決まった語(日本国内閣総理大臣の「内閣総理大臣」、〜許可事業者、〜検討会委員の「委員」)は、その前後を別の連なりとして数えます。用語集(headword_genres)の、一行が漢字の連なりだけの見出し語は数えません。出席者の並び(区長、副区長、〜委員会事務局長)のように文で終わらない名前の並びの項目は、宛名と同じく、組織の名前の後ろの役職を数えません。注の中の文献の記述(著者. 題. 出版者, 2025, p. 369.)は、引いた文献の題と名前なので数えません。二重鉤括弧でくくった作品や碑の題の中の連なり(『原爆犠牲国民学校教師と子どもの碑』)も、引いた題なので数えません(鉤括弧の中の二重鉤括弧は引用の中の引用なので数えます)。尻の漢数字の数と助数詞(国交正常化六十周年の「六十周年」)と、皇族の敬称(秋篠宮皇嗣同妃両殿下の「両殿下」)は、その前を別に数えます。連なりの中の漢数字の番地(中央通北二丁目地区再開発事業の「二丁目」)は、算用数字と同じく連なりを割り、その前と後ろを別に数えます。 - en: A name made mostly of place, organisation and person names (東北地方太平洋沖地震, 阪神淡路大震災) is not counted. Official organisation names (a legal form or a place name followed by a name that ends in a unit such as 研究所 or 協会, or a chain of units such as 省・局・課, or a name with a proper noun closed by a legal form such as 株式会社), titles of named things (a run ending in 要綱, 試験, 事業, 法 and the like that stands on a line of its own, closes a bracket, is followed by a bracketed note, appears in a heading, or recurs in the document), names of statutes, schemes, grants, funds and designated zones wherever they stand (住民基本台帳法施行令, 勤労者財産形成貯蓄制度, 社会資本整備総合交付金, 地域医療介護総合確保基金, 特定復興再生拠点区域), names listed under names in chaff.yaml, and provision numbers in statutes (第二十二条第二項, and 第三十条第二項 after the statute name in 学校教育法第三十条第二項) are not counted. Nor is an organisation name that follows a legal form or an organisation unit across a space (一般社団法人 全国〜センター, 〜局 〜課 〜係), or a name in 「」 made of the kanji run and words with no kanji or hiragana (「登録業者情報検索入力ページ」), or a run that fills the round brackets right after a word, restating or expanding it (EBITDA+(減価償却他調整前営業利益), 修士の学位(大学院修士課程修了程度)). A leading word that points back or ahead (上記, 当該), a leading ordinal (第百二代, 初代), a leading date in kanji numerals (令和七年六月二十三日, 令和元年), a trailing 等 or a word that marks a range (以外 in 自動車保険契約以外, 以上 in 基準以上), and the kanji of a conjunction that continues in kana (及 in 方針及び基本構想) are not counted. A 等 or a range word in the middle of a run (高齢運転者等専用駐車区間, 関係者以外立入禁止) shows where a word ends, and a word that points back (当 in 苗関連事業当連結会計年度, a heading run into its sentence) shows where one starts, so what is before and after it is counted apart. A name the document puts whole in brackets somewhere (「署名用電子証明書確認画面」, [当事者系審判請求人]), or writes as a line of its own above a number or other lines (児童相談所虐待対応ダイヤル above 189), is not counted where it is used in a sentence either, nor is a run inside the brackets around a statute's title ((〜に関する法律)). A statute name the document uses on its own (政治資金規正法), the term a statute is named after (愛玩動物看護師 in 愛玩動物看護師法), and a person's full name right before or after an official title (小泉純一郎内閣総理大臣, 内閣総理大臣石破茂) split the run. Nor is an organisation unit that starts with an ordinal (方式審査室第三担当, 東京電力福島第一原子力発電所), or the first half of an organisation name that continues after a ・ and closes in an organisation unit (社会保障審議会企業年金 in 社会保障審議会企業年金・個人年金部会). An organisation name that starts the run and holds a proper noun (国連安全保障理事会 in 国連安全保障理事会改革, 東京電力福島第一原子力発電所 in 東京電力福島第一原子力発電所事故), an organisation or form name the document uses on its own elsewhere (安全保障理事会 in 安全保障理事会常任理事国, 提供依頼申出書 in 提供依頼申出書作成説明会), and a fixed word that closes the run (内閣総理大臣 in 日本国内閣総理大臣, 〜許可事業者, 委員 in 〜検討会委員) split the run, and what is before and after them is counted apart. In a glossary (headword_genres), a line that holds only a run of kanji is the headword and is not counted. In a list of names with no sentence end (an attendee list such as 区長、副区長、〜委員会事務局長), the title after an organisation name in an item is not counted, as in an addressee line. A bibliographic entry in a note (著者. 題. 出版者, 2025, p. 369.) holds the cited work's titles and names, and is not counted. Nor is a run inside 『』, which holds the title of a cited work or monument (『原爆犠牲国民学校教師と子どもの碑』); 『』 inside 「」 is a quotation within a quotation and is counted. A trailing quantity in kanji numerals with its counter (六十周年 in 国交正常化六十周年) and an imperial honorific (両殿下 in 秋篠宮皇嗣同妃両殿下) split the run, and what is before them is counted on its own. A block number in kanji numerals inside a run (二丁目 in 中央通北二丁目地区再開発事業) splits the run as Arabic numerals would, and what is before and after it is counted apart. + ja: 組織の正式名称(国立研究開発法人産業技術総合研究所、経済産業省製造産業局自動車課、東日本青葉自動車販売株式会社)、字の半分以上が地名・組織名・人名でできた名前(東北地方太平洋沖地震、阪神淡路大震災)、題の名前(要綱・試験・事業・法令などで終わり、一行だけで書くか括弧でくくるか見出しにあるか、文書の中で繰り返すもの。大阪市鶴見区役所公募型比較見積実施要綱など)、法令・制度・給付・基金・指定区域の名前(住民基本台帳法施行令、勤労者財産形成貯蓄制度、社会資本整備総合交付金、地域医療介護総合確保基金、特定復興再生拠点区域。文のどこにあっても)、chaff.yaml の names に書いた組織名や製品名、法令の条番号(第二十二条第二項、学校教育法第三十条第二項の「第三十条第二項」)は数えません。空白を挟んで法人格か組織の区切りの後ろに立つ組織の名前(一般社団法人 全国〜センター、〜局 〜課 〜係)と、鉤括弧の中身が漢字の連なりとカタカナや英数字の語だけの名前(「登録業者情報検索入力ページ」)と、語のすぐ後ろの丸括弧を埋める言い換えや展開(EBITDA+(減価償却他調整前営業利益)、修士の学位(大学院修士課程修了程度))も数えません。頭の、前を指す語(上記、当該)と代の序数(第百二代、初代)と漢数字の日付(令和七年六月二十三日、令和元年)、尻の「等」と範囲を示す語(自動車保険契約以外の「以外」、基準以上の「以上」)と、仮名へ続く接続の語の漢字(方針及び基本構想の「及」)は数えません。連なりの中ほどの「等」と範囲を示す語と分けることを示す「別」(高齢運転者等専用駐車区間、関係者以外立入禁止、年齢階級別消費支出額)は語の終わりを、前を指す語(見出しと文が一行に詰まった 苗関連事業当連結会計年度の「当」)は語の頭を見せるので、その前と後ろを別に数えます。文書のどこかで括弧でまるごとくくった名前(「署名用電子証明書確認画面」、[当事者系審判請求人])と、番号や内容の行の上に一行で置いた名前(児童相談所虐待対応ダイヤルの下に 189)は文の中で使っても数えず、法令の題を囲む括弧((〜に関する法律))の中の連なりも数えません。文書が単独で使う法令の名前(政治資金規正法)と法令が名に取った語(愛玩動物看護師法の「愛玩動物看護師」)、職名のすぐ前か後ろの人の姓と名(小泉純一郎内閣総理大臣、内閣総理大臣石破茂)は、連なりを割ります。序数で始まる組織の単位(方式審査室第三担当、東京電力福島第一原子力発電所)と、中黒の後ろで組織の語で閉じる名前の前半(社会保障審議会企業年金・個人年金部会の「社会保障審議会企業年金」)も数えません。頭の地名や固有名詞で始まる組織の名前(国連安全保障理事会改革の「国連安全保障理事会」、東京電力福島第一原子力発電所事故の「東京電力福島第一原子力発電所」)、文書がほかで単独で使う組織や書式の名前(安全保障理事会常任理事国の「安全保障理事会」、提供依頼申出書作成説明会の「提供依頼申出書」)、連なりを閉じる決まった語(日本国内閣総理大臣の「内閣総理大臣」、〜許可事業者、〜検討会委員の「委員」)は、その前後を別の連なりとして数えます。用語集(headword_genres)の、一行が漢字の連なりだけの見出し語は数えません。出席者の並び(区長、副区長、〜委員会事務局長)のように文で終わらない名前の並びの項目は、宛名と同じく、組織の名前の後ろの役職を数えません。注の中の文献の記述(著者. 題. 出版者, 2025, p. 369.)は、引いた文献の題と名前なので数えません。二重鉤括弧でくくった作品や碑の題の中の連なり(『原爆犠牲国民学校教師と子どもの碑』)も、引いた題なので数えません(鉤括弧の中の二重鉤括弧は引用の中の引用なので数えます)。尻の漢数字の数と助数詞(国交正常化六十周年の「六十周年」)と、皇族の敬称(秋篠宮皇嗣同妃両殿下の「両殿下」)は、その前を別に数えます。連なりの中の漢数字の番地(中央通北二丁目地区再開発事業の「二丁目」)は、算用数字と同じく連なりを割り、その前と後ろを別に数えます。 + en: A name made mostly of place, organisation and person names (東北地方太平洋沖地震, 阪神淡路大震災) is not counted. Official organisation names (a legal form or a place name followed by a name that ends in a unit such as 研究所 or 協会, or a chain of units such as 省・局・課, or a name with a proper noun closed by a legal form such as 株式会社), titles of named things (a run ending in 要綱, 試験, 事業, 法 and the like that stands on a line of its own, closes a bracket, is followed by a bracketed note, appears in a heading, or recurs in the document), names of statutes, schemes, grants, funds and designated zones wherever they stand (住民基本台帳法施行令, 勤労者財産形成貯蓄制度, 社会資本整備総合交付金, 地域医療介護総合確保基金, 特定復興再生拠点区域), names listed under names in chaff.yaml, and provision numbers in statutes (第二十二条第二項, and 第三十条第二項 after the statute name in 学校教育法第三十条第二項) are not counted. Nor is an organisation name that follows a legal form or an organisation unit across a space (一般社団法人 全国〜センター, 〜局 〜課 〜係), or a name in 「」 made of the kanji run and words with no kanji or hiragana (「登録業者情報検索入力ページ」), or a run that fills the round brackets right after a word, restating or expanding it (EBITDA+(減価償却他調整前営業利益), 修士の学位(大学院修士課程修了程度)). A leading word that points back or ahead (上記, 当該), a leading ordinal (第百二代, 初代), a leading date in kanji numerals (令和七年六月二十三日, 令和元年), a trailing 等 or a word that marks a range (以外 in 自動車保険契約以外, 以上 in 基準以上), and the kanji of a conjunction that continues in kana (及 in 方針及び基本構想) are not counted. A 等, a range word or a 別 that breaks things down in the middle of a run (高齢運転者等専用駐車区間, 関係者以外立入禁止, 年齢階級別消費支出額) shows where a word ends, and a word that points back (当 in 苗関連事業当連結会計年度, a heading run into its sentence) shows where one starts, so what is before and after it is counted apart. A name the document puts whole in brackets somewhere (「署名用電子証明書確認画面」, [当事者系審判請求人]), or writes as a line of its own above a number or other lines (児童相談所虐待対応ダイヤル above 189), is not counted where it is used in a sentence either, nor is a run inside the brackets around a statute's title ((〜に関する法律)). A statute name the document uses on its own (政治資金規正法), the term a statute is named after (愛玩動物看護師 in 愛玩動物看護師法), and a person's full name right before or after an official title (小泉純一郎内閣総理大臣, 内閣総理大臣石破茂) split the run. Nor is an organisation unit that starts with an ordinal (方式審査室第三担当, 東京電力福島第一原子力発電所), or the first half of an organisation name that continues after a ・ and closes in an organisation unit (社会保障審議会企業年金 in 社会保障審議会企業年金・個人年金部会). An organisation name that starts the run and holds a proper noun (国連安全保障理事会 in 国連安全保障理事会改革, 東京電力福島第一原子力発電所 in 東京電力福島第一原子力発電所事故), an organisation or form name the document uses on its own elsewhere (安全保障理事会 in 安全保障理事会常任理事国, 提供依頼申出書 in 提供依頼申出書作成説明会), and a fixed word that closes the run (内閣総理大臣 in 日本国内閣総理大臣, 〜許可事業者, 委員 in 〜検討会委員) split the run, and what is before and after them is counted apart. In a glossary (headword_genres), a line that holds only a run of kanji is the headword and is not counted. In a list of names with no sentence end (an attendee list such as 区長、副区長、〜委員会事務局長), the title after an organisation name in an item is not counted, as in an addressee line. A bibliographic entry in a note (著者. 題. 出版者, 2025, p. 369.) holds the cited work's titles and names, and is not counted. Nor is a run inside 『』, which holds the title of a cited work or monument (『原爆犠牲国民学校教師と子どもの碑』); 『』 inside 「」 is a quotation within a quotation and is counted. A trailing quantity in kanji numerals with its counter (六十周年 in 国交正常化六十周年) and an imperial honorific (両殿下 in 秋篠宮皇嗣同妃両殿下) split the run, and what is before them is counted on its own. A block number in kanji numerals inside a run (二丁目 in 中央通北二丁目地区再開発事業) splits the run as Arabic numerals would, and what is before and after it is counted apart. level_meaning: ja: 漢字の連続 {limit} 字まで en: up to {limit} kanji in a row diff --git a/text/packages/chaff/src/detectors/char-shape.ts b/text/packages/chaff/src/detectors/char-shape.ts index 3b93d823e..83d3c658c 100644 --- a/text/packages/chaff/src/detectors/char-shape.ts +++ b/text/packages/chaff/src/detectors/char-shape.ts @@ -370,7 +370,7 @@ const nameWordsOf = (doc: ProseDocument): NameWords => { addressee: patterns("addressee-suffix"), addressees: { prefixes: patterns("addressee-prefix"), titles: patterns("addressee-title"), endings: organisation.units, forms: organisation.closingForms }, references: patterns("reference-prefix"), - listSuffixes: [...patterns("list-suffix"), ...patterns("range-suffix")], + listSuffixes: [...patterns("list-suffix"), ...patterns("range-suffix"), ...patterns("breakdown-suffix")], blockUnits: patterns("address-block-unit"), knownWords: new Set(patterns("kanji-known-word")), designations: patterns("designation-phrase"), diff --git a/text/packages/lang-ja/lexicons/breakdown-suffix.yaml b/text/packages/lang-ja/lexicons/breakdown-suffix.yaml new file mode 100644 index 000000000..e920b30b1 --- /dev/null +++ b/text/packages/lang-ja/lexicons/breakdown-suffix.yaml @@ -0,0 +1,7 @@ +# 名詞の後ろに付き、その名詞ごとに分けることを示す語(年齢階級別、都道府県別)。 +# max-kanji-continuous は、等(list-suffix)と同じに読む。漢字の連なりの尻にあり、解析が語の切れ目で分けたときは数えず、 +# 連なりの中ほどにあれば(年齢階級別消費支出額)、語の終わりを見せるのでそこで割る。特別、区別のように一語の中の「別」は、解析が分けないので割らない。 +id: breakdown-suffix +language: ja +entries: + - pattern: 別 diff --git a/text/test/test_kanji_inner_suffix.ts b/text/test/test_kanji_inner_suffix.ts index c64bdecae..f7e679fe5 100644 --- a/text/test/test_kanji_inner_suffix.ts +++ b/text/test/test_kanji_inner_suffix.ts @@ -57,3 +57,19 @@ describe("max-kanji-continuous: 範囲の端や除くものを示す語(以外 assert.deepEqual(kanjiWords("内閣総理大臣就任以来、取り組んできた。\n"), ["内閣総理大臣就任以来"]); }); }); + +describe("max-kanji-continuous: 分けることを示す語(別)", () => { + before(async () => { + await ja.prepare?.({ pos: true }); + }); + + it("valid: 連なりの中ほどの「別」は語の終わりを見せるので、前後を別に数える", () => { + assert.deepEqual(kanjiWords("世帯主の年齢階級別消費支出額を加重平均した。\n"), []); + assert.deepEqual(kanjiWords("都道府県別市区町村別人口推計値を示す。\n"), []); + }); + + it("invalid: 「別」の後ろが上限を超えるものと、一語の中の「別」(特別)は数える", () => { + assert.deepEqual(kanjiWords("地域別新規顧客獲得施策検討会議を開いた。\n"), ["新規顧客獲得施策検討会議"]); + assert.deepEqual(kanjiWords("特別地方消費税交付金研究会議を開いた。\n"), ["特別地方消費税交付金研究会議"]); + }); +});