Skip to content

Commit ed638d3

Browse files
shirayuazu
authored andcommitted
feat(rule):「こと」「ある」「言え」の異表記に対応 (#10)
* Accept different surfaces of "こと" * Accept different surfaces of "ある" and "言え"
1 parent 882c2bb commit ed638d3

File tree

2 files changed

+43
-38
lines changed

2 files changed

+43
-38
lines changed

src/dictionary.js

Lines changed: 14 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
module.exports = [
44
{
55
// https://azu.github.io/morpheme-match/?text=省略(することが可能)。
6-
message: `"すること$3可能$1"は冗長な表現です。"すること$3可能"を省き簡潔な表現にすると文章が明瞭になります。`,
6+
message: `"する$2$3可能$1"は冗長な表現です。"する$2$3可能"を省き簡潔な表現にすると文章が明瞭になります。`,
77
url: "http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0",
88
tokens: [
99
{
@@ -18,16 +18,10 @@ module.exports = [
1818
"reading": "スル",
1919
"pronunciation": "スル"
2020
}, {
21-
"surface_form": "こと",
2221
"pos": "名詞",
23-
"pos_detail_1": "非自立",
24-
"pos_detail_2": "一般",
25-
"pos_detail_3": "*",
26-
"conjugated_type": "*",
27-
"conjugated_form": "*",
28-
"basic_form": "こと",
2922
"reading": "コト",
30-
"pronunciation": "コト"
23+
"_capture": "$2",
24+
"_readme": "こと",
3125
}, {
3226
"pos": "助詞",
3327
"_capture": "$3",
@@ -51,7 +45,7 @@ module.exports = [
5145
},
5246
{
5347
// https://azu.github.io/morpheme-match/?text=解析(することができます)。
54-
message: `"すること$3$1$2"は冗長な表現です。"すること$3"を省き簡潔な表現にすると文章が明瞭になります。`,
48+
message: `"する$4$3$1$2"は冗長な表現です。"する$4$3"を省き簡潔な表現にすると文章が明瞭になります。`,
5549
url: "http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0",
5650
expected: "$3$1$2",
5751
tokens: [
@@ -68,16 +62,10 @@ module.exports = [
6862
"pronunciation": "スル"
6963
},
7064
{
71-
"surface_form": "こと",
7265
"pos": "名詞",
73-
"pos_detail_1": "非自立",
74-
"pos_detail_2": "一般",
75-
"pos_detail_3": "*",
76-
"conjugated_type": "*",
77-
"conjugated_form": "*",
78-
"basic_form": "こと",
7966
"reading": "コト",
80-
"pronunciation": "コト"
67+
"_capture": "$4",
68+
"_readme": "こと",
8169
},
8270
{
8371
"pos": "助詞",
@@ -107,7 +95,7 @@ module.exports = [
10795
},
10896
{
10997
// https://azu.github.io/morpheme-match/?text=必要(であると言えます)
110-
message: `"であると言えます"は冗長な表現です。"である" または "と言えます"を省き簡潔な表現にすると文章が明瞭になります。`,
98+
message: `"で$1と$2ます"は冗長な表現です。"である" または "と言えます"を省き簡潔な表現にすると文章が明瞭になります。`,
11199
url: "http://www.sekaihaasobiba.com/entry/2014/10/24/204024",
112100
tokens: [
113101
{
@@ -123,16 +111,9 @@ module.exports = [
123111
"pronunciation": "デ"
124112
},
125113
{
126-
"surface_form": "ある",
127-
"pos": "助動詞",
128-
"pos_detail_1": "*",
129-
"pos_detail_2": "*",
130-
"pos_detail_3": "*",
131-
"conjugated_type": "五段・ラ行アル",
132-
"conjugated_form": "基本形",
133-
"basic_form": "ある",
134114
"reading": "アル",
135-
"pronunciation": "アル"
115+
"_capture": "$1",
116+
"_readme": "ある",
136117
},
137118
{
138119
"surface_form": "と",
@@ -154,7 +135,9 @@ module.exports = [
154135
"conjugated_type": "一段",
155136
"conjugated_form": "連用形",
156137
"reading": "イエ",
157-
"pronunciation": "イエ"
138+
"pronunciation": "イエ",
139+
"_capture": "$2",
140+
"_readme": "言え",
158141
},
159142
{
160143
"surface_form": "ます",
@@ -189,16 +172,9 @@ module.exports = [
189172
"pronunciation": "デ"
190173
},
191174
{
192-
"surface_form": "ある",
193-
"pos": "助動詞",
194-
"pos_detail_1": "*",
195-
"pos_detail_2": "*",
196-
"pos_detail_3": "*",
197-
"conjugated_type": "五段・ラ行アル",
198-
"conjugated_form": "基本形",
199-
"basic_form": "ある",
200175
"reading": "アル",
201-
"pronunciation": "アル"
176+
"_capture": "$1",
177+
"_readme": "ある",
202178
},
203179
{
204180
"surface_form": "と",

test/index-test.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ tester.run("textlint-rule-ja-no-redundant-expression", rule, {
3939
}
4040
]
4141
},
42+
{
43+
text: "これは省略する事は可能だ。",
44+
errors: [
45+
{
46+
message: `"する事は可能だ"は冗長な表現です。"する事は可能"を省き簡潔な表現にすると文章が明瞭になります。参考: http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0`,
47+
index: 5
48+
}
49+
]
50+
},
4251
{
4352
text: "これは省略することは可能だ。",
4453
errors: [
@@ -78,6 +87,17 @@ tester.run("textlint-rule-ja-no-redundant-expression", rule, {
7887
}
7988
]
8089
},
90+
{
91+
text: "解析する事はできますよ。",
92+
output: "解析はできますよ。",
93+
errors: [
94+
{
95+
message: `"する事はできます"は冗長な表現です。"する事は"を省き簡潔な表現にすると文章が明瞭になります。参考: http://qiita.com/takahi-i/items/a93dc2ff42af6b93f6e0`,
96+
index: 2
97+
}
98+
]
99+
},
100+
81101
{
82102
text: "解析することをできますよ。",
83103
output: "解析できますよ。",
@@ -97,6 +117,15 @@ tester.run("textlint-rule-ja-no-redundant-expression", rule, {
97117
}
98118
]
99119
},
120+
{
121+
text: "これは必要で有るといえます。",
122+
errors: [
123+
{
124+
message: `"で有るといえます"は冗長な表現です。"である" または "と言えます"を省き簡潔な表現にすると文章が明瞭になります。参考: http://www.sekaihaasobiba.com/entry/2014/10/24/204024`,
125+
index: 5
126+
}
127+
]
128+
},
100129
{
101130
text: "実験を行えば分かります。",
102131
errors: [

0 commit comments

Comments
 (0)