From b120eabe65f46dc014097576d81f8c2ad7b59758 Mon Sep 17 00:00:00 2001 From: tuna2134 Date: Tue, 10 Sep 2024 00:10:26 +0000 Subject: [PATCH] fix --- sbv2_core/src/norm.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sbv2_core/src/norm.rs b/sbv2_core/src/norm.rs index 681e18c..5139427 100644 --- a/sbv2_core/src/norm.rs +++ b/sbv2_core/src/norm.rs @@ -100,6 +100,16 @@ static PUNCTUATION_CLEANUP_PATTERN: Lazy = Lazy::new(|| { regex::Regex::new(&pattern).unwrap() }); +pub fn normalize_text(text: &str) -> String { + // 日本語のテキストを正規化する + let text = text.replace('~', "ー"); + let text = text.replace('~', "ー"); + + let text = text.replace('〜', "ー"); + + replace_punctuation(text) +} + pub fn replace_punctuation(mut text: String) -> String { for (k, v) in REPLACE_MAP.iter() { text = text.replace(k, v);