Commit Graph

137 Commits

Author SHA1 Message Date
zonble 9612aa6ba0 Code clean-up. 2022-01-28 16:51:25 +08:00
zonble b13da10ec0 Code clean-up. 2022-01-28 16:16:52 +08:00
zonble 0bc9468ba2 Splits Input Method controller into two classes. 2022-01-28 15:02:00 +08:00
zonble dd803b6c31 Removes logs and add copyright information. 2022-01-28 04:40:53 +08:00
zonble 056ffeabfd Tunes the interface. 2022-01-28 04:04:44 +08:00
zonble 87702f76c5 Cleans-up the interface. 2022-01-28 03:18:10 +08:00
zonble e17d06fd2a Fixes the cursor index when choosing candidates. 2022-01-28 01:58:25 +08:00
zonble 9351d877ba Fixes the issue on presenting the candidate window. 2022-01-28 01:44:50 +08:00
zonble fc0c077193 Fixes the bug on handling arrow keys. 2022-01-28 01:35:15 +08:00
zonble 2bbaa4a793 Fixes NSCoding exceptions. 2022-01-28 00:23:31 +08:00
zonble 56c393cefa Prevents using global state as possible. 2022-01-27 23:19:27 +08:00
zonble 1ad9e23918 Refactors the input controller. 2022-01-27 22:54:53 +08:00
zonble 6fe2fc59f3 Moves the way to render attributed string to the states. 2022-01-24 21:47:24 +08:00
zonble 82a916c433 Adds a new file KeyHandler.swift to start to break input controller to testable modules. 2022-01-24 17:46:34 +08:00
zonble 177cba5d56 [WIP] Starts to extract input states from the input controller. 2022-01-24 02:13:18 +08:00
Weizhong Yang a.k.a zonble 777994edcc Merge pull request #245 from lukhnos/update-copyright-headers
Update copyright headers (fixes #213)
2022-01-19 13:29:23 +08:00
Lukhnos Liu 75f321f088 Update copyright headers (fixes #213) 2022-01-18 14:21:55 -08:00
zonble 7e2d3df5ba Prevents users from adding custom phrases with more than 6 characters.
Also fixes typos.
2022-01-19 00:49:50 +08:00
zonble d2c039c42d Notifies the users it is not suggested to add phrase when model is converted. 2022-01-18 22:19:25 +08:00
zonble aa9c31ffcf Fixes the location of the tooltip. 2022-01-18 22:04:09 +08:00
zonble 0d80d28e0e Formats Swift code. 2022-01-18 21:16:07 +08:00
zonble 29813f93e5 Adds test cases. 2022-01-18 17:05:51 +08:00
zonble e9b1a8ad4a Removes unused comments. 2022-01-17 00:55:36 +08:00
zonble a75c7b7086 Allows users to type Latin letters while using shift + letter keys.
Fixes issue #162.
2022-01-17 00:48:29 +08:00
zonble 4e56f350e8 Fixes a wrong API call. 2022-01-16 15:04:20 +08:00
zonble b627e8e3b6 Adds an option to let users to choose Chinse conversion style.
Option 0: converts the output.
Option 1: converts the models.
2022-01-16 15:04:20 +08:00
zonble 136ac34f22 Introduces in-place phrase replacement.
Since we have implemented the functions to add and exlcude phrases, the
commit allows users to use a table to change the output of a phrase
without changing its BPMF reading and score, when the "phrase replacement"
mode is on.

It could help users to switch a specific input scenario and the ordinary
one. For example, if a user wants to work on financial Chinese numbers
like 壹、貳、參, he or she may want the characters to have higher score
as the normal numbers like 一、二、三. The commit can let the users to
temporarily replace 一、二、三 to 壹、貳、參 by just turn on "phrase
replacement" mode and prepare a custom table.

The conversion is not done on the output phase like how we do
Traditional/Simplified Chinese conversion. What the phrase replacement
table does is to slightly modify the language model. The replacement
takes place on walking the nodes and candidates list.

A user can enable the mode and edit the table from the input menu. Since
the function is quite advanced, the menu items are hidden until the user
holds the option key.

The table is a plain text file. Each line contains a "from" and "to".
For example

```
一 壹
```

However, if the user also want all other phrase contain 一 to become 壹,
all of the phrases have to be built into the table

```
一百 壹佰
一千 壹仟
一萬 壹萬
一百萬 壹百萬
```
2022-01-15 06:23:09 +08:00
zonble 7edf011e42 Fixes a typo. 2022-01-14 22:36:58 +08:00
zonble 5ce581e0c6 Brings back VXHanConvert. 2022-01-14 22:15:17 +08:00
zonble aa325f73aa Fixes the typo for the enum of McBopomofo keys. 2022-01-14 20:18:45 +08:00
zonble 95648caa0c Simplifies the code to build the input menu. 2022-01-14 19:55:08 +08:00
zonble d11daacbd2 Refactors the keyboard layout enum. 2022-01-14 19:47:53 +08:00
zonble 9faed2153f Uses property wrappers to manage preferences. 2022-01-14 18:06:26 +08:00
zonble fcdd59dd6b Wraps OpenCCBridge into a SPM package. 2022-01-14 00:57:41 +08:00
zonble e01eb46c9f Wraps InputSourceHelper to a SPM package. 2022-01-14 00:43:21 +08:00
zonble d4772ffa99 Adds notifier UI to notify user Chinese conversion on/off. 2022-01-13 23:38:56 +08:00
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
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
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 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
zonble a7b2edcf26 Converts AppDelegate to Swift. 2022-01-11 02:22:13 +08:00
zonble 61e2751702 Converts candidate UI to a Swift package. 2022-01-11 01:07:17 +08:00