Skip to content

Commit

Permalink
Update to v3.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
forFudan committed Sep 16, 2024
1 parent 608c451 commit b524d75
Show file tree
Hide file tree
Showing 93 changed files with 210,213 additions and 215,655 deletions.
10 changes: 10 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cd "D:\Dropbox\GitHub\yuhao\yulight"
python build_release.py

cd "D:\Dropbox\GitHub\yuhao\yustar"
python build_release.py

cd "D:\Dropbox\GitHub\yuhao\yujoy"
python build_release.py

cd "D:\Dropbox\GitHub\yuhao"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,20 @@ So a lua filter would be helpful to filter the frequently used
20240807: 重構並加入常用字前置代碼.
20240819: 前置常用漢字功能只對 CJK 内的漢字生效.
20240820: 前置常用漢字功能只在輸入爲四碼時方纔生效.
20240908: 加入前置極常用繁簡漢字功能.
------------------------------------------------------------------------
]]

local core = require("yuhao.yuhao_core")
local yuhao_charsets = require("yuhao.yuhao_charsets")
local set_of_frequent_chars = core.set_from_str(yuhao_charsets.frequent)
local set_of_ubiquitous_chars = core.set_from_str(yuhao_charsets.ubiquitous)
local set_of_common_chars = core.set_from_str(yuhao_charsets.common)
local set_of_tonggui_chars = core.set_from_str(yuhao_charsets.tonggui)
local set_of_harmonic_chars = core.set_from_str(yuhao_charsets.harmonic)

--- 前置極常用繁簡漢字
local function yuhao_charset_filter_prioritization(input, env)
local switch_on = env.engine.context:get_option("yuhao_charset_filter_prioritization")
--- 前置器
local function yuhao_charset_prioritizer(input, env, option, charset)
local switch_on = env.engine.context:get_option(option)
local chars_of_low_priority = {}
local length_of_input_is_4 = (string.len(env.engine.context.input) == 4)
if not length_of_input_is_4 then
Expand All @@ -63,7 +64,7 @@ local function yuhao_charset_filter_prioritization(input, env)
end
if length_of_input_is_4 then
for cand in input:iter() do
local is_charset_or_not_cjk = core.string_is_in_set(cand.text, set_of_frequent_chars)
local is_charset_or_not_cjk = core.string_is_in_set(cand.text, charset)
-- 二種情況顯示字符: (1) 極常用 (2) 過濾器關閉
if is_charset_or_not_cjk or not switch_on then
yield(cand)
Expand All @@ -78,6 +79,16 @@ local function yuhao_charset_filter_prioritization(input, env)
end
end

--- 前置極常用繁簡漢字
local function yuhao_charset_prioritizer_ubiquitous(input, env)
yuhao_charset_prioritizer(input, env, "yuhao_charset_prioritizer_ubiquitous", set_of_ubiquitous_chars)
end

--- 前置常用繁簡漢字
local function yuhao_charset_prioritizer_common(input, env)
yuhao_charset_prioritizer(input, env, "yuhao_charset_prioritizer_common", set_of_common_chars)
end

local function yuhao_charset_filter_common(input, env)
local switch_on = env.engine.context:get_option("yuhao_charset_filter_common")
for cand in input:iter() do
Expand Down Expand Up @@ -112,7 +123,8 @@ local function yuhao_charset_filter_harmonic(input, env)
end

return {
yuhao_charset_filter_prioritization = yuhao_charset_filter_prioritization,
yuhao_charset_prioritizer_ubiquitous = yuhao_charset_prioritizer_ubiquitous,
yuhao_charset_prioritizer_common = yuhao_charset_prioritizer_common,
yuhao_charset_filter_common = yuhao_charset_filter_common,
yuhao_charset_filter_tonggui = yuhao_charset_filter_tonggui,
yuhao_charset_filter_harmonic = yuhao_charset_filter_harmonic,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
local yuhao_charset_filter = require("yuhao.yuhao_charset_filter")
return yuhao_charset_filter.yuhao_charset_filter_common
return yuhao_charset_filter.yuhao_charset_filter_common
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
local yuhao_charset_filter = require("yuhao.yuhao_charset_filter")
return yuhao_charset_filter.yuhao_charset_filter_prioritization
return yuhao_charset_filter.yuhao_charset_prioritizer_common
2 changes: 2 additions & 0 deletions lua/yuhao/yuhao_charset_prioritizer_ubiquitous.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
local yuhao_charset_filter = require("yuhao.yuhao_charset_filter")
return yuhao_charset_filter.yuhao_charset_prioritizer_ubiquitous
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International
介紹:
常用漢字字符集包括:
- 極常用繁簡漢字 (前三千簡化字 + 前三千臺標字 + 前三千陸標繁).
- 極常用繁簡漢字(繁簡字頻分别位於前 3000 的漢字)
- 常用繁簡漢字 (通用規範漢字 + 國字常用字 + 大陸繁體字).
- 《通用規範漢字表》中定義的 8500 字.
- 《通用規範漢字表》中定義的 8150 字.
- 《通用規範漢字表》中定義漢字所對應的大陸標準繁體漢字.
-------------------------
]]

local this = {}

this.frequent = [[
this.ubiquitous = [[
Expand Down Expand Up @@ -15868,52 +15868,6 @@ this.common = [[
𠂤
𧘇
𬺰
𠂇
丿
]]

this.tonggui = [[
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit b524d75

Please sign in to comment.