From d720f6e4110a6ea84701ff64b9b07eced4b06f31 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Wed, 4 May 2022 17:58:06 +0800 Subject: [PATCH] LMs // Update conditions for checking wrecked lines. --- Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift | 3 ++- Source/Modules/LangModelRelated/SubLMs/lmCore.swift | 2 +- Source/Modules/LangModelRelated/SubLMs/lmLite.swift | 3 ++- Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift index 676907b0..e5aca9f7 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmAssociates.swift @@ -62,8 +62,9 @@ extension vChewing { for (lineID, lineContent) in arrData.enumerated() { if !lineContent.hasPrefix("#") { + let lineContent = lineContent.replacingOccurrences(of: "\t", with: " ") if lineContent.components(separatedBy: " ").count < 2 { - if arrData.last != "" { + if lineContent != "", lineContent != " " { IME.prtDebugIntel("Line #\(lineID + 1) Wrecked: \(lineContent)") } continue diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCore.swift b/Source/Modules/LangModelRelated/SubLMs/lmCore.swift index 158fd3ef..8e63ceee 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCore.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCore.swift @@ -77,7 +77,7 @@ extension vChewing { if !lineContent.hasPrefix("#") { let lineContent = lineContent.replacingOccurrences(of: "\t", with: " ") if lineContent.components(separatedBy: " ").count < 2 { - if arrData.last != "" { + if lineContent != "", lineContent != " " { IME.prtDebugIntel("Line #\(lineID + 1) Wrecked: \(lineContent)") } continue diff --git a/Source/Modules/LangModelRelated/SubLMs/lmLite.swift b/Source/Modules/LangModelRelated/SubLMs/lmLite.swift index b3e8875c..62e3ebac 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmLite.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmLite.swift @@ -66,8 +66,9 @@ extension vChewing { for (lineID, lineContent) in arrData.enumerated() { if !lineContent.hasPrefix("#") { + let lineContent = lineContent.replacingOccurrences(of: "\t", with: " ") if lineContent.components(separatedBy: " ").count < 2 { - if arrData.last != "" { + if lineContent != "", lineContent != " " { IME.prtDebugIntel("Line #\(lineID + 1) Wrecked: \(lineContent)") } continue diff --git a/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift b/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift index 15793cd3..6b04ac45 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmReplacements.swift @@ -63,8 +63,9 @@ extension vChewing { for (lineID, lineContent) in arrData.enumerated() { if !lineContent.hasPrefix("#") { + let lineContent = lineContent.replacingOccurrences(of: "\t", with: " ") if lineContent.components(separatedBy: " ").count < 2 { - if arrData.last != "" { + if lineContent != "", lineContent != " " { IME.prtDebugIntel("Line #\(lineID + 1) Wrecked: \(lineContent)") } continue