Reniastyc de El Magnifico

Results 8 comments of Reniastyc de El Magnifico

如果只谈实现,其实设计成AaAbAzBaBbBz,再用拼写运算 ```yaml xform/(.)(.)(.)(.)(.)(.)/$1$2$3$4$6/ # 即,如果有六码忽略第五码 ``` 能对非自造词实现,但自造词又不能拼写运算,就没办法了

使用Lua腳本實現了這一功能,代碼如下: ```lua local full_sym = { ",", "。", "、", "・", "|", "/", "\", "[", "]", "~", "{", "}" } local full_com = "〔全角〕" local half_sym = { ",", ".", "、",...

![图片](https://user-images.githubusercontent.com/37499529/150626629-87d92f10-c23b-44c0-8085-67bdb2c5f8b7.png) ![图片](https://user-images.githubusercontent.com/37499529/150626643-cd4d02b7-fc9b-4f38-baf5-ccc87cc06be7.png) 效果大致就是這樣

想到了一種新的實現方案以完成以詞定字的要求。 起因是想到當需要依賴於多字詞確定中間某字時,依靠通常的思路似乎是無法實現的。比如,想要依靠「魑魅魍魎」一詞定出「魍」(實際上可以依靠「魍魎」一詞來定,此處僅僅用於舉例)。 於是,我想到使用Lua腳本的過濾器(lua_filter)來實現我所想要的功能。下面這張是實現後的效果: ![图片](https://user-images.githubusercontent.com/37499529/150639114-e9758baa-f5c2-4c71-885a-d58ef2c0a7de.png) 雖然所用的輸入方案是在下依靠「地球拼音」及「自然碼雙拼」拼湊出的「自然碼地球雙拼」,不過原理相通,想必也可用於其他輸入法。 在配置腳本之前,首先確定一個用於響應「以詞定字」的輸入碼,並將其列入輸入方案的字母表中。 ```yaml speller: alphabet: 'zyxwvutsrqponmlkjihgfedcba-;/.\?' ``` 此處選擇的是問號「?」。 之後在字典中加入一箇對應於該輸入碼的條目: ```yaml ※ ? ``` 確保輸入碼與輸出碼唯一。 準備完畢後可以配置腳本,核心思路即判斷候選中是否存在該特別輸出(此處爲「※」),存在則將候選分割,並調整註釋: ```lua local function filter(input) for cand in input:iter() do local str...

按照剛纔的思路,對代碼稍加修改,甚至可以方便應對需要定位的詞不在首位的情形: ![图片](https://user-images.githubusercontent.com/37499529/150642032-33defc56-68b4-4d5f-a504-01ee65c9eca0.png) ```lua local function filter(input) local valid = false for cand in input:iter() do local str = cand.text if utf8sub(str, -1) == "※" then str = utf8sub(str, 1, -1)...

上面的輸入方案已經上傳到:[](url)https://github.com/Reniastyc/rime-double-terra 附有簡要說明和安裝方案。

實現方案非常繞,首先需要修改輸入方案中的拼寫運算 ```yaml speller: alphabet: 'zyxwvutsrqponmlkjihgfedcba,.' finals: ',.' delimiter: " '" algebra: - derive/^(.+)$/$1,/ - derive/^(.+)$/$1\./ ``` 這樣能夠讓輸入「,」「.」不會影響輸出結果。 之後則分別製作一箇lua_translator和一箇lua_filter ```lua local function sort_translator(input, seg) if (string.sub(input, -1) == ",") then yield(Candidate("sort",...

不知道有沒有朋友能指點更好的實現方案