Shiki: CHS Input Mode && WINNT351 Input Style, etc.

- Enabled WINNT351 legacy phonetic Input Style as an option in the vChewing Preferences, not a standalone IME with a standalone language model.
- Unsealed Simplified Chinese Input Mode. It's finally back.
- Rebranded the Formosa module into "Taiyan", the man who invented the Chinese Zhuyin (Bopomofo) symbols.
This commit is contained in:
ShikiSuen 2022-01-18 18:45:35 +08:00
parent 4ff7f4fa1f
commit 15164f3c83
30 changed files with 119 additions and 127 deletions

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="19529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="19529"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
@ -238,24 +239,37 @@
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="mzw-F2-aAQ">
<rect key="frame" x="19" y="61.5" width="423" height="16"/>
<buttonCell key="cell" type="check" title="Stop farting (when typed phonetic combination is invalid, etc.)" bezelStyle="regularSquare" imagePosition="left" controlSize="small" inset="2" id="ArK-Vk-OoT">
<buttonCell key="cell" type="check" title="Emulating Windows NT 3.51 legacy phonetic typing experience" bezelStyle="regularSquare" imagePosition="left" controlSize="small" inset="2" id="ArK-Vk-OoT">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>
<connections>
<action selector="clickedWhetherIMEShouldNotFartToggleAction:" target="-1" id="ieE-Xb-JtL"/>
<binding destination="32" name="value" keyPath="values.ShouldNotFartInLieuOfBeep" id="7Of-X3-D03"/>
<binding destination="32" name="value" keyPath="values.UseWinNT351BPMF" id="7Of-X3-D03"/>
</connections>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pYB-E5-4Nv">
<rect key="frame" x="19" y="40.5" width="423" height="16"/>
<buttonCell key="cell" type="check" title="Stop farting (when typed phonetic combination is invalid, etc.)" bezelStyle="regularSquare" imagePosition="left" controlSize="small" inset="2" id="62u-jY-BRh">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="cellTitle"/>
</buttonCell>
<connections>
<action selector="clickedWhetherIMEShouldNotFartToggleAction:" target="-1" id="bUl-EZ-USn"/>
<binding destination="32" name="value" keyPath="values.ShouldNotFartInLieuOfBeep" id="EOH-Pc-8Hk"/>
</connections>
</button>
</subviews>
<constraints>
<constraint firstItem="5IL-zZ-CL9" firstAttribute="leading" secondItem="mzw-F2-aAQ" secondAttribute="leading" id="1Ly-qx-Gu3"/>
<constraint firstItem="Yaj-QY-7xV" firstAttribute="top" secondItem="brd-6J-saN" secondAttribute="top" constant="14.5" id="3t1-EX-nuL"/>
<constraint firstItem="pYB-E5-4Nv" firstAttribute="top" secondItem="mzw-F2-aAQ" secondAttribute="bottom" constant="6" symbolic="YES" id="6Dg-ES-9nm"/>
<constraint firstItem="pYB-E5-4Nv" firstAttribute="leading" secondItem="mzw-F2-aAQ" secondAttribute="leading" id="L9L-Lj-gmk"/>
<constraint firstItem="5IL-zZ-CL9" firstAttribute="top" secondItem="Yaj-QY-7xV" secondAttribute="bottom" constant="6" symbolic="YES" id="MeX-CD-9FN"/>
<constraint firstItem="Yaj-QY-7xV" firstAttribute="trailing" secondItem="5IL-zZ-CL9" secondAttribute="trailing" id="S0v-Op-wDh"/>
<constraint firstAttribute="trailing" secondItem="Yaj-QY-7xV" secondAttribute="trailing" constant="20" symbolic="YES" id="UKC-jH-d9A"/>
<constraint firstItem="Yaj-QY-7xV" firstAttribute="leading" secondItem="brd-6J-saN" secondAttribute="leading" constant="20" symbolic="YES" id="YeI-ie-7B9"/>
<constraint firstItem="mzw-F2-aAQ" firstAttribute="top" secondItem="5IL-zZ-CL9" secondAttribute="bottom" constant="6" symbolic="YES" id="hC7-fa-qhc"/>
<constraint firstItem="pYB-E5-4Nv" firstAttribute="trailing" secondItem="mzw-F2-aAQ" secondAttribute="trailing" id="tD3-Pz-Qhz"/>
<constraint firstItem="Yaj-QY-7xV" firstAttribute="leading" secondItem="5IL-zZ-CL9" secondAttribute="leading" id="tjY-PG-4Kz"/>
<constraint firstItem="5IL-zZ-CL9" firstAttribute="trailing" secondItem="mzw-F2-aAQ" secondAttribute="trailing" id="xg7-MH-hSW"/>
</constraints>

