Skip to content
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

关于多方案混合输入情况下info日志中有很多Oops, got a futile translation.的疑问 #569

Closed
lliding opened this issue Sep 13, 2022 · 3 comments · Fixed by #623

Comments

@lliding
Copy link

lliding commented Sep 13, 2022

Is your feature request related to a problem? Please describe.

我目前使用的输入法是 86 五笔和英文混合的输入法,英文用以下方式混入:

engine:
  ...
  translators:
    ...
    - table_translator@english
...

english:
  dictionary: easy_en
  spelling_hints: 9
  enable_completion: true
  enable_sentence: false
  enable_user_dict: false
  initial_quality: -1

我注意到 info log 中出现了很多很多这样的记录:

engine.cc:203] Oops, got a futile translation.

我定位了一下这个日志的来源,发现在这里:

librime/src/rime/engine.cc

Lines 203 to 206 in 87e4c73

if (translation->exhausted()) {
LOG(INFO) << "Oops, got a futile translation.";
continue;
}

似乎,只要打词库没有的条目就会出这个日志?

在成功向记事本输入 previous 这个单词之后 ( 键入顺序是 [p] [r] [e] [v] [i] [o] [u] [s] ),futile translation 这个记录一共在 info log 中出现了 6 次。

我注意到 pr 在五笔中是 evious 是剩下的 6 个字母。pre prev previ previo previou previous 这 6 个组合在 86 五笔的词库中并没有对应条目,而在英文输入法中有对应条目。那么这个记录多次出现的原因应该是,用户当前输入的字母组合无法在方案指定的词库中搜索到对应词条。单词 previous 从字母 e 开始,用户一共键入 6 次,但这六次产生的所有字母组合在五笔词库中都没有对应条目,所以出现了 6 条这样的日志。

Describe the solution you'd like

由于这条日志重复了太多次以至于日志文件的体积极大,我又没有在文档中找到对应的配置条目来控制日志行为。所以来这里问一下,有没有办法控制一下这个日志条目的出现频率?

如果没法控制的话,想要减小日志体积是不是只能拆分输入法?

(为了避免在需要对两个输入方案的词库做匹配的时候,一个词库里有完全匹配的条目,一个词库里有不完全匹配的条目,然后输到一半发现当前输入的字母组合在其中一个词库找不到匹配的条目,最后疯狂打 log 的问题。)

比如我的情况就是把 86 五笔和英文输入法分到两个输入法里,需要的时候来回切?平时用 86 五笔少打一点词库没有的条目,这样 futile translation 出现少一点,需要大量打英文的时候切英文输入法或者直接 ascii 模式?

Describe alternatives you've considered

未来会考虑弱化一下这个日志条目的存在感吗?

Additional context

nothing else.

@lotem
Copy link
Member

lotem commented Oct 12, 2022

挺好的,可能揭示了代碼或配置中真正的邏輯問題。
詞典未命中輸入的編碼,這是極常見的情況,按理不會導致打印這條日誌。
如果能排除外部干擾,比如插件程序實現了不正確的過濾器,那麼這個問題值得推敲。
有時間好好研究下。

@lliding
Copy link
Author

lliding commented Oct 13, 2022

rime-issue-569.zip

附件是出现这个问题的 Rime 配置,可能有助于研究这个问题。

我现在把配置里的中英文输入法拆开来用了,日志文件小很多。

@siuze
Copy link
Contributor

siuze commented Feb 27, 2023

我在使用多个Translator实现中英混输时也会出现该问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants