Commit Graph

440 Commits

Author SHA1 Message Date
zonble a7e38b5b2d Fine-tunes tooltip UI. 2022-01-13 22:00:29 +08:00
zonble 366453820d Adds a tiny tooltop for shift-left/right selections. 2022-01-13 21:47:52 +08:00
zonble 4c1781d970 Renames half-size to half-width. 2022-01-13 19:59:49 +08:00
zonble 9cd2306313 Adds emacs-style hotkeys. 2022-01-13 19:57:08 +08:00
zonble 232a944953 Implements half-size punctuations. 2022-01-13 17:07:22 +08:00
Lukhnos Liu c31e390122 Merge pull request #218 from zonble/dev/user_phrases_lm
Adds UserPhrasesLM for user phrases.
2022-01-12 07:51:37 -08:00
zonble d590d748f8 Adds UserPhrasesLM for user phrases.
Since there is no probability information for users' custom phrases,
they should be stored in a format differs from data.txt. Using the same
format and FastLM to parse user phrases just because of laziness but it
is not the right way.

The pull request adds a new language model class to parse user phrases.
It also update the input method controller to adopt the new user phrase
format.
2022-01-12 16:53:51 +08:00
Weizhong Yang a.k.a zonble fb513f51b0 Merge pull request #216 from zonble/dev/lm_management
Introduces custom excluded phrases
2022-01-12 13:25:06 +08:00
zonble f1e56a7e01 Lets McBopomofoLM to accept NULL as the parameter in loadUserPhrases. 2022-01-12 13:17:41 +08:00
zonble 84fc2f068b Removes unused code and fixes a typo. 2022-01-12 13:16:10 +08:00
Weizhong Yang a.k.a zonble 819e1be8d6 Merge pull request #217 from lukhnos/fix-vertical-candidate-ui
Fix regression in vertical candidate UI
2022-01-12 12:52:19 +08:00
Lukhnos Liu 7c354a5b6c Fix regression in vertical candidate UI
The table view style must be set before it's added as the scroll view's
content view. See [1].

[1] https://github.com/openvanilla/McBopomofo/blob/1.1/Source/CandidateUI/VTVerticalCandidateController.m#L110
2022-01-11 20:43:31 -08:00
zonble abdf97f652 Adds McBopomofoLM as the facade of three language models.
- main language model
- user phrases
- user excluded phrases
2022-01-12 12:26:24 +08:00
zonble 56896625e3 Removes unused comments. 2022-01-12 01:17:39 +08:00
zonble cbd21cbe1d Updates localization. 2022-01-12 01:10:39 +08:00
zonble ea36061a41 Implements excluding punctuations. 2022-01-12 00:36:55 +08:00
zonble 9b485b799c Implements excluding phrases. 2022-01-12 00:16:55 +08:00
zonble 144d133463 Adds Language Model Manager.
The reference of the global language models were stored in the class
InputMethodController, however, the global models are global but not a
part of the input method controller, and the input method controller
only use one of the models (McBopomofo/Plain Bopomofo). I guess it
somehow violates SRP and there should be a better place for the global
models.
2022-01-11 17:12:58 +08:00
zonble f339948219 Fixes duplicated code and typos. 2022-01-11 13:46:29 +08:00
Weizhong Yang a.k.a zonble 11d33c0b42 Merge pull request #212 from zonble/dev/swiftify
Converts most of the Objective-C classes into Swift
2022-01-11 02:53:32 +08:00
Weizhong Yang a.k.a zonble b6ad33967a Merge pull request #211 from zonble/master
Fixes the bug that I forgot to create the user phrases folder.
2022-01-11 02:44:48 +08:00
zonble df3914eeed Fixes a minor bug in the new Swift app delegate. 2022-01-11 02:35:31 +08:00
zonble a7b2edcf26 Converts AppDelegate to Swift. 2022-01-11 02:22:13 +08:00
zonble 52bf2d67c5 Updates copyright information. 2022-01-11 01:13:28 +08:00
zonble 61e2751702 Converts candidate UI to a Swift package. 2022-01-11 01:07:17 +08:00
zonble 867a828722 Fixes minor layout issues. 2022-01-11 00:47:48 +08:00
zonble f7e927d67d Starts to use Swift candidate UI.
There are bugs still.
2022-01-11 00:30:02 +08:00
zonble a97cc5ca6c Converts VerticalCandidateController to Swift. 2022-01-11 00:03:32 +08:00
zonble 5aafe64751 Starts to convert candidate UI to Swift. 2022-01-10 22:01:40 +08:00
zonble ba6889fa63 Converts OVInputSourceHelper to Swift. 2022-01-10 22:01:40 +08:00
zonble 84849bdb3d Converts the preference and non modal view controller to Swift. 2022-01-10 22:01:40 +08:00
zonble 75a0f68a9c Fixes the bug that I forgot to create the user phrases folder.
There was a legacy user override model which creates a folder and a
plist file. If a user uses McBopomofo for years, the folder would
exist. However, when the old override model was removed, I forgot
to create the folder for the new user phrase file.

