From 95ba7ae5c5522e4f8c7c0b31e17a8e688211ef31 Mon Sep 17 00:00:00 2001 From: ShikiSuen Date: Mon, 7 Mar 2022 10:12:20 +0800 Subject: [PATCH] DataCompiler // Clean credits of formulas. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 依《中華人民共和國著作權法》第五條,「公式」不適用該法。 --- DataCompiler/dataCompiler.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/DataCompiler/dataCompiler.swift b/DataCompiler/dataCompiler.swift index dea6fa77..081a5f2d 100644 --- a/DataCompiler/dataCompiler.swift +++ b/DataCompiler/dataCompiler.swift @@ -336,20 +336,19 @@ func weightAndSort(_ arrStructUncalculated: [Entry], isCHS: Bool) -> [Entry] { var norm: Float = 0.0 for entry in arrStructUncalculated { if entry.valCount >= 0 { - norm += fscale**(Float(entry.valPhrase.count) / 3.0 - 1.0) * Float(entry.valCount) // Credit: MJHsieh. + norm += fscale**(Float(entry.valPhrase.count) / 3.0 - 1.0) * Float(entry.valCount) } } // norm 計算完畢,開始將 norm 作為新的固定常數來為每個詞條記錄計算權重。 // 將新酷音的詞語出現次數數據轉換成小麥引擎可讀的數據形式。 // 對出現次數小於 1 的詞條,將 0 當成 0.5 來處理、以防止除零。 - // 統計公式著作權歸 MJHsieh 所有(MIT License)。 for entry in arrStructUncalculated { var weight: Float = 0 switch entry.valCount { case -1: // 假名 weight = -13 case 0: // 墊底低頻漢字與詞語 - weight = log10(fscale**(Float(entry.valPhrase.count) / 3.0 - 1.0) * 0.5 / norm) // Credit: MJHsieh. + weight = log10(fscale**(Float(entry.valPhrase.count) / 3.0 - 1.0) * 0.5 / norm) default: weight = log10(fscale**(Float(entry.valPhrase.count) / 3.0 - 1.0) * Float(entry.valCount) / norm) // Credit: MJHsieh. }