Skip to content

Commit 6b32967

Browse files
moznionazu
authored andcommitted
fix(rule): Accept non-independent(非自立) verb that is previous of "たり" (#2)
Problem -- Valid sentence is treated as invalid; for example `利用方法を学習したり、実際に試してみたりすることができる環境です`. This example is analyzed as following; ``` [ { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 894860, word_type: 'KNOWN', surface_form: '利用', pos: '名詞', pos_detail_1: 'サ変接続', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '利用', reading: 'リヨウ', pronunciation: 'リヨー' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 1488950, word_type: 'KNOWN', surface_form: '方法', pos: '名詞', pos_detail_1: '一般', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '方法', reading: 'ホウホウ', pronunciation: 'ホーホー' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92880, word_type: 'KNOWN', surface_form: 'を', pos: '助詞', pos_detail_1: '格助詞', pos_detail_2: '一般', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'を', reading: 'ヲ', pronunciation: 'ヲ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 496210, word_type: 'KNOWN', surface_form: '学習', pos: '名詞', pos_detail_1: 'サ変接続', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '学習', reading: 'ガクシュウ', pronunciation: 'ガクシュー' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 3011810, word_type: 'KNOWN', surface_form: 'し', pos: '動詞', pos_detail_1: '自立', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: 'サ変・スル', conjugated_form: '連用形', basic_form: 'する', reading: 'シ', pronunciation: 'シ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92960, word_type: 'KNOWN', surface_form: 'たり', pos: '助詞', pos_detail_1: '並立助詞', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'たり', reading: 'タリ', pronunciation: 'タリ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 51340, word_type: 'KNOWN', surface_form: '、', pos: '名詞', pos_detail_1: '数', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '、', reading: '、', pronunciation: '、' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 2198950, word_type: 'KNOWN', surface_form: '実際', pos: '名詞', pos_detail_1: '一般', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '実際', reading: 'ジッサイ', pronunciation: 'ジッサイ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92030, word_type: 'KNOWN', surface_form: 'に', pos: '助詞', pos_detail_1: '格助詞', pos_detail_2: '一般', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'に', reading: 'ニ', pronunciation: 'ニ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 550320, word_type: 'KNOWN', surface_form: '試し', pos: '動詞', pos_detail_1: '自立', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '五段・サ行', conjugated_form: '連用形', basic_form: '試す', reading: 'タメシ', pronunciation: 'タメシ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92780, word_type: 'KNOWN', surface_form: 'て', pos: '助詞', pos_detail_1: '接続助詞', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'て', reading: 'テ', pronunciation: 'テ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 2943410, word_type: 'KNOWN', surface_form: 'み', pos: '動詞', pos_detail_1: '非自立', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '一段', conjugated_form: '連用形', basic_form: 'みる', reading: 'ミ', pronunciation: 'ミ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92960, word_type: 'KNOWN', surface_form: 'たり', pos: '助詞', pos_detail_1: '並立助詞', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'たり', reading: 'タリ', pronunciation: 'タリ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 3011740, word_type: 'KNOWN', surface_form: 'する', pos: '動詞', pos_detail_1: '自立', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: 'サ変・スル', conjugated_form: '基本形', basic_form: 'する', reading: 'スル', pronunciation: 'スル' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 63910, word_type: 'KNOWN', surface_form: 'こと', pos: '名詞', pos_detail_1: '非自立', pos_detail_2: '一般', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'こと', reading: 'コト', pronunciation: 'コト' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 92920, word_type: 'KNOWN', surface_form: 'が', pos: '助詞', pos_detail_1: '格助詞', pos_detail_2: '一般', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: 'が', reading: 'ガ', pronunciation: 'ガ' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 3370300, word_type: 'KNOWN', surface_form: 'できる', pos: '動詞', pos_detail_1: '自立', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '一段', conjugated_form: '基本形', basic_form: 'できる', reading: 'デキル', pronunciation: 'デキル' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 361770, word_type: 'KNOWN', surface_form: '環境', pos: '名詞', pos_detail_1: '一般', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '*', conjugated_form: '*', basic_form: '環境', reading: 'カンキョウ', pronunciation: 'カンキョー' } }, { type: 'WordNode', children: [ [Object] ], position: { start: [Object], end: [Object] }, data: { word_id: 23760, word_type: 'KNOWN', surface_form: 'です', pos: '助動詞', pos_detail_1: '*', pos_detail_2: '*', pos_detail_3: '*', conjugated_type: '特殊・デス', conjugated_form: '基本形', basic_form: 'です', reading: 'デス', pronunciation: 'デス' } } ] ``` The verb that is previous of "たり", that is only allowed independent (自立) verb. Solution -- Allow non-independent (非自立) verb.
1 parent 87a9ce8 commit 6b32967

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/textlint-rule-prefer-tari-tari.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const 動詞 = {
1111
type: "WordNode",
1212
data: {
1313
pos: "動詞",
14-
pos_detail_1: "自立"
14+
pos_detail_1: ["自立", "非自立"]
1515
}
1616
};
1717
const たり = {
@@ -83,9 +83,12 @@ const report = context => {
8383
// console.log(afterSuru.nodeList);
8484
report(
8585
node,
86-
new RuleError(`例示・並列・対表現において、片方の動詞が「〜たり」表現な場合は、もう片方の動詞も「〜たり」とします。`, {
87-
index: source.originalIndexFromIndex(afterSuru.position.index)
88-
})
86+
new RuleError(
87+
`例示・並列・対表現において、片方の動詞が「〜たり」表現な場合は、もう片方の動詞も「〜たり」とします。`,
88+
{
89+
index: source.originalIndexFromIndex(afterSuru.position.index)
90+
}
91+
)
8992
);
9093
}
9194
});

test/textlint-rule-prefer-tari-tari-test.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ tester.run("textlint-rule-prefer-tari-tari", rule, {
3939
"白一色になった畠の中に散在する農家はプレハブ住宅であったり茅葺きであったりした",
4040
"薄暗い階段や廊下では観客が食べたり呑んだりしている",
4141
"高かったりまずかったりする",
42+
"利用方法を学習したり、実際に試してみたりすることができる環境です",
4243
// "たり" があるが続ける必要がないパターン
4344
"お前あんまり変なことに関わり合ったりしない方がいいよ",
4445
"ジョークが言えなくても、せめて怒ったりするな。理屈っぽいこと言うな。",

0 commit comments

Comments
 (0)