Add Japanese writing style rules to AI prompts for natural output#110
Conversation
blader/humanizer の25パターンを日本語に適用し、AI臭の強い表現を 抑制するルールを全プロンプト(生成・深掘り・ブラッシュアップ・ ドリルダウン)に組み込む。 主なルール: - 文末「です/ます」の3連続禁止、体言止め等でリズムに変化 - 硬い漢語動詞(実施/活用/推進等)を和語に置換 - AI定型表現(〜が重要です/〜が求められます)の禁止 - 接続詞連打・三点羅列・水増し修飾語の抑制 - 文の長さに変化をつけ、主語を自然に省略
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Caution Review failedPull request was closed or merged during review 📝 Walkthrough概要
変更内容
詩
推定コードレビュー時間🎯 2 (Simple) | ⏱️ ~10 分 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! このプルリクエストは、AIの日本語出力の品質を向上させることを目的としています。具体的には、AIが生成するテキストがより人間らしく、自然な日本語になるように、詳細な文体ルールと簡潔な文体ルールを導入し、既存の様々なAIプロンプトに適用しました。これにより、ブレインストーミングからアイデアの深掘り、ブラッシュアップに至るまで、一貫して高品質な日本語出力が期待されます。 Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces two sets of Japanese writing style rules, NATURAL_JP_RULES and NATURAL_JP_RULES_SHORT, to improve the naturalness of AI-generated output. These rules are integrated into various prompts for brainstorming, refinement, and deep-dives. The changes are clear and well-implemented. I have one suggestion to improve code organization by moving the new prompt-related constants to a more appropriate file.
| /** | ||
| * 日本語の自然さを高めるための文体ルール。 | ||
| * 参考: blader/humanizer の25パターン + 日本語特有のAI臭パターン排除。 | ||
| * @see https://zenn.dev/m0370/articles/205c9340a418c3 | ||
| */ | ||
| const NATURAL_JP_RULES = `【日本語の文体ルール(厳守)】 | ||
| (1) 文末の単調さ禁止: 「〜です。」「〜ます。」を3回以上連続させない。体言止め・「〜だろう」「〜ではないか」「〜と言える」「〜にほかならない」等を織り交ぜ、文末リズムに変化をつける | ||
| (2) 硬い漢語動詞の回避: 「実施する」「活用する」「推進する」「促進する」「醸成する」「構築する」のような硬い漢語動詞を多用しない。「やる」「使う」「進める」「広げる」「つくる」等の和語や平易な表現を優先する。漢語動詞は1段落に2語以内 | ||
| (3) AI定型表現の禁止: 以下の表現はAI臭が強いため使用禁止。「〜することが重要です」「〜が求められます」「〜する必要があります」→代わりに「〜がカギになる」「〜が効く」「〜しないと始まらない」等の具体的で断定的な言い回しを使う | ||
| (4) 接続詞の連打禁止: 「さらに」「また」「加えて」「それに加え」を2文連続で使わない。接続詞なしで文をつなげるか、「一方で」「ただし」「裏を返せば」等の転換系を挟む | ||
| (5) 三点羅列(ルールオブスリー)の抑制: 「A、B、Cの3つが重要」のような三点セットの羅列を多用しない。1つに絞って深く語るか、2つの対比で示す方が自然 | ||
| (6) 水増し修飾語の排除: 「非常に」「極めて」「大いに」「包括的に」「効果的に」「戦略的に」を安易に使わない。修飾するなら具体的な数値や事実で裏付ける | ||
| (7) 一文の長さに変化をつける: 短い文(〜20字)と長い文(40〜60字)を混在させる。全ての文が同じ長さだと機械的に見える | ||
| (8) 主語を省略する: 日本語では主語を毎文書く必要はない。「この施策は〜」「それによって〜」の連続を避け、自然に省略する`; | ||
|
|
||
| /** 深掘り・ブラッシュアップ用の簡易版日本語文体ルール */ | ||
| const NATURAL_JP_RULES_SHORT = `【日本語の文体ルール】 | ||
| - 「〜です。」「〜ます。」を3回以上連続させない。体言止めや「〜だろう」「〜と言える」等で文末リズムに変化をつける | ||
| - 「実施する」「活用する」「推進する」等の硬い漢語動詞を多用せず「やる」「使う」「進める」等の平易な表現を優先する | ||
| - 「〜することが重要です」「〜が求められます」はAI臭が強いため禁止。「〜がカギになる」「〜が効く」等の具体的な言い回しを使う | ||
| - 「さらに」「また」「加えて」を2文連続で使わない | ||
| - 「非常に」「極めて」「包括的に」「戦略的に」を安易に使わず、具体的事実で裏付ける | ||
| - 短い文と長い文を混在させ、主語は自然に省略する`; |
There was a problem hiding this comment.
These new constants for Japanese writing style rules are a great addition. For better code organization, consider moving them to src/constants/prompts.ts. This file already contains other prompt-related constants, and moving these would help keep the useAI.ts hook focused on logic rather than prompt definitions. You can then export them from prompts.ts and import them here.
There was a problem hiding this comment.
Pull request overview
This PR improves the naturalness of Japanese AI outputs by adding reusable “Japanese writing style rules” and injecting them into the main brainstorm and follow-up (refine/deep-dive/drill-down) prompts in useAI.
Changes:
- Added
NATURAL_JP_RULES(detailed) andNATURAL_JP_RULES_SHORT(condensed) prompt constants to guide more natural Japanese writing. - Integrated the detailed rules into the primary brainstorming prompt and the short rules into refine/deep-dive/drill-down prompts.
Comments suppressed due to low confidence (1)
src/hooks/useAI.ts:327
commonConditionsis built by joining items withjoin('。')and then embedded as a single paragraph under【前提条件】. Injecting the multi-lineNATURAL_JP_RULESblock into that sentence-joined list results in punctuation directly before the header (e.g....特定する。【日本語の文体ルール...】) and mixes structured, newline-heavy content into a。-delimited paragraph, which can reduce prompt clarity. Consider appendingNATURAL_JP_RULESas a separate section after【前提条件】(or change the join strategy for this element) so the rules remain a clearly delimited block.
'各アイデアの description には抽象的な方針だけでなく「例: 」で始まる具体的な行動例を1つ以上含める。IT専門用語やカタカナ業界用語は避け、現場担当者が「明日の朝一でこれをやる」とイメージできる粒度で書く。「最適化」「差別化」「戦略的」等の抽象語を使った場合は必ず直後に「(例: ○○を△△に変える)」と補足する',
'各アイデアには「なぜそれが有効か」のメカニズム(因果関係)を1文含める。「○○をすると→△△が変わり→結果として□□が改善する」の形式',
'【多様性】毎回異なる切り口で分析すること。前回と同じ結論に至りそうな場合は、あえて別の分析フレームワーク・別の優先課題・別の業界事例を起点にする。keyIssue と understanding は入力課題の組み合わせによって異なる根本原因を特定する',
NATURAL_JP_RULES,
compInstructions,
]
.filter(Boolean)
.join('。');
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR enhances the AI output quality by introducing comprehensive Japanese writing style rules to ensure more natural and human-like responses. Two rule sets are added: a detailed version for initial brainstorming and a concise version for refinement and deep-dive operations.
Key Changes
Added
NATURAL_JP_RULES: A comprehensive 8-point Japanese writing style guide covering:Added
NATURAL_JP_RULES_SHORT: A condensed version of the above rules for use in refinement and deep-dive promptsIntegrated rules into prompts:
NATURAL_JP_RULESto the main brainstorming prompt (line 323)NATURAL_JP_RULES_SHORTto the refinement prompt (line 620)NATURAL_JP_RULES_SHORTto the deep-dive prompt (line 844)NATURAL_JP_RULES_SHORTto the sub-idea decomposition prompt (line 919)Implementation Details
https://claude.ai/code/session_019MhgCZWy7pS7RrUwQx3dA4
Summary by CodeRabbit
リリースノート