Git Product home page Git Product logo

Comments (9)

siuze avatar siuze commented on August 26, 2024 5

细读了几天源码中查词的实现,定位到源码src/rime/dict/dictionary.cc下函数match_extra_code(),做如下修改:

删去
-  if (current_pos >= syll_graph.interpreted_length)
-   return 0;  // failure (possibly success for completion in the future)
替换为
+  if (current_pos >= syll_graph.interpreted_length)
+    return match_extra_code(extra_code, depth + 1,syll_graph, current_pos+1); //长词联想

可实现固态词典查询下输入4个及以上音节时的词汇预测,效果如下:
image

我计划将该功能使用enable_completion配置项进行开关,但是我代码水平很差,不知如何在这里引入配置更合适。目前比较愚蠢的做法是在script_translator.cc处读取config,并逐级传参到函数match_extra_code()中,详见该commit。这显得有些繁杂,若有更加优雅的实现,还望各位前辈不吝赐教。

对于排序和权重问题,需要对代码进行一些改动。否则因为这些候选项长度最长,会默认排序到最前面,排挤掉原匹配项。修改位置可见前文提到的commit。而预测候选项内部的排序我尚未细究。

另,输入小于4个音节时的词汇预测我暂未实现,这涉及到词典table中的多级索引,协调起来可能有些复杂。
又及,用户词典下的词汇预测尚未展开研究。

from librime.

LEOYoon-Tsaw avatar LEOYoon-Tsaw commented on August 26, 2024

duplicated #65

from librime.

lotem avatar lotem commented on August 26, 2024

長詞聯想(輸入前幾個音節)與前後詞聯想(上屏前一詞、候選提示後一詞)是兩個用戶交互和程序實現均不同的功能。

對於長詞聯想,在詞典查詢處,目前過濾掉了結果中有未完成音節(三音節以上)的詞典項,將其保留即可。

from librime.

sbxlmdsl avatar sbxlmdsl commented on August 26, 2024

前后词联想目前是怎么实现的呢,用Octagram吗?

from librime.

ieeegeee avatar ieeegeee commented on August 26, 2024

長詞聯想(輸入前幾個音節)與前後詞聯想(上屏前一詞、候選提示後一詞)是兩個用戶交互和程序實現均不同的功能。

對於長詞聯想,在詞典查詢處,目前過濾掉了結果中有未完成音節(三音節以上)的詞典項,將其保留即可。

请问这个选项是在配置文件里修改还是需要在源码里修改?

from librime.

ilupin avatar ilupin commented on August 26, 2024

長詞聯想(輸入前幾個音節)與前後詞聯想(上屏前一詞、候選提示後一詞)是兩個用戶交互和程序實現均不同的功能。
對於長詞聯想,在詞典查詢處,目前過濾掉了結果中有未完成音節(三音節以上)的詞典項,將其保留即可。

请问这个选项是在配置文件里修改还是需要在源码里修改?

@lotem 同问,能否提示一下具体位置 🙇

from librime.

siuze avatar siuze commented on August 26, 2024

@lotem 同问需要修改的具体位置,长词联想作为比较重要的功能,为何长期不加入功能配置

from librime.

sbxlmdsl avatar sbxlmdsl commented on August 26, 2024

用户词典下的词汇预测问题解决了吗?

from librime.

lotem avatar lotem commented on August 26, 2024

需要关注这类候选词的完整编码与输入串匹配部分的编码长度不一致的新情况。特别是检查联想词参与造词能否构造出正确编码。另外,还需要排除插入点不在编码末尾的情况,联想词也不适用。

from librime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.