Comments (8)
Thank you for pointing out the API.
Typing has to be very precise because one of the goals of our project is to let users know what the correct Jyutping is. However, you can always customize the regex in jyut6ping3.schema.yaml
to get more fuzzy results, like 你 (nei -> lei).
While I am concerned that the API does not use correct Jyutping, it could be quite useful for typing rare words, new words and long sentences that are not presented in rime-cantonese dictionary. And calling the API from rime is possible, see hchunhui/librime-cloud.
from rime-cantonese.
Sample lua script:
local json = require("json")
local http = require("socket.http")
local ltn12 = require("ltn12")
local function translator(input, seg)
local url = 'http://inputtools.google.com/request?text=' .. input .. '&itc=yue-hant-t-i0-und&num=1&cp=0&cs=1&ie=utf-8&oe=utf-8&app=test'
local res = {}
local _ = http.request{url=url, sink=ltn12.sink.table(res)}
res = table.concat(res)
local success, j = pcall(json.decode, res)
if success and j[1] == "SUCCESS" and j[2] and j[2][1] and j[2][1][2] and j[2][1][2][1] then
local _e = nil
if j[2][1][4].matched_length then
_e = seg.start + j[2][1][4].matched_length[1]
else
_e = seg._end
end
local c = Candidate("simple", seg.start, _e, j[2][1][2][1], "(Google Cloud)")
c.quality = 2
yield(c)
end
end
return translator
Result (the first candidate):
However, I have tried many cases, and in most cases the API gives unexpected results due to its fuzziness. Perhaps the API would not be as useful as I had expected.
from rime-cantonese.
Thanks for your appreciation. As for "typing has to be very precise to get the character", we actually make it be so deliberately. Yes we are prescriptive and we believe that input method is the most efficient tool to help people learn the correct and precise spellings. The overly broad support of fuzzy input in Gboard Cantonese is actually a downside and one of our biggest complaints, because it might mislead people to incorrect/irregular spellings and pronunciations. A redundant amount of loose matching also brings too many candidate words in the menu which significantly lowers the typing speed. So by default you need to type the precise/fully-correct spelling to get the character, this is designed on purpose.
But as described by @ayaka14732 above, you can always change the regex in jyut6ping3.schema.yaml
file to support fuzzy input. Instructions are in the README doc. Please let us know if you still have any difficulties or issues.
As for using the Google api, can we know the purpose of forking google's api into rime? What are you trying to achieve with it?
from rime-cantonese.
@ayaka14732 我記得用雲輸入api呢個嘢好似以前有人做過(就係你做嘅?),不過好似唔係用google,係將百度雲輸入整落rime入邊
from rime-cantonese.
@g0rdonL Do you know whether there is a stricter version (using correct Jyutping while performing basic correction) of the API?
from rime-cantonese.
@ayaka14732 unfortunately no. I got the link from checking the network calls when using the google input tools chrome extension.
from rime-cantonese.
@ayaka14732 我記得用雲輸入api呢個嘢好似以前有人做過(就係你做嘅?),不過好似唔係用google,係將百度雲輸入整落rime入邊
就係 hchunhui/librime-cloud,不過佢凈係支援普通話。
from rime-cantonese.
@ayaka14732 我記得用雲輸入api呢個嘢好似以前有人做過(就係你做嘅?),不過好似唔係用google,係將百度雲輸入整落rime入邊
就係 hchunhui/librime-cloud,不過佢凈係支援普通話。
其實我仲係唔知樓主想我哋做乜,如果係加入 google 雲輸入嘅話就直接打個 won't fix 就得嘞,我哋反正之後都要聯繫Google 叫佢哋加粵拼
from rime-cantonese.
Related Issues (20)
- (schema)建議以WASDZ作爲筆畫輸入鍵位 HOT 3
- 點樣設置默認爲簡體中文,而家每一次切換應用或者restart電腦都要使用Ctrl+`來設置,好麻煩 HOT 1
- M1 Mac WhatsApp 轉唔到 Squirrel 輸入法打字 HOT 4
- 加容錯 gu --> gwu 同 ku --> kwu HOT 4
- Duplicated entries in jyut6ping3.words.dict.yaml HOT 12
- 关于emoji HOT 4
- Cannot change to jyutping input or view settings after upgrading to 0.16.2 HOT 7
- Move `{lettered, maps, phrase}.dict.yaml` to upstream? HOT 2
- Enomerous compile error with `rime_deployer --compile` HOT 3
- 有關「𧒽」字 HOT 7
- 步驟zau發音的疑問 HOT 2
- 小狼毫粵語不支持Windows 11 touch keyboard HOT 4
- jyut6ping3.phrase.dict.yaml wrong words HOT 4
- Rime for PC 嘅「中英文语言状态」改为显示「粤」「英」 HOT 1
- 请支持Linux,ibus rime HOT 1
- 问下,我安装了iDvel / rime-ice 如果再安装这个,会不会有冲突 HOT 1
- Rime does not work in Minecraft HOT 5
- 小狼毫 Windows 10 Kiosk mode cannot use; sub-windows cannot pop up HOT 2
- Error loading table for dictionary 'loengfan' HOT 1
- 筆畫反查功能有bug HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rime-cantonese.