From be0142a481bbe7c0ffa1227b32d118b6a9a0aac8 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 20 Jun 2022 09:25:09 +0800 Subject: [PATCH] LMCoreEX // Fix the method of detecting leading sharp. --- Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift index 534d83a2..62c59cf3 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift @@ -88,9 +88,9 @@ extension vChewing { strData = try String(contentsOfFile: path, encoding: .utf8).replacingOccurrences(of: "\t", with: " ") strData.ranges(splitBy: "\n").forEach { let neta = strData[$0].split(separator: " ") - if neta.count >= 2 { - let theKey = shouldReverse ? String(neta[1]) : String(neta[0]) - if !neta[0].isEmpty, !neta[1].isEmpty, theKey.first != "#" { + if neta.count >= 2, String(neta[0]).first != "#" { + if !neta[0].isEmpty, !neta[1].isEmpty { + let theKey = shouldReverse ? String(neta[1]) : String(neta[0]) let theValue = $0 rangeMap[theKey, default: []].append(theValue) }