-
Notifications
You must be signed in to change notification settings - Fork 614
feat(script_translator): learn new phrases automatically from segmentations #1014
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ations * separate new phrases by segmentations rather than using the sentence as a whole, while committing into user_dictionary * join adjacent segments if the result is no longer than core_word_length * ignore the phrases which are longer than max_word_length
…than max_word_length
@lotem This may be a useful feature. Please check if it is needed generally. |
還沒細看。 我最初對分詞的構想是,空格確認可以看作分詞的標誌。 所舉的例子,固然用分段學習的策略更好;我認爲需要觀察反例,因爲不可避免的選字,而學到不完整的片段。 |
fluency editor模式下,如果整句輸入方式,即一次性輸入整句的拼音,然後空格上屏,如果其中有推測不符合預期,再回過頭來進一步通過光標斷句和人工選詞調整,回顧式調整的方式,此時中間鍵入的空格似乎是被看作為了選詞動作(kSelected),只有最後空格被看作了確認(kConfirmed)。這裡的處理邏輯,應該是和express editor類似的。而新學習詞彙或短語的邊界,原始行為應該是通過確認或當前語言不可識別字符來標記的。 |
根據嘗試fluency和express editor的體驗,底層基於script_translator處理詞彙合併或新詞學習的邏輯應該是相同的;而且也都分為逐詞輸入方式和整句輸入方式。逐詞輸入的方式(包括短語),RIME處理已經可堪稱完美了;當前主要考慮,整句輸入方式。
在整句輸入方式下,要高正確率推測出預期中的字詞,並且在推測失敗的情況下,能夠提供光標斷句和人工選詞干預的機制,這確實是一個極為困難的任務。即使目前那些基於大語言模型的主流在線輸入法,也很難做到完全準確的推斷出用戶預期的字詞,而且在沒有準確推斷出正確字詞的情況下,它們也不能如同RIME引擎一樣,可提供讓用戶能夠通過光標斷句或人工選詞干預的能力。 |
值得研究。 這個值得做,也是我曾經想做的。 另一個思路是不認新詞,而記錄用戶輸入的字級二元關係,早先寫過,效果似乎也不錯。 |
呼喚 @rime/engine 小夥伴們,誰有興趣來鑑定鑑定? |
贊同「從句子中得到詞語」的想法:
一些疑問:
|
更新的PR,採用滑動窗口拼接新詞,將產生所有可能符合長度條件新詞。這樣
參數 core_word_length, 控制由選詞拼接而成新詞的長度上限。所以當core_word_length=2時,將會合併「字級」。此時會因為「字級」頻率遠低於其同碼詞「自己」,所以將產生“無論如何重複“這個過程,都無法造出「字級關聯」這個整詞的表象。 在更新後PR中,若
更新的PR,使
參數名 新產生的用戶詞彙,無論是否核心詞彙,其長度均不可超過「最大詞彙長度」,由配置
|
优秀啊。 忽然想到我曾写死一段两字词、三字词逐字选择后造词、不给字调频的特判逻辑。 |
* concatenate adjacent segments resulting in new words of length no more than core_word_length * ensure functionalities of core_word_length and max_word_length orthogonal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
试用了一段时间,感觉不错,推动一下合并这个功能。
⿱艸㞢佬的肯定! |
感謝 @bgzhao66 改進的算法。 大家都可以建議建議,哪些方案適合用這個算法。 |
Feature
feat(script_translator): learn new phrases automatically from segmentations
separate new phrases by segmentations rather than using the sentence
as a whole, while committing into user_dictionary
join adjacent segments if the result is no longer than core_word_length
ignore the phrases which are longer than max_word_length
Examples
在整句輸入時,通過斷句(由光標或選詞等產生)學習新詞,而不是學習整句作為新詞,然後寫入用戶詞典。
例如: 在下表中,句子中的符號‘|’,表示斷句的位置;且參數
max_word_length
和core_word_length
,分別配置為7和4.說明:
core_word_length
,將會合併成一個詞;其餘每個片段(segment)生成一個詞。max_word_length
,則記錄到用戶詞典中,尤其是作為學到的新詞;否則,只更新其構成元素(elements)的權重。core_word_length
生效的取值,不超過參數max_word_length
的取值。core_word_length
為大於0的值時,從斷句片段學習新詞的功能開啟,否則維持原來行為方式;若配置max_word_length
為大於0 的值時,將按長度過濾新生成的用戶詞彙,否則維持原來行為方式。Unit test
Manual test
Code Review
Additional Info