mirror of
https://github.com/mii443/AzooKeyKanaKanjiConverter.git
synced 2025-08-22 15:05:26 +00:00
Merge pull request #214 from azooKey/perf/parse_template_coarse_filer
This commit is contained in:
@ -107,6 +107,11 @@ public struct Candidate: Sendable {
|
||||
|
||||
/// テンプレートをパースして、変換候補のテキストを生成する。
|
||||
public static func parseTemplate(_ text: String) -> String {
|
||||
// MARK: Coarse Filtering: タグが入っていなければそもそも調べる必要なし
|
||||
guard text.contains("<") else {
|
||||
return text
|
||||
}
|
||||
// MARK: Fine Filtering: 正確にチェックする
|
||||
var newText = text
|
||||
while let range = newText.range(of: Self.dateExpression, options: .regularExpression) {
|
||||
let templateString = String(newText[range])
|
||||
|
Reference in New Issue
Block a user