-
Notifications
You must be signed in to change notification settings - Fork 3
Closed
Labels
Milestone
Description
From #6 (comment)
辞書のtokenに対して名前をつけて、オプションを指定できるようにする。
いくつかのtokenに対してはデフォルトで許可リストをもつ。
- 各辞書(tokenの集合)に対して
id
のような 名前をつける - ルールのオプションで、
id
に対して- その辞書を(
disable
、デフォルトfalse
)有効/無効化できるようにする(アップデートが大変な場合も多そうなので、マイグレーション的にON/OFFできるように) - その辞書で例外(
allow
、デフォルト[]
or["ソフトウェア"]
など)を指定できるようにする- オプションはJSONなので正規表現リテラルが使えないため、@textlint/regexp-string-matcherを使うと文字列で正規表現も扱える
- その辞書を(
Example
module.exports = [
{
id: "$1を実行",
message: `"$1を実行"は冗長な表現です。"$1する"など簡潔な表現にすると文章が明瞭になります。`,
url: "http://www.atmarkit.co.jp/ait/articles/1001/19/news106_2.html",
tokens: [
{
"pos": "名詞",
"pos_detail_1": "サ変接続",
"_capture": "$1"
},
{
"surface_form": "を",
"pos": "助詞",
"pos_detail_1": "格助詞",
"pos_detail_2": "一般",
"pos_detail_3": "*",
"conjugated_type": "*",
"conjugated_form": "*",
"basic_form": "を",
"reading": "ヲ",
"pronunciation": "ヲ"
},
{
"surface_form": "実行",
"pos": "名詞",
"pos_detail_1": "サ変接続",
"pos_detail_2": "*",
"pos_detail_3": "*",
"conjugated_type": "*",
"conjugated_form": "*",
"basic_form": "実行",
"reading": "ジッコウ",
"pronunciation": "ジッコー"
},
]
}
]
.textlintrc
:
{
"rules": {
"ja-no-redundant-expression": {
"dictionary": {
"$1を行う": {
"disable": true
},
"$1を実行": {
"allow": ["ソフトウェア"] // 含まれているなら無視
}
}
}
}
}