LMConsolidator // Add another option to allow force-consolidate, etc.
This commit is contained in:
parent
60a42f934c
commit
aade60dd62
|
@ -37,7 +37,7 @@ class LMConsolidator
|
|||
public:
|
||||
static bool CheckPragma(const char *path);
|
||||
static bool FixEOF(const char *path);
|
||||
static bool ConsolidateContent(const char *path, bool shouldsort);
|
||||
static bool ConsolidateContent(const char *path, bool shouldsort, bool shouldCheckPragma);
|
||||
};
|
||||
|
||||
} // namespace vChewing
|
||||
|
|
|
@ -71,8 +71,8 @@ bool LMConsolidator::FixEOF(const char *path)
|
|||
} // END: EOF FIXER.
|
||||
|
||||
// CONTENT CONSOLIDATOR. CREDIT: Shiki Suen.
|
||||
bool LMConsolidator::ConsolidateContent(const char *path, bool shouldsort) {
|
||||
if (LMConsolidator::CheckPragma(path) && !shouldsort){
|
||||
bool LMConsolidator::ConsolidateContent(const char *path, bool shouldsort, bool shouldCheckPragma) {
|
||||
if (LMConsolidator::CheckPragma(path) && !shouldsort && shouldCheckPragma){
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -59,12 +59,7 @@ bool AssociatedPhrases::open(const char *path)
|
|||
}
|
||||
|
||||
LMConsolidator::FixEOF(path);
|
||||
|
||||
if (Preferences.shouldAutoSortAssociatedPhrasesOnLoad) {
|
||||
LMConsolidator::ConsolidateContent(path, true);
|
||||
} else {
|
||||
LMConsolidator::ConsolidateContent(path, false);
|
||||
}
|
||||
LMConsolidator::ConsolidateContent(path, Preferences.shouldAutoSortAssociatedPhrasesOnLoad, true);
|
||||
|
||||
fd = ::open(path, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
|
|
|
@ -54,12 +54,7 @@ bool PhraseReplacementMap::open(const char *path)
|
|||
}
|
||||
|
||||
LMConsolidator::FixEOF(path);
|
||||
|
||||
if (Preferences.shouldAutoSortPhraseReplacementMapOnLoad) {
|
||||
LMConsolidator::ConsolidateContent(path, true);
|
||||
} else {
|
||||
LMConsolidator::ConsolidateContent(path, false);
|
||||
}
|
||||
LMConsolidator::ConsolidateContent(path, Preferences.shouldAutoSortPhraseReplacementMapOnLoad, true);
|
||||
|
||||
fd = ::open(path, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
|
|
|
@ -60,12 +60,7 @@ bool UserPhrasesLM::open(const char *path)
|
|||
}
|
||||
|
||||
LMConsolidator::FixEOF(path);
|
||||
|
||||
if (Preferences.shouldAutoSortUserPhrasesAndExclListOnLoad) {
|
||||
LMConsolidator::ConsolidateContent(path, true);
|
||||
} else {
|
||||
LMConsolidator::ConsolidateContent(path, false);
|
||||
}
|
||||
LMConsolidator::ConsolidateContent(path, Preferences.shouldAutoSortUserPhrasesAndExclListOnLoad, true);
|
||||
|
||||
fd = ::open(path, O_RDONLY);
|
||||
if (fd == -1) {
|
||||
|
|
|
@ -252,7 +252,9 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
|||
// }
|
||||
[currentMarkedPhrase appendString:userPhrase];
|
||||
if (areWeDuplicating) {
|
||||
[currentMarkedPhrase appendString:@"\tFreqOverrideByDuplication"];
|
||||
// Do not use ASCII characters to comment here.
|
||||
// Otherwise, it will be scrambled by HYPY2BPMF module shipped in the vChewing Phrase Editor.
|
||||
[currentMarkedPhrase appendString:@"\t#𝙾𝚟𝚎𝚛𝚛𝚒𝚍𝚎"];
|
||||
}
|
||||
[currentMarkedPhrase appendString:@"\n"];
|
||||
|
||||
|
|
Loading…
Reference in New Issue