The bug would let the users with new installation of McBopomofo unable
to add user phrases.
2022-01-10 21:59:18 +08:00
zonble 6bdd2aab44 Fixes a bug on building the unigrams. 2022-01-09 13:00:19 -08:00
zonble b4276f0488 Fixes a bug on building the vector for unigrams from both global language model and user phrases. 2022-01-09 13:00:19 -08:00
zonble 1e5bad20c2 Removes unused references. 2022-01-09 08:38:32 -08:00
zonble 5b72e48a4e Minor fine-tunes on the preference window. 2022-01-09 08:38:32 -08:00
zonble 0af238ef79 Cleans-up unused logs. 2022-01-09 08:38:32 -08:00
zonble 3763688275 Fixes a typo. 2022-01-09 08:38:32 -08:00
zonble a5247d958c Makes it able to reload user phrases. 2022-01-09 08:38:32 -08:00
zonble e909dc20b5 Uses user phrases in the block builder. 2022-01-09 08:38:32 -08:00
zonble 6f761ecbcd Implements adding phrase from shift and arrow keys. 2022-01-09 08:38:32 -08:00
zonble 358462dff1 [WIP] Starts to work on the user phrases. 2022-01-09 08:38:32 -08:00
Weizhong Yang a.k.a zonble 39cdc7d73d Merge pull request #207 from openvanilla/rebased-user-override-model
Implements an exponential decay-based user candidate override model, rebased from #135
2022-01-07 13:20:52 +08:00
ovadmin 789d2a5687 計算選字事件時,若遇到常用標點,將標點視為句尾
如此一來標點後的單字詞,在計算時,等同於句首第一詞。
2022-01-06 18:28:37 -08:00
ovadmin aeb774a8ed 小幅重構重複的程式碼 2022-01-06 18:28:37 -08:00
ovadmin 2e8e78971c 傳統注音不要記住用戶選字 2022-01-06 18:28:37 -08:00
ovadmin eef6f8c0ce 加大用戶選字詞模型的容量跟半衰期 2022-01-06 18:28:37 -08:00
ovadmin 3e0e859feb 將用戶選字記憶機制整合入 InputMethodController 2022-01-06 18:28:37 -08:00
ovadmin d672136843 實作簡單的用戶選字記憶模型
這個模型基本上只是根據游標前的兩個 unigram 記憶當前的用戶選字。當有超過
一個以上的用戶選字時,則要給每個選字評分。評分標準是選字頻率乘上一個透過
半衰期遞減的最近選字經歷時間。如此一來我們在「少用但最近選過」及「常用但
最近少選」之間取得一個平衡。半衰期透過經驗法則決定。

目前這個簡易模型並不存入磁碟,因此下一次重開機後就會洗掉重來。目前這樣選
擇純粹是因為模型有半衰期,因此長時間存放後還是會遺忘。

這個模型的好處是對既有詞庫提供詞的影響很小,對於連續單字詞的 override 有
還不錯的幫助。如此對於人名、地名、公司名等專有名詞,應該可以減少選字的頻
率。這個模型應用起來的缺點是,如果用戶修改的字詞原來是個雙字詞,例如先前
的兩個 unigram 分別是 A, BB ,而用戶想改的是 BB 的第二個字,使選完後的三
個字分別是 A, B', C,這個 C 往往是記不起來的,但如果一開始用戶逐字選取,
亦即在 BB 只出現 B 時就選取 B' 然後再打 C ,則 A, B', C 這個組合往往能被
正確記憶。實際發生原因在此不討論,但跟底層所用的組字網架的架構有關。確實
要改進的話得要從底層重新架構來下手,但至少目前這個模型給的建議偏保守,不
至干擾原有的預設選字。衡諸得失,這個模型提供一些邊際上的改善,應該還是值
得採用的。
2022-01-06 18:28:37 -08:00
ovadmin a17438b67a 修正一些選字機制 C++ 檔案 #include 不完整的問題 2022-01-06 18:28:37 -08:00