Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions text/packages/chaff/rules/repeated-sentence-ending.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ example:
この機能は必要で、設定も簡単です。費用はかかりません。

not_flagged:
ja: 段落をまたいだ文は続きと見ません。助動詞で終わらない文(体言止め、言い切りの動詞)は比べず、そこで続きが切れます。動詞が違えば(読みました、書きました)同じ文末とは見ません。述語の前の語まで同じ締めの句を三文以上重ねた繰り返し(いい船でした。…いい船でした。…いい船でした。)は、一つと数えます。一つの文の中に「?」で並べた問い(これはリストか?順序付きか?…などです。)も比べません。違う語を同じ型で定義する文の並び(台風は〜を指します。ハリケーンは〜を指します。)は、型をそろえたものなので指しません。見出しの語([通信関連]、化学品事業……)で始まる文は新しい項目の始まりで、前の項目の文とは続きと見ません。変換で一文に平らになった表(数字のセルがつながったもの、単位の括弧で閉じる見出しのセルが並ぶもの)は、その後ろの注まで含めて書き手の文ではないので比べず、そこで続きが切れます。
en: Sentences in different paragraphs are not a run. A sentence that does not end with an auxiliary (a noun, a bare verb) is not compared and breaks the run. Different verbs (読みました, 書きました) are different endings. Three sentences or more in a row that close on the very same phrase, the word before the predicate included (いい船でした。…いい船でした。…いい船でした。), are a refrain and count once. Questions run together inside one sentence (これはリストか?順序付きか?…などです。) are not compared either. Sentences that each define a different term in the same frame (台風は〜を指します。ハリケーンは〜を指します。) share their ending on purpose and are not reported. A sentence that opens with a label ([通信関連], 化学品事業……) starts a new item of a list and does not continue the run before it. A table a converter flattened into one sentence (numbers of two cells run together, header cells each closed by a unit in brackets), with the note it runs into, is not the writer's sentence, so it is not compared and breaks the run.
ja: 段落をまたいだ文は続きと見ません。助動詞で終わらない文(体言止め、言い切りの動詞)は比べず、そこで続きが切れます。動詞が違えば(読みました、書きました)同じ文末とは見ません。述語の前の語まで同じ締めの句を三文以上重ねた繰り返し(いい船でした。…いい船でした。…いい船でした。)は、一つと数えます。一つの文の中に「?」で並べた問い(これはリストか?順序付きか?…などです。)も比べません。違う語を同じ型で定義する文の並び(台風は〜を指します。ハリケーンは〜を指します。)は、型をそろえたものなので指しません。見出しの語([通信関連]、化学品事業……)で始まる文は新しい項目の始まりで、前の項目の文とは続きと見ません。変換で一文に平らになった表(数字のセルがつながったもの、単位の括弧で閉じる見出しのセルが並ぶもの)は、その後ろの注まで含めて書き手の文ではないので比べず、そこで続きが切れます。平らになった表で始まる段落(最初の文が見出しの行)は、後ろの文も表の行がセルの中の句点で切れたものなので、段落ごと比べません。
en: Sentences in different paragraphs are not a run. A sentence that does not end with an auxiliary (a noun, a bare verb) is not compared and breaks the run. Different verbs (読みました, 書きました) are different endings. Three sentences or more in a row that close on the very same phrase, the word before the predicate included (いい船でした。…いい船でした。…いい船でした。), are a refrain and count once. Questions run together inside one sentence (これはリストか?順序付きか?…などです。) are not compared either. Sentences that each define a different term in the same frame (台風は〜を指します。ハリケーンは〜を指します。) share their ending on purpose and are not reported. A sentence that opens with a label ([通信関連], 化学品事業……) starts a new item of a list and does not continue the run before it. A table a converter flattened into one sentence (numbers of two cells run together, header cells each closed by a unit in brackets), with the note it runs into, is not the writer's sentence, so it is not compared and breaks the run. A paragraph that opens with such a table (its first sentence is the header row) holds the table's rows, cut only at the stops inside their cells, and is not compared at all.
level_meaning:
ja: 同じ文末の文が {limit} 文続くまで
en: up to {limit} {limit|sentence|sentences} in a row with the same ending
Expand Down
6 changes: 4 additions & 2 deletions text/packages/chaff/src/detectors/clause-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,14 @@ const runFinding = (run: readonly Ended[], limit: number): Finding => {

/**
* More than limit sentences in a row within one paragraph that end with the same words, unless they define different terms in one
* frame. A refrain (いい船でした。…いい船でした。) counts once.
* frame. A refrain (いい船でした。…いい船でした。) counts once. A paragraph that opens with a flattened table (its header row) holds
* the table's rows, cut at the stops inside their cells, not the writer's sentences, and is not read.
*/
export const endingRun: Detector = (doc, options): Finding[] => {
const words = definitionWordsOf(options.lexicon);
const eras = (doc.lexicons["calendar-era"] ?? []).map((entry) => entry.pattern);
return doc.paragraphs.flatMap((paragraph) =>
const prose = doc.paragraphs.filter((paragraph) => !isFlattenedTable(paragraph.sentences[0]?.text ?? "", eras));
return prose.flatMap((paragraph) =>
endingRuns(paragraph.sentences, eras)
.map((run) => ({ run, sentences: run.map(({ sentence }) => sentence) }))
.filter(({ sentences }) => beatsOf(sentences, patternsOf(options.lexicon, "being")) > options.limit && !isParallelDefinition(sentences, words))
Expand Down
6 changes: 6 additions & 0 deletions text/test/test_ja_clause_shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ describe("repeated-sentence-ending", () => {
"「〜であります」で終わる文が 3 文続いています(2 文まで)",
]);
});

it("見出しの行が単位の括弧で閉じる表を平らにした段落は、行のセルの文を続きと見ない(自作)", () => {
const table =
"【関係会社の状況】名称住所資本金(千円)議決権の所有割合(%)役員の兼任等(名)関係内容北海運送株式会社札幌市10,000物流事業90.001当社の荷物の運送を行っております。当社より倉庫の賃貸を受けております。南海不動産株式会社福岡市30,000不動産事業100.002当社の建物の管理を行っております。(注) 主要な事業の内容欄には、セグメントの名称を記載しております。\n";
assert.deepEqual(findingsOf(RULE, table), []);
});
});

describe("endingRuns", () => {
Expand Down
Loading