-
Notifications
You must be signed in to change notification settings - Fork 17
feat: add no-ai-colon-continuation rule with kuromojin morphological analysis #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…analysis - Implement new rule to detect English syntax patterns translated to Japanese - Use kuromojin for accurate part-of-speech analysis to distinguish nouns from predicates - Allow natural Japanese expressions like '使い方:' (noun + colon) - Detect unnatural patterns like '実行します:' (predicate + colon) - Support AST-based detection for Paragraph + block element combinations - Remove duplicate colon detection from ai-tech-writing-guideline rule - Add comprehensive test coverage for various patterns Fixes #16
- Add support for both half-width (:) and full-width (:) colons - Include conjunction detection (例えば: should be flagged) - Port original test cases from ai-tech-writing-guideline - Ensure proper colon character display in error messages - All tests now passing with comprehensive pattern coverage
- Remove redundant colon index calculation - Determine colon type once and reuse - Remove unused colonIndex variable - Keep clean and efficient implementation
PR #15 との関係についてPR #15 では、コロン + 箇条書きパターンの検出を無効化するオプションの追加を検討していましたが、今回の実装によりルール自体を分離したため、より柔軟な制御が可能になりました。 以前の課題
現在の解決策新しい {
"rules": {
"@textlint-ja/preset-ai-writing": {
"no-ai-colon-continuation": false,
"ai-tech-writing-guideline": true
}
}
} または個別設定も可能です。 {
"rules": {
"@textlint-ja/preset-ai-writing": {
"no-ai-colon-continuation": {
"disableCodeBlock": true,
"disableList": false
}
}
}
} |
azu
commented
Jul 5, 2025
azu
commented
Jul 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
READMEに説明をついかする必要がある
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
概要
no-ai-colon-continuation
を実装no-ai-colon-continuation
コロンの直後にブロック要素が続く英語的なパターンを検出します。日本語として自然な表現を促進するルールです。
このルールは形態素解析(kuromojin)を使用して、コロンの前の文が述語(動詞・形容詞・助動詞)で終わっているかを判定します。「使用方法:」のような名詞で終わる表現は自然な日本語として許可され、「実行します:」のような述語で終わる表現のみを検出します。
検出される例
より自然な日本語表現
実装詳細
主要機能
検出パターン
実行します:
+ CodeBlock/List/BlockQuote/Table → エラー(述語+コロン)説明します:
+ あらゆるブロック要素 → エラー(述語+コロン)例えば:
+ あらゆるブロック要素 → エラー(接続詞+コロン、機械的パターン)使い方:
+ あらゆるブロック要素 → OK(名詞+コロン)API仕様:
+ あらゆるブロック要素 → OK(名詞+コロン)検出される例:
+ あらゆるブロック要素 → OK(受動形、名詞的)検出する例:
+ あらゆるブロック要素 → OK(連体形+名詞、名詞的)関連Issue
Fixes #16
🤖 Generated with Claude Code