View File

@ -13,7 +13,7 @@
#include "KeyValuePair.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class Bigram {
public:

View File

@ -13,7 +13,7 @@
#include "Grid.h"
#include "LanguageModel.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
using namespace std;

View File

@ -13,7 +13,7 @@
#include "NodeAnchor.h"
#include "Span.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class Grid {

View File

@ -12,7 +12,7 @@
#include <ostream>
#include <string>
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
using namespace std;

View File

@ -13,7 +13,7 @@
#include "Bigram.h"
#include "Unigram.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
using namespace std;

View File

@ -13,7 +13,7 @@
#include <vector>
#include "LanguageModel.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
using namespace std;

View File

@ -11,7 +11,7 @@
#include "Node.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class NodeAnchor {
public:

View File

@ -14,7 +14,7 @@
#include <sstream>
#include "Node.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class Span {
public:

View File

@ -12,7 +12,7 @@
#include <vector>
#include "KeyValuePair.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class Unigram {
public:

View File

@ -12,7 +12,7 @@
#include <algorithm>
#include "Grid.h"
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
using namespace std;

View File

@ -14,7 +14,7 @@
#include <unistd.h>
#include <syslog.h>
using namespace Formosa::Gramambular;
using namespace Taiyan::Gramambular;
FastLM::FastLM()
: fd(-1)

View File

