Skip to content

Commit ff18839

Browse files
committed
fix(rule): fix comparison of minInterval
1 parent efcf04b commit ff18839

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,19 @@ MIT
6161
## Reference
6262

6363
- [Doubled Joshi Validator · Issue #460 · redpen-cc/redpen](https://github.com/redpen-cc/redpen/issues/460 "Doubled Joshi Validator · Issue #460 · redpen-cc/redpen")
64-
- [事象の構造から見る二重デ格構文の発生 ](https://www.ninjal.ac.jp/event/specialists/project-meeting/files/JCLWorkshop_no6_papers/JCLWorkshop_No6_01.pdf "JCLWorkshop_No6_01.pdf")
64+
- [事象の構造から見る二重デ格構文の発生 ](https://www.ninjal.ac.jp/event/specialists/project-meeting/files/JCLWorkshop_no6_papers/JCLWorkshop_No6_01.pdf "JCLWorkshop_No6_01.pdf")
65+
66+
67+
## 判定処理
68+
69+
ある助詞(かつ品詞細分類)が一致するものが、一定最低間隔値(距離)以下に書かれている場合を検出する。
70+
71+
[元ネタ](https://github.com/redpen-cc/redpen/issues/460 "Doubled Joshi Validator · Issue #460 · redpen-cc/redpen")は助詞が1文(センテンス)に2回以上でてきた際にエラーとしてる。
72+
73+
少し厳しすぎると感じたので、1文(センテンス)ではなく最低間隔値(距離)という概念を導入した
74+
75+
> この書籍はJavaScriptのライブラリやツールにおけるプラグインアーキテクチャを見ていく事を目的としたものです
76+
77+
この場合 "を" が最低間隔値2で並んでいるためエラーとするべき。
78+
79+
- [kuromoji.js demo](http://takuyaa.github.io/kuromoji.js/demo/tokenize.html "kuromoji.js demo")

src/no-doubled-joshi.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function (context, options = {}) {
6767
let otherPosition = joshiTokens.indexOf(current);
6868
// if difference
6969
let differenceIndex = otherPosition - startPosition;
70-
if (differenceIndex <= minInterval) {
70+
if (differenceIndex >= minInterval) {
7171
report(node, new RuleError(`一文に二回以上利用されている助詞 "${key}" がみつかりました。`, {
7272
line: sentence.loc.start.line - 1,
7373
// matchLastToken.word_position start with 1

0 commit comments

Comments
 (0)