Coder Social home page Coder Social logo

dictionary-overlay's Introduction

Dictionary-overlay

目标

辅助英文较弱的Emacser 进行英文阅读。提供了两种能力:

  1. 生词本提示:自定义“生词本”,阅读英文文章时,通过 overlay 给生词添加中文翻译。
  2. 透析阅读法:自定义“熟词本”,阅读英文文章时,通过overlay 翻译当前文章所有未标记为“熟词”的单词

    images/2022-11-15_21-23-58_screenshot.png

安装

用于Emacs 与外部应用进行 websocket 通信

Python 相关包

插件通过python 编写,需要安装 python3

  1. google-translate 用于网络翻译,非必选,可以用 crow-translate 替换

你可以使用 dictionary-overlay-install 来安装相关的 python 包(不包括google-translate)。

网络翻译

默认会使用sdcv 本地词典翻译。当单词在本地词典未找到时,会使用网络翻译,目前支持:

  1. crow-translate
  2. google-translate

你可以使用: dictionary-overlay-install-google-translate 来安装 google-translate

下载 dictionary-overlay

git clone --depth=1 -b main https://github.com/ginqi7/dictionary-overlay ~/.emacs.d/site-lisp/dictionary-overlay/

添加下面配置到 ~/.emacs

(add-to-list 'load-path "~/.emacs.d/site-lisp/dictionary-overlay/")
(require 'dictionary-overlay)

命令

命令说明
dictionary-overlay-start启动 dictionary-overlay 应用
dictionary-overlay-restart重启 dictionary-overlay 应用
dictionary-overlay-render-buffer使用翻译渲染当前buffer
dictionary-overlay-jump-next-unkown-word跳转到下一个生词
dictionary-overlay-jump-prev-unkown-word跳转到上一个生词
dictionary-overlay-mark-word-know标记当前单词为“已知”
dictionary-overlay-mark-word-unknow标记当前单词为“生词”
dictionary-overlay-mark-buffer标签当前buffer 中所有未标记为“生词”的单词全为“已知”
dictionary-overlay-install安装dictionary-overlay 所依赖的必选python 包
dictionary-overlay-install-google-translate安装 google-translate

选项

选项说明
dictionary-overlay-just-unknown-wordst 时使用“生词本”模式,nil 为“透析阅读”模式,默认为t
dictionary-overlay-user-data-directory用户数据存放的目录,默认值为:“~/.emacs.d/dictionary-overlay-data”

使用方法探讨

默认使用“生词本”模式,阅读英文文章时,需要手动添加生词( dictionary-overlay-mark-word-unknown )。可以和你的“查询单词”的快捷键保持在一起。那么你下次遇到生词时,会自动展示出生词。

当你阅读完一篇文章以后,可以把当前buffer 中所有未标记为unknown 的单词标记为known ( dictionary-overlay-mark-buffer )

当一个生词反复出现,你觉得自己已经认识了它,可以标记为 known ( dictionary-overlay-mark-word-known ),下次不再展示翻译。

当你阅读了足够多的文章,你应该积累了一定量的 know-words ,此时,或许你可以尝试使用”透析阅读法”( (setq dictionary-overlay-just-unknown-words nil) )将自动展示,“或许”你不认识的单词。

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.