Repo // 函數->函式。

This commit is contained in:
ShikiSuen 2022-06-18 14:47:21 +08:00
parent ece3f72ee5
commit 6d4adea6ed
13 changed files with 51 additions and 51 deletions

View File

@ -57,7 +57,7 @@ extension String {
}
}
// MARK: -
// MARK: -
// Ref: https://stackoverflow.com/a/32581409/4162914
extension Float {
@ -67,7 +67,7 @@ extension Float {
}
}
// MARK: -
// MARK: -
// Ref: https://stackoverflow.com/a/41581695/4162914
precedencegroup ExponentiationPrecedence {

View File

@ -25,7 +25,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/// 調
/// Megrez Tekkon
/// Megrez Tekkon
/// composer compositor
import Cocoa
@ -57,7 +57,7 @@ class KeyHandler {
var currentLM: vChewing.LMInstantiator = .init() //
var currentUOM: vChewing.LMUserOverride = .init() //
var walkedAnchors: [Megrez.NodeAnchor] = [] //
/// (ctlInputMethod)便
/// (ctlInputMethod)便
var delegate: KeyHandlerDelegate?
/// InputMode
@ -111,7 +111,7 @@ class KeyHandler {
///
/// Viterbi
///
///
///
func walk() {
walkedAnchors = compositor.walk()
@ -153,7 +153,7 @@ class KeyHandler {
///
/// - Parameter key:
/// - Returns:
/// nil
/// nil
func buildAssociatePhraseArray(withKey key: String) -> [String] {
var arrResult: [String] = []
if currentLM.hasAssociatedPhrasesForKey(key) {
@ -347,7 +347,7 @@ class KeyHandler {
composer.clear()
}
/// Ruby
/// Ruby
/// - Parameters:
/// - target:
/// - newSeparator:

View File

@ -150,7 +150,7 @@ extension KeyHandler {
// inputValidityCheck() charCode UniChar
// keyConsumedByReading
// composer.receiveKey() String UniChar
// composer.receiveKey() String UniChar
if !skipPhoneticHandling && composer.inputValidityCheck(key: charCode) {
composer.receiveKey(fromCharCode: charCode)
keyConsumedByReading = true
@ -397,7 +397,7 @@ extension KeyHandler {
} else {
// commit buffer ESC
// Enter 使 commit buffer
// bool _ =
// bool _ =
_ = handleEnter(state: state, stateCallback: stateCallback, errorCallback: errorCallback)
stateCallback(InputState.SymbolTable(node: SymbolNode.root, isTypingVertical: input.isTypingVertical))
return true

View File

@ -24,11 +24,11 @@ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/// 調調
/// 調調
import Cocoa
// MARK: - § 調 (Functions Interact With States).
// MARK: - § 調 (Functions Interact With States).
extension KeyHandler {
// MARK: - State Building
@ -168,11 +168,11 @@ extension KeyHandler {
///
///
/// buildAssociatePhraseStateWithKey
/// 使
/// Core buildAssociatePhraseArray
/// String Swift
/// nil
///
/// 使
/// Core buildAssociatePhraseArray
/// String Swift
/// nil
///
///
/// - Parameters:
/// - key:
@ -760,7 +760,7 @@ extension KeyHandler {
return true
}
//
//
let candidates = buildCandidate(state: state).candidates
guard !candidates.isEmpty else {
IME.prtDebugIntel("3378A6DF")
@ -796,7 +796,7 @@ extension KeyHandler {
/// 2 使
///
///
/// 使
/// 使
/// (Shift+)Tab ()
/// Shift(+CMD)+Space Tab
if candidates[0] == currentValue {

View File

@ -152,7 +152,7 @@ public struct Tekkon {
ensureType()
}
///
///
mutating func ensureType() {
if Tekkon.allowedConsonants.contains(value) {
type = .consonant
@ -228,7 +228,7 @@ public struct Tekkon {
consonant.value + semivowel.value + vowel.value + intonation.value
}
/// value /
/// value /
/// 調
/// - Parameters:
/// - isHanyuPinyin:
@ -251,7 +251,7 @@ public struct Tekkon {
}
}
// macOS InputMethod Kit 使
// macOS InputMethod Kit 使
/// - Parameters:
/// - isHanyuPinyin:
public func getInlineCompositionForIMK(isHanyuPinyin: Bool = false) -> String {
@ -285,7 +285,7 @@ public struct Tekkon {
!vowel.isEmpty || !semivowel.isEmpty || !consonant.isEmpty
}
// MARK:
// MARK:
/// @input
/// @arrange .ofDachen
@ -309,7 +309,7 @@ public struct Tekkon {
// MARK: - Public Functions
///
///
///
/// parser
/// - Parameters:
@ -344,7 +344,7 @@ public struct Tekkon {
}
/// String
/// UniChar
/// UniChar
///
/// 調
/// - Parameters:
@ -370,7 +370,7 @@ public struct Tekkon {
}
/// UniChar
/// UniChar String
/// UniChar String
///
/// 調
/// - Parameters:
@ -475,7 +475,7 @@ public struct Tekkon {
}
}
/// 調調
/// 調調
/// - Parameters:
/// - withNothingElse: 調
public func hasToneMarker(withNothingElse: Bool = false) -> Bool {
@ -494,11 +494,11 @@ public struct Tekkon {
// MARK: - Parser Processings
//
//
/// String
///
///
///
/// - Parameters:
/// - key: String
mutating func translate(key: String = "") -> String {
@ -522,14 +522,14 @@ public struct Tekkon {
case .ofFakeSeigyou:
return Tekkon.mapFakeSeigyou[key] ?? ""
case .ofHanyuPinyin, .ofSecondaryPinyin, .ofYalePinyin, .ofHualuoPinyin, .ofUniversalPinyin:
break //
break //
}
return ""
}
///
///
///
///
/// - Parameters:
/// - key: String
mutating func handleETen26(key: String = "") -> String {
@ -612,7 +612,7 @@ public struct Tekkon {
///
///
///
///
/// - Parameters:
/// - key: String
mutating func handleHsu(key: String = "") -> String {
@ -735,7 +735,7 @@ public struct Tekkon {
///
///
///
///
/// - Parameters:
/// - key: String
mutating func handleDachen26(key: String = "") -> String {

View File

@ -88,7 +88,7 @@ public enum IME {
// MARK: - Initializing Language Models.
static func initLangModels(userOnly: Bool) {
// mgrLangModel loadUserPhrases dataFolderPath
// mgrLangModel loadUserPhrases dataFolderPath
//
//
mgrLangModel.loadUserAssociatesData()

View File

@ -61,7 +61,7 @@ extension vChewing {
/// files are modified. It does not keep the reference of the data pathes but
/// you have to pass the paths when you ask it to load.
public class LMInstantiator: Megrez.LanguageModel {
//
//
public var isPhraseReplacementEnabled = false
public var isCNSEnabled = false
public var isSymbolEnabled = false
@ -100,10 +100,10 @@ extension vChewing {
var lmReplacements = LMReplacments()
var lmAssociates = LMAssociates()
//
//
override init() {}
// 調
// 調
public var isLanguageModelLoaded: Bool { lmCore.isLoaded() }
public func loadLanguageModel(path: String) {

View File

@ -132,12 +132,12 @@ extension vChewing {
/// 使 strData
///
///
///
/// - parameters:
/// - precedingKey:
/// - key:
public func bigramsForKeys(precedingKey: String, key: String) -> [Megrez.Bigram] {
// Swift
// Swift
// [Megrez.Bigram]()
precedingKey == key ? [Megrez.Bigram]() : [Megrez.Bigram]()
}

View File

@ -126,12 +126,12 @@ extension vChewing {
/// 使 UTF8
///
///
///
/// - parameters:
/// - precedingKey:
/// - key:
public func bigramsForKeys(precedingKey: String, key: String) -> [Megrez.Bigram] {
// Swift
// Swift
// [Megrez.Bigram]()
precedingKey == key ? [Megrez.Bigram]() : [Megrez.Bigram]()
}
@ -167,7 +167,7 @@ extension vChewing {
rangeMap[cnvPhonabetToASCII(key)] != nil
}
///
///
///
/// 使 plist
///
@ -190,7 +190,7 @@ extension vChewing {
return strOutput
}
///
///
///
/// ASCII
/// - parameters:

View File

@ -29,7 +29,7 @@ import Cocoa
/// mgrLangModel
/// mgrLangModel
///
/// mgrLangModel
/// mgrLangModel
private var gLangModelCHS = vChewing.LMInstantiator()
private var gLangModelCHT = vChewing.LMInstantiator()
@ -37,7 +37,7 @@ private var gUserOverrideModelCHS = vChewing.LMUserOverride()
private var gUserOverrideModelCHT = vChewing.LMUserOverride()
enum mgrLangModel {
/// fileprivate
/// fileprivate
public static var lmCHS: vChewing.LMInstantiator { gLangModelCHS }
public static var lmCHT: vChewing.LMInstantiator { gLangModelCHT }
public static var uomCHS: vChewing.LMUserOverride { gUserOverrideModelCHS }
@ -295,7 +295,7 @@ enum mgrLangModel {
// The above "&" mutates the "isFolder" value to the real one received by the "folderExist".
//
//
//
var folderPath = folderPath // Convert the incoming constant to a variable.
if isFolder.boolValue {
folderPath?.ensureTrailingSlash()
@ -351,7 +351,7 @@ enum mgrLangModel {
return true
}
// MARK: - 使 mgrPrefs
// MARK: - 使 mgrPrefs
// mgrPrefs

View File

@ -68,7 +68,7 @@ extension Megrez {
joinSeparator = separator
}
///
///
public func clear() {
mutCursorIndex = 0
mutReadings.removeAll()
@ -115,7 +115,7 @@ extension Megrez {
///
///
///
///
///
@discardableResult public func removeHeadReadings(count: Int) -> Bool {
let count = abs(count) //
if count > length {

View File

@ -24,11 +24,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
extension Megrez {
/// 使
/// 使
open class LanguageModel {
public init() {}
// Swift
// Swift
///
open func unigramsFor(key: String) -> [Megrez.Unigram] {

View File

@ -49,7 +49,7 @@ extension Megrez {
hasher.combine(score)
}
//
//
public static func compareScore(a: Unigram, b: Unigram) -> Bool {
a.score > b.score
}