diff --git a/Source/Modules/ControllerModules/KeyHandler_States.swift b/Source/Modules/ControllerModules/KeyHandler_States.swift index 6ed1b3e1..77c15b65 100644 --- a/Source/Modules/ControllerModules/KeyHandler_States.swift +++ b/Source/Modules/ControllerModules/KeyHandler_States.swift @@ -77,6 +77,7 @@ extension KeyHandler { /// 這裡先計算一下要用在工具提示當中的顯示參數的內容。 switch compositor.cursor { case compositor.readings.count...: + // 這裡的 compositor.cursor 數值不可能大於 readings.count,因為會被 Megrez 自動糾正。 tooltipParameterRef[0] = compositor.readings[compositor.cursor - 1] case 0: tooltipParameterRef[1] = compositor.readings[compositor.cursor] diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift index eb049aea..19ed60ad 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCoreEX.swift @@ -51,10 +51,10 @@ extension vChewing { /// 初期化該語言模型。 /// /// - parameters: - /// - reverse: 聲明原始檔案內第一、二縱列的內容是否彼此顛倒 - /// - consolidate: 請且僅請對使用者語言模組啟用該參數:是否自動整理格式 - /// - defaultScore: 當某一筆資料內的權重資料毀損時,要施加的預設權重 - /// - forceDefaultScore: 啟用該選項的話,會強制施加預設權重、而無視原始權重資料 + /// - reverse: 聲明原始檔案內第一、二縱列的內容是否彼此顛倒。 + /// - consolidate: 請且僅請對使用者語言模組啟用該參數:是否自動整理格式。 + /// - defaultScore: 當某一筆資料內的權重資料毀損時,要施加的預設權重。 + /// - forceDefaultScore: 啟用該選項的話,會強制施加預設權重、而無視原始權重資料。 public init( reverse: Bool = false, consolidate: Bool = false, defaultScore scoreDefault: Double = 0, forceDefaultScore: Bool = false @@ -73,7 +73,7 @@ extension vChewing { /// 將資料從檔案讀入至資料庫辭典內。 /// - parameters: - /// - path: 給定路徑 + /// - path: 給定路徑。 @discardableResult public mutating func open(_ path: String) -> Bool { if isLoaded() { return false @@ -135,8 +135,8 @@ extension vChewing { /// /// 威注音輸入法尚未引入雙元圖支援,所以該函式並未擴充相關功能,自然不會起作用。 /// - parameters: - /// - precedingKey: 前述讀音索引鍵 - /// - key: 當前讀音索引鍵 + /// - precedingKey: 前述讀音索引鍵。 + /// - key: 當前讀音索引鍵。 public func bigramsFor(precedingKey: String, key: String) -> [Megrez.Bigram] { // 這裡用了點廢話處理,不然函式構建體會被 Swift 格式整理工具給毀掉。 // 其實只要一句「[Megrez.Bigram]()」就夠了。 @@ -145,7 +145,7 @@ extension vChewing { /// 根據給定的讀音索引鍵,來獲取資料庫辭典內的對應資料陣列的字串首尾範圍資料、據此自 strData 取得字串形式的資料、生成單元圖陣列。 /// - parameters: - /// - key: 讀音索引鍵 + /// - key: 讀音索引鍵。 public func unigramsFor(key: String) -> [Megrez.Unigram] { var grams: [Megrez.Unigram] = [] if let arrRangeRecords: [Range] = rangeMap[key] { @@ -168,7 +168,7 @@ extension vChewing { /// 根據給定的讀音索引鍵來確認資料庫辭典內是否存在對應的資料。 /// - parameters: - /// - key: 讀音索引鍵 + /// - key: 讀音索引鍵。 public func hasUnigramsFor(key: String) -> Bool { rangeMap[key] != nil } diff --git a/Source/Modules/LangModelRelated/SubLMs/lmCoreNS.swift b/Source/Modules/LangModelRelated/SubLMs/lmCoreNS.swift index da250eee..6224e0ad 100644 --- a/Source/Modules/LangModelRelated/SubLMs/lmCoreNS.swift +++ b/Source/Modules/LangModelRelated/SubLMs/lmCoreNS.swift @@ -52,10 +52,10 @@ extension vChewing { /// 某些參數在 LMCoreNS 內已作廢,但仍保留、以方便那些想用該專案源碼做實驗的人群。 /// /// - parameters: - /// - reverse: 已作廢:聲明原始檔案內第一、二縱列的內容是否彼此顛倒 - /// - consolidate: 請且僅請對使用者語言模組啟用該參數:是否自動整理格式 - /// - defaultScore: 當某一筆資料內的權重資料毀損時,要施加的預設權重 - /// - forceDefaultScore: 啟用該選項的話,會強制施加預設權重、而無視原始權重資料 + /// - reverse: 已作廢:聲明原始檔案內第一、二縱列的內容是否彼此顛倒。 + /// - consolidate: 請且僅請對使用者語言模組啟用該參數:是否自動整理格式。 + /// - defaultScore: 當某一筆資料內的權重資料毀損時,要施加的預設權重。 + /// - forceDefaultScore: 啟用該選項的話,會強制施加預設權重、而無視原始權重資料。 public init( reverse: Bool = false, consolidate: Bool = false, defaultScore scoreDefault: Double = 0, forceDefaultScore: Bool = false @@ -74,7 +74,7 @@ extension vChewing { /// 將資料從檔案讀入至資料庫辭典內。 /// - parameters: - /// - path: 給定路徑 + /// - path: 給定路徑。 @discardableResult public mutating func open(_ path: String) -> Bool { if isLoaded() { return false @@ -128,8 +128,8 @@ extension vChewing { /// /// 威注音輸入法尚未引入雙元圖支援,所以該函式並未擴充相關功能,自然不會起作用。 /// - parameters: - /// - precedingKey: 前述讀音索引鍵 - /// - key: 當前讀音索引鍵 + /// - precedingKey: 前述讀音索引鍵。 + /// - key: 當前讀音索引鍵。 public func bigramsFor(precedingKey: String, key: String) -> [Megrez.Bigram] { // 這裡用了點廢話處理,不然函式構建體會被 Swift 格式整理工具給毀掉。 // 其實只要一句「[Megrez.Bigram]()」就夠了。 @@ -138,7 +138,7 @@ extension vChewing { /// 根據給定的讀音索引鍵,來獲取資料庫辭典內的對應資料陣列的 UTF8 資料、就地分析、生成單元圖陣列。 /// - parameters: - /// - key: 讀音索引鍵 + /// - key: 讀音索引鍵。 public func unigramsFor(key: String) -> [Megrez.Unigram] { var grams: [Megrez.Unigram] = [] if let arrRangeRecords: [Data] = rangeMap[cnvPhonabetToASCII(key)] { @@ -162,7 +162,7 @@ extension vChewing { /// 根據給定的讀音索引鍵來確認資料庫辭典內是否存在對應的資料。 /// - parameters: - /// - key: 讀音索引鍵 + /// - key: 讀音索引鍵。 public func hasUnigramsFor(key: String) -> Bool { rangeMap[cnvPhonabetToASCII(key)] != nil } @@ -173,7 +173,7 @@ extension vChewing { /// /// 如果傳入的字串當中包含 ASCII 下畫線符號的話,則表明該字串並非注音讀音字串,會被忽略處理。 /// - parameters: - /// - incoming: 傳入的未加密注音讀音字串 + /// - incoming: 傳入的未加密注音讀音字串。 func cnvPhonabetToASCII(_ incoming: String) -> String { let dicPhonabet2ASCII = [ "ㄅ": "b", "ㄆ": "p", "ㄇ": "m", "ㄈ": "f", "ㄉ": "d", "ㄊ": "t", "ㄋ": "n", "ㄌ": "l", "ㄍ": "g", "ㄎ": "k", "ㄏ": "h", @@ -194,7 +194,7 @@ extension vChewing { /// /// 如果傳入的字串當中包含 ASCII 下畫線符號的話,則表明該字串並非注音讀音字串,會被忽略處理。 /// - parameters: - /// - incoming: 傳入的已加密注音讀音字串 + /// - incoming: 傳入的已加密注音讀音字串。 func restorePhonabetFromASCII(_ incoming: String) -> String { let dicPhonabet4ASCII = [ "b": "ㄅ", "p": "ㄆ", "m": "ㄇ", "f": "ㄈ", "d": "ㄉ", "t": "ㄊ", "n": "ㄋ", "l": "ㄌ", "g": "ㄍ", "k": "ㄎ", "h": "ㄏ",