From 8cf6272a076f1579bdaff9b6fce824064e2e5208 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 9 May 2022 09:49:33 +0800 Subject: [PATCH] LMCoreEX // Patch the score double if it is > 0 (mistyped). --- Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift index de69e9ef..0f07eaaf 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift @@ -127,6 +127,9 @@ extension vChewing { if neta.count >= 3, !shouldForceDefaultScore { theScore = .init(neta[2]) ?? defaultScore } + if theScore > 0 { + theScore *= -1 // 應對可能忘記寫負號的情形 + } grams.append(Megrez.Unigram(keyValue: kvPair, score: theScore)) } }