打造背单词工具 Goldendict+Anki

最近发现本地词典工具Goldendict挺好使,还发现它可以连接Anki。下文就记录如何连接Goldendict和anki。

1. 根据文档,完成基本配置

文档地址:https://xiaoyifang.github.io/goldendict-ng/topic_anki/

2. DEBUG篇

文档配置完总会有各种问题。Debug主要有两个点

1)GoldenDict的消息框

GoldenDict消息框

Goldendict界面的左下角就有提示。

2)AnkiConnect的log记录

Goldendict和Anki是通过ankiweb这个插件进行通信的。
Ctrl+Shift+A打开插件界面,在
Anki插件设置

右下角,有个插件设置。里面就是配置文件。我的配置如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{

"apiKey": null,

"apiLogPath": "G://@GoldenDict//AnkiLog//log.txt",

"ignoreOriginList": [],

"webBindAddress": "127.0.0.1",

"webBindPort": 10110,

"webCorsOriginList": [

"http://localhost"

]

}

其中的apiLogPath就是日志目录。比如我尝试发送到anki两次:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
[request]
{
"action": "addNote",
"params": {
"note": {
"deckName": "English",
"fields": {
"back": "god /\u0261\u0252d $ \u0261\u0251\u02d0d/ \u25cf\u25cf\u25cf S1 W1 noun \r<br>N1. \u2192 God\r<br>2\u2003 COUNTABLE a male spirit or being who is believed by some religions to control the world or part of it, or who represents a particular quality \u2192 goddess\r<br>god of\r<br> Mars, the god of war\r<br>\u6218\u795e\u739b\u5c14\u65af\r<br>Roman/Greek etc god\r<br> Zeus was one of the most well-known Greek gods.\r<br>3\u2003 God\u2019s gift to somebody/somethingATTRACTsomeone who thinks they are perfect or extremely attractive \u2013 used to show disapproval\r<br> Paul thinks he\u2019s God\u2019s gift to women.\r<br>4\u2003 COUNTABLE someone who is admired very much\r<br> To his fans he is a god.",
"front": "god",
"sentence": "<b>god</b>en"
},
"modelName": "word",
"options": {
"allowDuplicate": true
},
"tags": []
}
},
"version": 6
}

[reply]
{
"error": "deck was not found: English",
"result": null
}

[request]
{
"action": "addNote",
"params": {
"note": {
"deckName": "English",
"fields": {
"back": "god /\u0261\u0252d $ \u0261\u0251\u02d0d/ \u25cf\u25cf\u25cf S1 W1 noun \r<br>N1. \u2192 God\r<br>2\u2003 COUNTABLE a male spirit or being who is believed by some religions to control the world or part of it, or who represents a particular quality \u2192 goddess\r<br>god of\r<br> Mars, the god of war\r<br>\u6218\u795e\u739b\u5c14\u65af\r<br>Roman/Greek etc god\r<br> Zeus was one of the most well-known Greek gods.\r<br>3\u2003 God\u2019s gift to somebody/somethingATTRACTsomeone who thinks they are perfect or extremely attractive \u2013 used to show disapproval\r<br> Paul thinks he\u2019s God\u2019s gift to women.\r<br>4\u2003 COUNTABLE someone who is admired very much\r<br> To his fans he is a god.",
"front": "god",
"sentence": "<b>god</b>en"
},
"modelName": "word",
"options": {
"allowDuplicate": true
},
"tags": []
}
},
"version": 6
}

[reply]
{
"error": null,
"result": 1703842707231
}

可以看到第一次reply提示deck未创建,创建deck后,就不会报错了。anki里也正常显示。


打造背单词工具 Goldendict+Anki
http://blog.jiuge.host/post/20231229174800.html
作者
Pigeon.🕊
发布于
2023年12月29日
许可协议
CC BY-NC-SA 3.0