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

Add CNKI Segmented Translation #762

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Conversation

sasaju
Copy link
Contributor

@sasaju sasaju commented Mar 25, 2024

Split sentences by periods, question marks, and exclamation points and translate them block by block. At the same time, I found that the limit of CNKI is 800 characters, and 1000 characters seems to be inexplicably truncated.
通过句号、问号、叹号分割句子,逐块翻译。同时我发现似乎CNKI的限制是800字符,1000字符似乎会莫名截断。

@sasaju sasaju mentioned this pull request Mar 25, 2024
1 task
@windingwind
Copy link
Owner

谢谢。可考虑相关代码放在cnki.ts里,避免大量重复代码

@sasaju
Copy link
Contributor Author

sasaju commented Mar 25, 2024

谢谢。可考虑相关代码放在cnki.ts里,避免大量重复代码

行,我再处理一下

@sasaju
Copy link
Contributor Author

sasaju commented Apr 7, 2024

已移除重复代码

@windingwind
Copy link
Owner

感觉单独作为一个服务不是很合适。我倾向拼接与否作为cnki的一个选项(参考src/modules/settings/cnki.ts),根据配置决定是否使用分割模式

@sasaju
Copy link
Contributor Author

sasaju commented Apr 9, 2024

那倒也是,我再处理一下

@sasaju
Copy link
Contributor Author

sasaju commented Apr 15, 2024

已合并至cnki.ts,同时添加了设置选项。
image

@windingwind
Copy link
Owner

谢谢。我不确定弹窗是否需要,从我的体验来说进度弹窗会干扰注意力,我倾向于去掉。欢迎讨论

@sasaju
Copy link
Contributor Author

sasaju commented Apr 23, 2024

我是考虑到如果分段过多可能会明显感觉到翻译缓慢,也可能会影响使用体验。那就超过5段或者4段再进行提示?

@shmilee
Copy link

shmilee commented May 19, 2024

经网页上测试,确实是800字符的限制,并且是英文800,如果不小心掺入一个汉字(乱码)或者中英混合的情况,限制就是400了。
所以800可能需要视情况设定,不好硬编码。说不定将来这限制还有变动。

@shmilee
Copy link

shmilee commented May 19, 2024

弹窗提示进度,在多段翻译缓慢的情况下,感觉是优点。用户在等待结果,如果缺少进度提示,内心的不确定性是在增加的。(我日常使用中遇到的一种情况是,因网络环境的暂时改变,翻译会在很长一段时间后才告诉我服务不可用,等待时一点提示也没有)
所以我支持 超过几段再进行提示(具体超过几段,请求几次,对应预估的等待时间),或者进度提示也加个开关,由用户决定。

另一个想法。我看现在的代码是在所有分段翻译完成后,才统一组装给 data.result,有较长的等待时间,所以才有了进度提示的需求。如果翻译一段,返回一段,不断向 data.result 追加翻译结果,此时注意力都集中在翻译结果窗口,就不需要进度提示了。
我对插件其他实现不了解,不知道追加更新翻译结果,容不容易实现。

@sasaju
Copy link
Contributor Author

sasaju commented May 19, 2024

另一个想法。我看现在的代码是在所有分段翻译完成后,才统一组装给 data.result,有较长的等待时间,所以才有了进度提示的需求。如果翻译一段,返回一段,不断向 data.result 追加翻译结果,此时注意力都集中在翻译结果窗口,就不需要进度提示了。 我对插件其他实现不了解,不知道追加更新翻译结果,容不容易实现。

好建议,应该是可以实现的,过一段时间我尝试实现一下

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

Successfully merging this pull request may close these issues.

None yet

3 participants