@ -18,7 +18,7 @@
// format, and we use mmap and zero-out the separators and line feeds
// to avoid creating new string objects; the parser is a simple DFA
namespace Formosa {
namespace Taiyan {
namespace Gramambular {
class FastLM : public LanguageModel
{

View File

@ -17,7 +17,7 @@
namespace vChewing {
using namespace Formosa::Gramambular;
using namespace Taiyan::Gramambular;
class UserOverrideModel {
public:

View File

@ -94,19 +94,19 @@ void UserPhrasesLM::dump()
}
}
const std::vector<Formosa::Gramambular::Bigram> UserPhrasesLM::bigramsForKeys(const std::string& preceedingKey, const std::string& key)
const std::vector<Taiyan::Gramambular::Bigram> UserPhrasesLM::bigramsForKeys(const std::string& preceedingKey, const std::string& key)
{
return std::vector<Formosa::Gramambular::Bigram>();
return std::vector<Taiyan::Gramambular::Bigram>();
}
const std::vector<Formosa::Gramambular::Unigram> UserPhrasesLM::unigramsForKey(const std::string& key)
const std::vector<Taiyan::Gramambular::Unigram> UserPhrasesLM::unigramsForKey(const std::string& key)
{
std::vector<Formosa::Gramambular::Unigram> v;
std::vector<Taiyan::Gramambular::Unigram> v;
auto iter = keyRowMap.find(key);
if (iter != keyRowMap.end()) {
const std::vector<Row>& rows = iter->second;
for (const auto& row : rows) {
Formosa::Gramambular::Unigram g;
Taiyan::Gramambular::Unigram g;
g.keyValue.key = row.key;
g.keyValue.value = row.value;
g.score = 0.0;

View File

@ -16,7 +16,7 @@
namespace vChewing {
class UserPhrasesLM : public Formosa::Gramambular::LanguageModel
class UserPhrasesLM : public Taiyan::Gramambular::LanguageModel
{
public:
UserPhrasesLM();
@ -26,8 +26,8 @@ public:
void close();
void dump();
virtual const std::vector<Formosa::Gramambular::Bigram> bigramsForKeys(const std::string& preceedingKey, const std::string& key);
virtual const std::vector<Formosa::Gramambular::Unigram> unigramsForKey(const std::string& key);
virtual const std::vector<Taiyan::Gramambular::Bigram> bigramsForKeys(const std::string& preceedingKey, const std::string& key);
virtual const std::vector<Taiyan::Gramambular::Unigram> unigramsForKey(const std::string& key);
virtual bool hasUnigramsForKey(const std::string& key);
protected:

View File

@ -16,7 +16,7 @@
namespace vChewing {
using namespace Formosa::Gramambular;
using namespace Taiyan::Gramambular;
class vChewingLM : public LanguageModel {
public:

View File

@ -13,7 +13,7 @@
#include "OVUTF8Helper.h"
#include "OVWildcard.h"
namespace Formosa {
namespace Taiyan {
namespace Mandarin {
using namespace OpenVanilla;
@ -991,4 +991,4 @@ const BopomofoKeyboardLayout* BopomofoKeyboardLayout::HanyuPinyinLayout()
} // namespace Mandarin
} // namespace Formosa
} // namespace Taiyan

View File

@ -14,7 +14,7 @@
#include <vector>
#include <map>
namespace Formosa {
namespace Taiyan {
namespace Mandarin {
using namespace std;

View File

@ -12,6 +12,7 @@ private let kShouldNotFartInLieuOfBeep = "ShouldNotFartInLieuOfBeep"
private let kCheckUpdateAutomatically = "CheckUpdateAutomatically"
private let kCandidateListTextSize = "CandidateListTextSize"
private let kChooseCandidateUsingSpaceKey = "ChooseCandidateUsingSpaceKey"
private let kUseWinNT351BPMF = "UseWinNT351BPMF"
private let kSelectPhraseAfterCursorAsCandidate = "SelectPhraseAfterCursorAsCandidate"
private let kUseHorizontalCandidateList = "UseHorizontalCandidateList"
private let kChineseConversionEnabledKey = "ChineseConversionEnabled"
@ -38,6 +39,11 @@ private let kPhraseReplacementEnabledKey = "PhraseReplacementEnabled"
UserDefaults.standard.set(Preferences.chooseCandidateUsingSpace, forKey: kChooseCandidateUsingSpaceKey)
}
// WinNT351 false
if UserDefaults.standard.object(forKey: kUseWinNT351BPMF) == nil {
UserDefaults.standard.set(Preferences.useWinNT351BPMF, forKey: kUseWinNT351BPMF)
}
// 0
if UserDefaults.standard.object(forKey: kSelectPhraseAfterCursorAsCandidate) == nil {
UserDefaults.standard.set(Preferences.selectPhraseAfterCursorAsCandidate, forKey: kSelectPhraseAfterCursorAsCandidate)

View File

@ -18,7 +18,7 @@
{
@private
// the reading buffer that takes user input
Formosa::Mandarin::BopomofoReadingBuffer* _bpmfReadingBuffer;
Taiyan::Mandarin::BopomofoReadingBuffer* _bpmfReadingBuffer;
// language model
vChewing::vChewingLM *_languageModel;
@ -27,10 +27,10 @@
vChewing::UserOverrideModel *_userOverrideModel;
// the grid (lattice) builder for the unigrams (and bigrams)
Formosa::Gramambular::BlockReadingBuilder* _builder;
Taiyan::Gramambular::BlockReadingBuilder* _builder;
// latest walked path (trellis) using the Viterbi algorithm
std::vector<Formosa::Gramambular::NodeAnchor> _walkedNodes;
std::vector<Taiyan::Gramambular::NodeAnchor> _walkedNodes;
// user override model
vChewing::UserOverrideModel *_uom;

View File

@ -7,6 +7,7 @@
*/
#import "InputMethodController.h"
#include <objc/objc.h>
#import <fstream>
#import <iostream>
#import <set>
@ -17,8 +18,8 @@
// C++ namespace usages
using namespace std;
using namespace Formosa::Mandarin;
using namespace Formosa::Gramambular;
using namespace Taiyan::Mandarin;
using namespace Taiyan::Gramambular;
using namespace vChewing;
using namespace OpenVanilla;
@ -109,7 +110,7 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
_bpmfReadingBuffer = new BopomofoReadingBuffer(BopomofoKeyboardLayout::StandardLayout());
// create the lattice builder
_languageModel = [LanguageModelManager languageModelBopomofo];
_languageModel = [LanguageModelManager languageModelCoreCHT];
_languageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled);
_userOverrideModel = [LanguageModelManager userOverrideModel];
@ -151,17 +152,12 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
[menu addItem:[NSMenuItem separatorItem]]; // ------------------------------
if (_inputMode == kBopomofoModeIdentifierCHS) {
NSMenuItem *editExcludedPhrasesItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"Edit Excluded Phrases", @"") action:@selector(openExcludedPhrasesSimpBopomofo:) keyEquivalent:@""];
[menu addItem:editExcludedPhrasesItem];
}
else {
[menu addItemWithTitle:NSLocalizedString(@"Edit User Phrases", @"") action:@selector(openUserPhrases:) keyEquivalent:@""];
[menu addItemWithTitle:NSLocalizedString(@"Edit Excluded Phrases", @"") action:@selector(openExcludedPhrasesvChewing:) keyEquivalent:@""];
if (optionKeyPressed) {
[menu addItemWithTitle:NSLocalizedString(@"Edit Phrase Replacement Table", @"") action:@selector(openPhraseReplacementvChewing:) keyEquivalent:@""];
}
[menu addItemWithTitle:NSLocalizedString(@"Edit User Phrases", @"") action:@selector(openUserPhrases:) keyEquivalent:@""];
if (optionKeyPressed) {
[menu addItemWithTitle:NSLocalizedString(@"Edit Excluded Phrases", @"") action:@selector(openExcludedPhrases:) keyEquivalent:@""];
[menu addItemWithTitle:NSLocalizedString(@"Edit Phrase Replacement Table", @"") action:@selector(openPhraseReplacement:) keyEquivalent:@""];
}
[menu addItemWithTitle:NSLocalizedString(@"Reload User Phrases", @"") action:@selector(reloadUserPhrases:) keyEquivalent:@""];
[menu addItem:[NSMenuItem separatorItem]]; // ------------------------------
@ -248,14 +244,15 @@ static double FindHighestScore(const vector<NodeAnchor>& nodes, double epsilon)
if ([value isKindOfClass:[NSString class]] && [value isEqual:kBopomofoModeIdentifierCHS]) {
newInputMode = kBopomofoModeIdentifierCHS;
newLanguageModel = [LanguageModelManager languageModelSimpBopomofo];
}
else {
newLanguageModel = [LanguageModelManager languageModelCoreCHS];
} else {
newInputMode = kBopomofoModeIdentifierCHT;
newLanguageModel = [LanguageModelManager languageModelBopomofo];
newLanguageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled);
newLanguageModel = [LanguageModelManager languageModelCoreCHT];
}
// 自 Preferences 模組讀入自訂語彙置換功能開關狀態。
newLanguageModel->setPhraseReplacementEnabled(Preferences.phraseReplacementEnabled);
// Only apply the changes if the value is changed
if (![_inputMode isEqualToString:newInputMode]) {
[[NSUserDefaults standardUserDefaults] synchronize];
@ -650,8 +647,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
[self popOverflowComposingTextAndWalk:client];
// get user override model suggestion
string overrideValue = (_inputMode == kBopomofoModeIdentifierCHS) ? "" :
_userOverrideModel->suggest(_walkedNodes, _builder->cursorIndex(), [[NSDate date] timeIntervalSince1970]);
string overrideValue = _userOverrideModel->suggest(_walkedNodes, _builder->cursorIndex(), [[NSDate date] timeIntervalSince1970]);
if (!overrideValue.empty()) {
size_t cursorIndex = [self actualCandidateCursorIndex];
@ -664,7 +660,10 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
_bpmfReadingBuffer->clear();
[self updateClientComposingBuffer:client];
if (_inputMode == kBopomofoModeIdentifierCHS) {
// 模擬 WINNT 351 ㄅ半注音,就是每個漢字都自動要選字的那種注音。
// 嚴格來講不能算純正的ㄅ半注音,畢竟候選字的順序不可能會像當年那樣了。
// 如果簡體中文用戶不知道ㄅ半注音是什麼的話,拿全拼輸入法來比喻恐怕比較恰當。
if (Preferences.useWinNT351BPMF) {
[self _showCandidateWindowUsingVerticalMode:useVerticalMode client:client];
}
@ -965,7 +964,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
}
[self updateClientComposingBuffer:client];
if (_inputMode == kBopomofoModeIdentifierCHS && _bpmfReadingBuffer->isEmpty()) {
if (Preferences.useWinNT351BPMF && _bpmfReadingBuffer->isEmpty()) {
[self collectCandidates];
if ([_candidates count] == 1) {
[self commitComposition:client];
@ -983,14 +982,14 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
{
BOOL cancelCandidateKey =
(charCode == 27) ||
((_inputMode == kBopomofoModeIdentifierCHS) &&
(Preferences.useWinNT351BPMF &&
(charCode == 8 || keyCode == kDeleteKeyCode));
if (cancelCandidateKey) {
gCurrentCandidateController.visible = NO;
[_candidates removeAllObjects];
if (_inputMode == kBopomofoModeIdentifierCHS) {
if (Preferences.useWinNT351BPMF) {
_builder->clear();
_walkedNodes.clear();
[_composingBuffer setString:@""];
@ -1147,7 +1146,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
}
}
if (_inputMode == kBopomofoModeIdentifierCHS) {
if (Preferences.useWinNT351BPMF) {
string layout = [self _currentLayout];
string customPunctuation = string("_punctuation_") + layout + string(1, (char)charCode);
string punctuation = string("_punctuation_") + string(1, (char)charCode);
@ -1316,7 +1315,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
gCurrentCandidateController.keyLabels = keyLabels;
[self collectCandidates];
if (_inputMode == kBopomofoModeIdentifierCHS && [_candidates count] == 1) {
if (Preferences.useWinNT351BPMF && [_candidates count] == 1) {
[self commitComposition:client];
return;
}
@ -1493,7 +1492,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
- (void)togglePhraseReplacementEnabled:(id)sender
{
BOOL enabled = [Preferences tooglePhraseReplacementEnabled];
vChewingLM *lm = [LanguageModelManager languageModelBopomofo];
vChewingLM *lm = [LanguageModelManager languageModelCoreCHT];
lm->setPhraseReplacementEnabled(enabled);
}
@ -1532,12 +1531,12 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
[self _openUserFile:[LanguageModelManager excludedPhrasesDataPathSimpBopomofo]];
}
- (void)openExcludedPhrasesvChewing:(id)sender
- (void)openExcludedPhrases:(id)sender
{
[self _openUserFile:[LanguageModelManager excludedPhrasesDataPathBopomofo]];
}
- (void)openPhraseReplacementvChewing:(id)sender
- (void)openPhraseReplacement:(id)sender
{
[self _openUserFile:[LanguageModelManager phraseReplacementDataPathBopomofo]];
}
@ -1580,7 +1579,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
size_t cursorIndex = [self actualCandidateCursorIndex];
_builder->grid().fixNodeSelectedCandidate(cursorIndex, selectedValue);
if (_inputMode != kBopomofoModeIdentifierCHS) {
if (!Preferences.useWinNT351BPMF) {
_userOverrideModel->observe(_walkedNodes, cursorIndex, selectedValue, [[NSDate date] timeIntervalSince1970]);
}
@ -1589,7 +1588,7 @@ NS_INLINE size_t max(size_t a, size_t b) { return a > b ? a : b; }
[self walk];
[self updateClientComposingBuffer:_currentCandidateClient];
if (_inputMode == kBopomofoModeIdentifierCHS) {
if (Preferences.useWinNT351BPMF) {
[self commitComposition:_currentCandidateClient];
return;
}

View File

@ -26,8 +26,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (class, readonly, nonatomic) NSString *excludedPhrasesDataPathBopomofo;
@property (class, readonly, nonatomic) NSString *excludedPhrasesDataPathSimpBopomofo;
@property (class, readonly, nonatomic) NSString *phraseReplacementDataPathBopomofo;
@property (class, readonly, nonatomic) vChewing::vChewingLM *languageModelBopomofo;
@property (class, readonly, nonatomic) vChewing::vChewingLM *languageModelSimpBopomofo;
@property (class, readonly, nonatomic) vChewing::vChewingLM *languageModelCoreCHT;
@property (class, readonly, nonatomic) vChewing::vChewingLM *languageModelCoreCHS;
@property (class, readonly, nonatomic) vChewing::UserOverrideModel *userOverrideModel;
@end

View File

@ -14,15 +14,15 @@
#import "OVUTF8Helper.h"
using namespace std;
using namespace Formosa::Gramambular;
using namespace Taiyan::Gramambular;
using namespace vChewing;
using namespace OpenVanilla;
static const int kUserOverrideModelCapacity = 500;
static const double kObservedOverrideHalflife = 5400.0; // 1.5 hr.
vChewingLM gLanguageModelBopomofo;
vChewingLM gLanguageModelSimpBopomofo;
vChewingLM glanguageModelCoreCHT;
vChewingLM glanguageModelCoreCHS;
UserOverrideModel gUserOverrideModel(kUserOverrideModelCapacity, kObservedOverrideHalflife);
@implementation LanguageModelManager
@ -36,19 +36,19 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
+ (void)loadDataModels
{
LTLoadLanguageModelFile(@"data-cht", gLanguageModelBopomofo);
LTLoadLanguageModelFile(@"data-chs", gLanguageModelSimpBopomofo);
LTLoadLanguageModelFile(@"data-cht", glanguageModelCoreCHT);
LTLoadLanguageModelFile(@"data-chs", glanguageModelCoreCHS);
}
+ (void)loadUserPhrases
{
gLanguageModelBopomofo.loadUserPhrases([[self userPhrasesDataPathBopomofo] UTF8String], [[self excludedPhrasesDataPathBopomofo] UTF8String]);
gLanguageModelSimpBopomofo.loadUserPhrases(NULL, [[self excludedPhrasesDataPathSimpBopomofo] UTF8String]);
glanguageModelCoreCHT.loadUserPhrases([[self userPhrasesDataPathBopomofo] UTF8String], [[self excludedPhrasesDataPathBopomofo] UTF8String]);
glanguageModelCoreCHS.loadUserPhrases(NULL, [[self excludedPhrasesDataPathSimpBopomofo] UTF8String]);
}
+ (void)loadUserPhraseReplacement
{
gLanguageModelBopomofo.loadPhraseReplacementMap([[self phraseReplacementDataPathBopomofo] UTF8String]);
glanguageModelCoreCHT.loadPhraseReplacementMap([[self phraseReplacementDataPathBopomofo] UTF8String]);
}
+ (BOOL)checkIfUserDataFolderExists
@ -183,14 +183,14 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
return [[self dataFolderPath] stringByAppendingPathComponent:@"phrases-replacement.txt"];
}
+ (vChewingLM *)languageModelBopomofo
+ (vChewingLM *)languageModelCoreCHT
{
return &gLanguageModelBopomofo;
return &glanguageModelCoreCHT;
}
+ (vChewingLM *)languageModelSimpBopomofo
+ (vChewingLM *)languageModelCoreCHS
{
return &gLanguageModelSimpBopomofo;
return &glanguageModelCoreCHS;
}
+ (vChewing::UserOverrideModel *)userOverrideModel

View File

@ -20,6 +20,7 @@ private let kChooseCandidateUsingSpaceKey = "ChooseCandidateUsingSpaceKey"
private let kChineseConversionEnabledKey = "ChineseConversionEnabled"
private let kHalfWidthPunctuationEnabledKey = "HalfWidthPunctuationEnable"
private let kEscToCleanInputBufferKey = "EscToCleanInputBuffer"
private let kUseWinNT351BPMF = "UseWinNT351BPMF"
private let kShouldNotFartInLieuOfBeep = "ShouldNotFartInLieuOfBeep"
private let kCandidateTextFontName = "CandidateTextFontName"
@ -193,6 +194,9 @@ struct ComposingBufferSize {
@UserDefault(key: kChooseCandidateUsingSpaceKey, defaultValue: true)
@objc static var chooseCandidateUsingSpace: Bool
@UserDefault(key: kUseWinNT351BPMF, defaultValue: false)
@objc static var useWinNT351BPMF: Bool
@UserDefault(key: kShouldNotFartInLieuOfBeep, defaultValue: true)
@objc static var shouldNotFartInLieuOfBeep: Bool

View File

@ -98,11 +98,14 @@
/* Class = "NSTextFieldCell"; title = "Choose which keys you prefer for selecting candidates."; ObjectID = "2pS-nv-te4"; */
"2pS-nv-te4.title" = "Choose which keys you prefer for selecting candidates.";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "62u-jY-BRh"; */
"62u-jY-BRh.title" = "Stop farting (when typed phonetic combination is invalid, etc.)";
/* Class = "NSTextFieldCell"; title = "UI language setting:"; ObjectID = "9DS-Rc-TXq"; */
"9DS-Rc-TXq.title" = "UI language setting:";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "Stop farting (when typed phonetic combination is invalid, etc.)";
/* Class = "NSButtonCell"; title = "Emulating Windows NT 3.51 legacy phonetic typing experience"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "Emulating Windows NT 3.51 legacy phonetic typing experience";
/* Class = "NSButtonCell"; title = "Auto-convert traditional Chinese glyphs to KangXi characters"; ObjectID = "BSK-bH-Gct"; */
"BSK-bH-Gct.title" = "Auto-convert traditional Chinese glyphs to KangXi characters";

View File

@ -98,11 +98,14 @@
/* Class = "NSTextFieldCell"; title = "Choose which keys you prefer for selecting candidates."; ObjectID = "2pS-nv-te4"; */
"2pS-nv-te4.title" = "选择您所偏好的用来选字的按键组合。";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "62u-jY-BRh"; */
"62u-jY-BRh.title" = "不要放屁 // 例:当输入的音韵有误时,等";
/* Class = "NSTextFieldCell"; title = "UI language setting:"; ObjectID = "9DS-Rc-TXq"; */
"9DS-Rc-TXq.title" = "介面语言设定:";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "不要放屁 // 例:当输入的音韵有误时,等。";
/* Class = "NSButtonCell"; title = "Emulating Windows NT 3.51 legacy phonetic typing experience"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "模拟 Windows NT 3.51 注音逐字选字输入风格";
/* Class = "NSButtonCell"; title = "Auto-convert traditional Chinese glyphs to KangXi characters"; ObjectID = "BSK-bH-Gct"; */
"BSK-bH-Gct.title" = "自动将繁体中文字转换为康熙字";

View File

@ -98,11 +98,14 @@
/* Class = "NSTextFieldCell"; title = "Choose which keys you prefer for selecting candidates."; ObjectID = "2pS-nv-te4"; */
"2pS-nv-te4.title" = "選擇您所偏好的用來選字的按鍵組合。";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "62u-jY-BRh"; */
"62u-jY-BRh.title" = "不要放屁 // 例:當輸入的音韻有誤時,等";
/* Class = "NSTextFieldCell"; title = "UI language setting:"; ObjectID = "9DS-Rc-TXq"; */
"9DS-Rc-TXq.title" = "介面語言設定:";
/* Class = "NSButtonCell"; title = "Stop farting (when typed phonetic combination is invalid, etc.)"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "不要放屁 // 例:當輸入的音韻有誤時,等。";
/* Class = "NSButtonCell"; title = "Emulating Windows NT 3.51 legacy phonetic typing experience"; ObjectID = "ArK-Vk-OoT"; */
"ArK-Vk-OoT.title" = "模擬 Windows NT 3.51 注音逐字選字輸入風格";
/* Class = "NSButtonCell"; title = "Auto-convert traditional Chinese glyphs to KangXi characters"; ObjectID = "BSK-bH-Gct"; */
"BSK-bH-Gct.title" = "自動將繁體中文字轉換為康熙字";

View File

@ -87,10 +87,10 @@
/* Begin PBXFileReference section */
5B000FC1278495AD004F02AC /* SimpBopomofo.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = SimpBopomofo.tiff; sourceTree = "<group>"; };
5B000FC2278495AD004F02AC /* SimpBopomofo@2x.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "SimpBopomofo@2x.tiff"; sourceTree = "<group>"; };
5B054058278787710083EF4A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/preferences.strings; sourceTree = "<group>"; };
5B19584E27888F5D00FAEB14 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainMenu.strings"; sourceTree = "<group>"; };
5B19584F27888F5F00FAEB14 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/MainMenu.strings"; sourceTree = "<group>"; };
5B19585127888F6B00FAEB14 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/MainMenu.strings; sourceTree = "<group>"; };
5B4213762796CD0A0089FCF5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Source/en.lproj/preferences.strings; sourceTree = "<group>"; };
5B42B63E27876FDC00BB9B9F /* UserOverrideModel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserOverrideModel.cpp; sourceTree = "<group>"; };
5B42B63F27876FDC00BB9B9F /* UserOverrideModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UserOverrideModel.h; sourceTree = "<group>"; };
5B42B64127877D6500BB9B9F /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "Source/zh-Hans.lproj/preferences.strings"; sourceTree = "<group>"; };
@ -207,22 +207,6 @@
6A225A212367A1D700F685C6 /* ArchiveUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveUtil.h; sourceTree = "<group>"; };
6A225A222367A1D700F685C6 /* ArchiveUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArchiveUtil.m; sourceTree = "<group>"; };
6A2E40F5253A69DA00D1AE1D /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
6A38BBE215FC117A00A8A51F /* BIG5toUTF8.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = BIG5toUTF8.pl; sourceTree = "<group>"; };
6A38BBE315FC117A00A8A51F /* build4wlist.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = build4wlist.bash; sourceTree = "<group>"; };
6A38BBE415FC117A00A8A51F /* buildFreq.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = buildFreq.bash; sourceTree = "<group>"; };
6A38BBE515FC117A00A8A51F /* cook.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = cook.py; sourceTree = "<group>"; };
6A38BBE615FC117A00A8A51F /* cook.rb */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = cook.rb; sourceTree = "<group>"; };
6A38BBE715FC117A00A8A51F /* count.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = count.bash; sourceTree = "<group>"; };
6A38BBE815FC117A00A8A51F /* count.occurrence.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = count.occurrence.c; sourceTree = "<group>"; };
6A38BBE915FC117A00A8A51F /* count.occurrence.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = count.occurrence.pl; sourceTree = "<group>"; };
6A38BBEA15FC117A00A8A51F /* count.occurrence.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = count.occurrence.py; sourceTree = "<group>"; };
6A38BBEB15FC117A00A8A51F /* countphrase.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = countphrase.bash; sourceTree = "<group>"; };
6A38BBEC15FC117A00A8A51F /* filter.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = filter.bash; sourceTree = "<group>"; };
6A38BBED15FC117A00A8A51F /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
6A38BBEE15FC117A00A8A51F /* randomShuffle.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = randomShuffle.bash; sourceTree = "<group>"; };
6A38BBEF15FC117A00A8A51F /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
6A38BBF015FC117A00A8A51F /* typocorrection.bash */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = typocorrection.bash; sourceTree = "<group>"; };
6A38BBF115FC117A00A8A51F /* utf8length.pl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.perl; path = utf8length.pl; sourceTree = "<group>"; };
6A38BBF615FC117A00A8A51F /* data-cht.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "data-cht.txt"; sourceTree = "<group>"; };
6A38BBFA15FC117A00A8A51F /* Makefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = "<group>"; };
6A38BC2715FC158A00A8A51F /* InputMethodKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = InputMethodKit.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/InputMethodKit.framework; sourceTree = DEVELOPER_DIR; };
@ -513,7 +497,6 @@
6A38BBDD15FC115800A8A51F /* Data */ = {
isa = PBXGroup;
children = (
6A38BBE115FC117A00A8A51F /* bin */,
6A38BBF615FC117A00A8A51F /* data-cht.txt */,
5BC3FB82278492DE0022E99A /* data-chs.txt */,
6A38BBFA15FC117A00A8A51F /* Makefile */,
@ -521,29 +504,6 @@
path = Data;
sourceTree = "<group>";
};
6A38BBE115FC117A00A8A51F /* bin */ = {
isa = PBXGroup;
children = (
6A38BBE215FC117A00A8A51F /* BIG5toUTF8.pl */,
6A38BBE315FC117A00A8A51F /* build4wlist.bash */,
6A38BBE415FC117A00A8A51F /* buildFreq.bash */,
6A38BBE515FC117A00A8A51F /* cook.py */,
6A38BBE615FC117A00A8A51F /* cook.rb */,
6A38BBE715FC117A00A8A51F /* count.bash */,
6A38BBE815FC117A00A8A51F /* count.occurrence.c */,
6A38BBE915FC117A00A8A51F /* count.occurrence.pl */,
6A38BBEA15FC117A00A8A51F /* count.occurrence.py */,
6A38BBEB15FC117A00A8A51F /* countphrase.bash */,
6A38BBEC15FC117A00A8A51F /* filter.bash */,
6A38BBED15FC117A00A8A51F /* Makefile */,
6A38BBEE15FC117A00A8A51F /* randomShuffle.bash */,
6A38BBEF15FC117A00A8A51F /* README */,
6A38BBF015FC117A00A8A51F /* typocorrection.bash */,
6A38BBF115FC117A00A8A51F /* utf8length.pl */,
);
path = bin;
sourceTree = "<group>";
};
6ACA41E715FC1D9000935EF6 /* Installer */ = {
isa = PBXGroup;
children = (
@ -834,7 +794,7 @@
6A15B32721A51F2300B92CD3 /* Base */,
5B42B64127877D6500BB9B9F /* zh-Hans */,
5B42B64227877D7700BB9B9F /* zh-Hant */,
5B054058278787710083EF4A /* en */,
5B4213762796CD0A0089FCF5 /* en */,
);
name = preferences.xib;
path = ..;