mgrLM // +chkIfUserPhraseExists to writeUserPhrase.
This commit is contained in:
parent
3b1e966c9d
commit
75f3c371a3
|
@ -603,7 +603,7 @@ extension ctlInputMethod: KeyHandlerDelegate {
|
||||||
if !state.validToWrite {
|
if !state.validToWrite {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
mgrLangModel.writeUserPhrase(state.userPhrase, inputMode: keyHandler.inputMode)
|
mgrLangModel.writeUserPhrase(state.userPhrase, inputMode: keyHandler.inputMode, areWeDuplicating: state.chkIfUserPhraseExists)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
+ (BOOL)checkIfUserDataFolderExists;
|
+ (BOOL)checkIfUserDataFolderExists;
|
||||||
|
|
||||||
+ (BOOL)checkIfUserPhraseExist:(NSString *)userPhrase key:(NSString *)key NS_SWIFT_NAME(checkIfExist(userPhrase:key:));
|
+ (BOOL)checkIfUserPhraseExist:(NSString *)userPhrase key:(NSString *)key NS_SWIFT_NAME(checkIfExist(userPhrase:key:));
|
||||||
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode;
|
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating;
|
||||||
+ (void)setPhraseReplacementEnabled:(BOOL)phraseReplacementEnabled;
|
+ (void)setPhraseReplacementEnabled:(BOOL)phraseReplacementEnabled;
|
||||||
+ (void)setCNSEnabled:(BOOL)cnsEnabled;
|
+ (void)setCNSEnabled:(BOOL)cnsEnabled;
|
||||||
+ (NSString *)userPhrasesDataPath:(InputMode)mode;
|
+ (NSString *)userPhrasesDataPath:(InputMode)mode;
|
||||||
|
|
|
@ -219,7 +219,7 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode;
|
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating
|
||||||
{
|
{
|
||||||
if (![self checkIfUserLanguageModelFilesExist]) {
|
if (![self checkIfUserLanguageModelFilesExist]) {
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -251,6 +251,9 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
||||||
// [currentMarkedPhrase appendString:@"\n"];
|
// [currentMarkedPhrase appendString:@"\n"];
|
||||||
// }
|
// }
|
||||||
[currentMarkedPhrase appendString:userPhrase];
|
[currentMarkedPhrase appendString:userPhrase];
|
||||||
|
if (areWeDuplicating) {
|
||||||
|
[currentMarkedPhrase appendString:@"\tFreqOverrideByDuplication"];
|
||||||
|
}
|
||||||
[currentMarkedPhrase appendString:@"\n"];
|
[currentMarkedPhrase appendString:@"\n"];
|
||||||
|
|
||||||
NSFileHandle *writeFile = [NSFileHandle fileHandleForUpdatingAtPath:path];
|
NSFileHandle *writeFile = [NSFileHandle fileHandleForUpdatingAtPath:path];
|
||||||
|
|
Loading…
Reference in New Issue