Skip to content

Commit 806052f

Browse files
committed
短歌に「()()」があればふりがなも一緒に出力したと判定して失敗判定
1 parent d6a7d7c commit 806052f

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: backend/src/lib/gemini.ts

+10
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,16 @@ const generateTanka = async (originalText: string): Promise<string[]> => {
116116
const count = validChars.length;
117117
// console.log('count: ', count);
118118

119+
// 短歌に「()()」があればふりがなも一緒に出力したと判定してfalseを返す
120+
if (
121+
line.includes('(') ||
122+
line.includes(')') ||
123+
line.includes('(') ||
124+
line.includes(')')
125+
) {
126+
return false;
127+
}
128+
119129
// 文字数をカウント(アルファベット(全角、半角)、ひらがな、カタカナ、漢字を1文字としてカウント)
120130
return Math.abs(count - expectedCharaCount[index]) <= 1; // 1文字分までの誤差は許容
121131
});

0 commit comments

Comments
 (0)