|
|
@ -525,6 +525,11 @@ public class AzureTtsHelper: NSObject, ITtsService { |
|
|
cleaned = regex.stringByReplacingMatches(in: cleaned, range: NSRange(location: 0, length: cleaned.count), withTemplate: "") |
|
|
cleaned = regex.stringByReplacingMatches(in: cleaned, range: NSRange(location: 0, length: cleaned.count), withTemplate: "") |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 移除标点符号 |
|
|
|
|
|
if let regex = try? NSRegularExpression(pattern: "[;:#;:*\\n]+", options: .caseInsensitive) { |
|
|
|
|
|
cleaned = regex.stringByReplacingMatches(in: cleaned, range: NSRange(location: 0, length: cleaned.count), withTemplate: "") |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 合并空格 |
|
|
// 合并空格 |
|
|
if let regex = try? NSRegularExpression(pattern: "\\s+", options: .caseInsensitive) { |
|
|
if let regex = try? NSRegularExpression(pattern: "\\s+", options: .caseInsensitive) { |
|
|
cleaned = regex.stringByReplacingMatches(in: cleaned, range: NSRange(location: 0, length: cleaned.count), withTemplate: " ") |
|
|
cleaned = regex.stringByReplacingMatches(in: cleaned, range: NSRange(location: 0, length: cleaned.count), withTemplate: " ") |
|
|
|