wordflow-cli 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wordflow_cli-0.1.4/LICENSE +21 -0
- wordflow_cli-0.1.4/PKG-INFO +195 -0
- wordflow_cli-0.1.4/README.md +174 -0
- wordflow_cli-0.1.4/pyproject.toml +38 -0
- wordflow_cli-0.1.4/setup.cfg +4 -0
- wordflow_cli-0.1.4/src/wordflow/__init__.py +1 -0
- wordflow_cli-0.1.4/src/wordflow/anki_flashcard.py +283 -0
- wordflow_cli-0.1.4/src/wordflow/cli.py +115 -0
- wordflow_cli-0.1.4/src/wordflow/clipboard.py +104 -0
- wordflow_cli-0.1.4/src/wordflow/configuration.py +171 -0
- wordflow_cli-0.1.4/src/wordflow/data/default_config.toml +103 -0
- wordflow_cli-0.1.4/src/wordflow/data/logo.txt +11 -0
- wordflow_cli-0.1.4/src/wordflow/data/logo2.txt +6 -0
- wordflow_cli-0.1.4/src/wordflow/my_classes.py +38 -0
- wordflow_cli-0.1.4/src/wordflow/notifications.py +77 -0
- wordflow_cli-0.1.4/src/wordflow/text_to_speech.py +49 -0
- wordflow_cli-0.1.4/src/wordflow/translator.py +170 -0
- wordflow_cli-0.1.4/src/wordflow/wizard.py +191 -0
- wordflow_cli-0.1.4/src/wordflow/workflows.py +146 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/PKG-INFO +195 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/SOURCES.txt +23 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/dependency_links.txt +1 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/entry_points.txt +2 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/requires.txt +2 -0
- wordflow_cli-0.1.4/src/wordflow_cli.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mathéo Tritschler
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: wordflow-cli
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Automate Anki flashcard creation and text translation directly from your clipboard.
|
|
5
|
+
Author-email: Mathéo Tritschler <tritschler.matheo@gmail.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Keywords: anki,translation,flashcards,cli,linux,language,automated flashcards,automated translation
|
|
8
|
+
Classifier: Development Status :: 3 - Alpha
|
|
9
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Requires-Python: >=3.11
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: requests>=2.28.0
|
|
19
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
$$\ $$\ $$\ $$$$$$$$\ $$\
|
|
23
|
+
$$ | $\ $$ | $$ | $$ _____|$$ |
|
|
24
|
+
$$ |$$$\ $$ | $$$$$$\ $$$$$$\ $$$$$$$ | $$ | $$ | $$$$$$\ $$\ $$\ $$\
|
|
25
|
+
$$ $$ $$\$$ |$$ __$$\ $$ __$$\ $$ __$$ | $$$$$\ $$ |$$ __$$\ $$ | $$ | $$ |
|
|
26
|
+
$$$$ _$$$$ |$$ / $$ |$$ | \__|$$ / $$ | $$ __| $$ |$$ / $$ |$$ | $$ | $$ |
|
|
27
|
+
$$$ / \$$$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ |$$ | $$ |$$ | $$ | $$ |
|
|
28
|
+
$$ / \$$ |\$$$$$$ |$$ | \$$$$$$$ | $$ | $$ |\$$$$$$ |\$$$$$\$$$$ |
|
|
29
|
+
\__/ \__| \______/ \__| \_______| \__| \__| \______/ \_____\____/
|
|
30
|
+
|
|
31
|
+
# Wordflow
|
|
32
|
+
|
|
33
|
+
A lightning-fast, dependency-free, keyboard-driven language acquisition tool for Linux.
|
|
34
|
+
|
|
35
|
+
Wordflow bridges your system clipboard, Google's internal translation APIs, Text-To-Speech, and Anki into a single seamless workflow. By simply highlighting text and pressing a shortcut, you can instantly translate sentences or dynamically generate Anki flashcards without ever leaving your browser, book, or current window.
|
|
36
|
+
# ✨ Features
|
|
37
|
+
|
|
38
|
+
Zero-Dependency Translation: Directly hooks into Google's native API endpoints for instantaneous, rate-limit-resistant translations without relying on web scrapers.
|
|
39
|
+
|
|
40
|
+
Rich Dictionary Data: Automatically fetches synonyms, monolingual definitions, alternate translations, and curated example sentences for single words.
|
|
41
|
+
|
|
42
|
+
Phonetics & Romanization: Natively captures pronunciations like Pinyin for Chinese or Romaji for Japanese.
|
|
43
|
+
|
|
44
|
+
Dual Audio Generation: Generates native MP3 audio for both the isolated word and the full sentence, directly embedded into your flashcards.
|
|
45
|
+
|
|
46
|
+
Infinite Layout Flexibility: Map any piece of fetched data to any field on your Anki cards using a highly intuitive placeholder configuration system.
|
|
47
|
+
|
|
48
|
+
# ⚠️ Limitations & Scope
|
|
49
|
+
|
|
50
|
+
Linux Only: Wordflow is built specifically for Linux environments (X11/Wayland).
|
|
51
|
+
|
|
52
|
+
Internet Required: Translations and audio generation rely on live online APIs.
|
|
53
|
+
|
|
54
|
+
# 🛠 Prerequisites
|
|
55
|
+
|
|
56
|
+
Python 3.10+
|
|
57
|
+
|
|
58
|
+
Clipboard Manager: xclip (X11) or wl-clipboard (Wayland) must be installed.
|
|
59
|
+
|
|
60
|
+
Anki Desktop: Must be installed and running in the background.
|
|
61
|
+
|
|
62
|
+
AnkiConnect: You must install the AnkiConnect add-on to allow Wordflow to communicate with Anki.
|
|
63
|
+
|
|
64
|
+
# Installing AnkiConnect
|
|
65
|
+
|
|
66
|
+
Open Anki.
|
|
67
|
+
|
|
68
|
+
Go to Tools -> Add-ons -> Get Add-ons...
|
|
69
|
+
|
|
70
|
+
Paste the AnkiConnect code: 2055492159
|
|
71
|
+
|
|
72
|
+
Restart Anki.
|
|
73
|
+
|
|
74
|
+
# 🚀 Installation
|
|
75
|
+
## 1. Via pipx (Recommended)
|
|
76
|
+
### a) Install directly from pipx
|
|
77
|
+
pipx install wordflow-cli
|
|
78
|
+
### b) Clone and install locally
|
|
79
|
+
git clone [https://github.com/matheoTR/Wordflow.git](https://github.com/matheoTR/Wordflow.git)
|
|
80
|
+
cd Wordflow
|
|
81
|
+
pipx install .
|
|
82
|
+
## 2. Via git and makepkg (Arch build)
|
|
83
|
+
If you prefer building from the versioned source using a PKGBUILD, you can clone the repository and run makepkg. It will then be managed by pacman.
|
|
84
|
+
|
|
85
|
+
git clone https://github.com/matheoTR/Wordflow.git
|
|
86
|
+
cd Wordflow
|
|
87
|
+
makepkg -si
|
|
88
|
+
|
|
89
|
+
## 3. Via Package Managers (apt, pacman, dnf)
|
|
90
|
+
Not yet available.
|
|
91
|
+
|
|
92
|
+
# ⚙️ Configuration
|
|
93
|
+
Run the initialization wizard to generate your default configuration:
|
|
94
|
+
|
|
95
|
+
wordflow --wizard
|
|
96
|
+
|
|
97
|
+
This guides you through setting up your default Anki deck and creates your configuration file at ~/.config/wordflow/config.toml.
|
|
98
|
+
## Field Mappings & Placeholders
|
|
99
|
+
|
|
100
|
+
Wordflow's true power lies in its dynamic field mappings. In your config.toml, you map Anki note fields (left) to Wordflow's data placeholders (right). You can combine multiple placeholders and inject custom HTML. Missing or empty data is gracefully ignored by Anki.
|
|
101
|
+
|
|
102
|
+
### Available Placeholders:
|
|
103
|
+
|
|
104
|
+
{cloze} - The sentence with the {{c1::word}} deletion and optional dictionary hyperlink.
|
|
105
|
+
|
|
106
|
+
{translation} - The translation of the full sentence.
|
|
107
|
+
|
|
108
|
+
{source_word} - The isolated highlighted word.
|
|
109
|
+
|
|
110
|
+
{word_audio} - Audio play button for the isolated word.
|
|
111
|
+
|
|
112
|
+
{sentence_audio} - Audio play button for the full sentence.
|
|
113
|
+
|
|
114
|
+
{sentence_phonetic} - Phonetics/Romanization of the sentence.
|
|
115
|
+
|
|
116
|
+
{word_phonetic} - Phonetics/Romanization of the word.
|
|
117
|
+
|
|
118
|
+
{alternates} - Alternative translation variations.
|
|
119
|
+
|
|
120
|
+
{definitions} - Monolingual dictionary definitions.
|
|
121
|
+
|
|
122
|
+
{synonyms} - Synonyms of the target word.
|
|
123
|
+
|
|
124
|
+
{examples} - Example sentences using the word.
|
|
125
|
+
|
|
126
|
+
### Configuration Example
|
|
127
|
+
Ini, TOML
|
|
128
|
+
|
|
129
|
+
[anki.default.fields]
|
|
130
|
+
"Front" = "{cloze}"
|
|
131
|
+
"Back" = "{translation}"
|
|
132
|
+
"Audio" = "{word_audio} {sentence_audio}"
|
|
133
|
+
"Phonetics" = "{word_phonetic} {sentence_phonetic}"
|
|
134
|
+
"Definitions" = "{definitions}"
|
|
135
|
+
"Synonyms" = "{synonyms}"
|
|
136
|
+
"Alternates" = "{alternates}"
|
|
137
|
+
"Examples" = "{examples}"
|
|
138
|
+
|
|
139
|
+
## Language-Specific Overrides
|
|
140
|
+
|
|
141
|
+
You can manually edit config.toml to route different languages to different Anki decks, models, and dictionaries. Wordflow automatically detects the language of your highlighted text and applies the correct settings.
|
|
142
|
+
|
|
143
|
+
Override for Chinese (-l zh-cn)
|
|
144
|
+
[anki.zh-cn]
|
|
145
|
+
deck = "Languages::Chinese"
|
|
146
|
+
card_model = "Chinese Hanzi Cloze"
|
|
147
|
+
dict_url = "https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb={word}"
|
|
148
|
+
|
|
149
|
+
[anki.zh-cn.fields]
|
|
150
|
+
"Hanzi" = "{cloze}"
|
|
151
|
+
"Translation" = "{translation}"
|
|
152
|
+
"Pinyin" = "{word_phonetic} {sentence_phonetic}"
|
|
153
|
+
|
|
154
|
+
## Text-To-Speech Accents
|
|
155
|
+
|
|
156
|
+
Wordflow automatically routes audio to native speakers of the detected language. You can customize the accent for pluricentric languages (like English or Spanish) by changing the optional audio_accent setting to match a regional Top-Level Domain (TLD). This setting does not work for all languages.
|
|
157
|
+
### example
|
|
158
|
+
[anki.es]
|
|
159
|
+
# Generates Mexican Spanish audio instead of Castilian Spanish
|
|
160
|
+
audio_accent = "com.mx"
|
|
161
|
+
|
|
162
|
+
# 🖱️ Usage
|
|
163
|
+
## Instant Translation (-t)
|
|
164
|
+
|
|
165
|
+
Highlight any text on your screen and trigger the wordflow --translate command. Wordflow detects the language, translates it, and sends a desktop notification. Clicking the notification copies the translation to your clipboard.
|
|
166
|
+
## Cloze Card Creation (-c)
|
|
167
|
+
|
|
168
|
+
To create a flashcard, highlight the target word/sentence and trigger wordflow --cloze. Wordflow will parse all dictionary data, build the card according to your TOML layout, and push it directly to Anki.
|
|
169
|
+
|
|
170
|
+
Use wordflow --help to list all command-line arguments.
|
|
171
|
+
|
|
172
|
+
# ⌨️ Creating Shortcuts
|
|
173
|
+
|
|
174
|
+
Wordflow is designed to be bound to your window manager's shortcuts, allowing you to seamlessly translate and capture vocabulary without losing focus on your current task.
|
|
175
|
+
## Hyprland Example (Submap)
|
|
176
|
+
hl.bind(mod .. " + C", hl.dsp.submap("wordflow")) -- wordflow
|
|
177
|
+
|
|
178
|
+
hl.define_submap("wordflow", function()
|
|
179
|
+
--t : Translate
|
|
180
|
+
hl.bind("T", function()
|
|
181
|
+
hl.dispatch(hl.dsp.submap("reset"))
|
|
182
|
+
hl.dispatch(hl.dsp.exec_cmd("wordflow -t"))
|
|
183
|
+
end)
|
|
184
|
+
--c : Cloze
|
|
185
|
+
hl.bind("C", function()
|
|
186
|
+
hl.dispatch(hl.dsp.submap("reset"))
|
|
187
|
+
hl.dispatch(hl.dsp.exec_cmd("wordflow -c"))
|
|
188
|
+
end)
|
|
189
|
+
|
|
190
|
+
hl.bind("catchall", hl.dsp.submap("reset"))
|
|
191
|
+
end)
|
|
192
|
+
|
|
193
|
+
## Sway / i3 Example
|
|
194
|
+
bindsym Mod4+t exec "wordflow -t"
|
|
195
|
+
bindsym Mod4+c exec "wordflow -c"
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
$$\ $$\ $$\ $$$$$$$$\ $$\
|
|
2
|
+
$$ | $\ $$ | $$ | $$ _____|$$ |
|
|
3
|
+
$$ |$$$\ $$ | $$$$$$\ $$$$$$\ $$$$$$$ | $$ | $$ | $$$$$$\ $$\ $$\ $$\
|
|
4
|
+
$$ $$ $$\$$ |$$ __$$\ $$ __$$\ $$ __$$ | $$$$$\ $$ |$$ __$$\ $$ | $$ | $$ |
|
|
5
|
+
$$$$ _$$$$ |$$ / $$ |$$ | \__|$$ / $$ | $$ __| $$ |$$ / $$ |$$ | $$ | $$ |
|
|
6
|
+
$$$ / \$$$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ |$$ | $$ |$$ | $$ | $$ |
|
|
7
|
+
$$ / \$$ |\$$$$$$ |$$ | \$$$$$$$ | $$ | $$ |\$$$$$$ |\$$$$$\$$$$ |
|
|
8
|
+
\__/ \__| \______/ \__| \_______| \__| \__| \______/ \_____\____/
|
|
9
|
+
|
|
10
|
+
# Wordflow
|
|
11
|
+
|
|
12
|
+
A lightning-fast, dependency-free, keyboard-driven language acquisition tool for Linux.
|
|
13
|
+
|
|
14
|
+
Wordflow bridges your system clipboard, Google's internal translation APIs, Text-To-Speech, and Anki into a single seamless workflow. By simply highlighting text and pressing a shortcut, you can instantly translate sentences or dynamically generate Anki flashcards without ever leaving your browser, book, or current window.
|
|
15
|
+
# ✨ Features
|
|
16
|
+
|
|
17
|
+
Zero-Dependency Translation: Directly hooks into Google's native API endpoints for instantaneous, rate-limit-resistant translations without relying on web scrapers.
|
|
18
|
+
|
|
19
|
+
Rich Dictionary Data: Automatically fetches synonyms, monolingual definitions, alternate translations, and curated example sentences for single words.
|
|
20
|
+
|
|
21
|
+
Phonetics & Romanization: Natively captures pronunciations like Pinyin for Chinese or Romaji for Japanese.
|
|
22
|
+
|
|
23
|
+
Dual Audio Generation: Generates native MP3 audio for both the isolated word and the full sentence, directly embedded into your flashcards.
|
|
24
|
+
|
|
25
|
+
Infinite Layout Flexibility: Map any piece of fetched data to any field on your Anki cards using a highly intuitive placeholder configuration system.
|
|
26
|
+
|
|
27
|
+
# ⚠️ Limitations & Scope
|
|
28
|
+
|
|
29
|
+
Linux Only: Wordflow is built specifically for Linux environments (X11/Wayland).
|
|
30
|
+
|
|
31
|
+
Internet Required: Translations and audio generation rely on live online APIs.
|
|
32
|
+
|
|
33
|
+
# 🛠 Prerequisites
|
|
34
|
+
|
|
35
|
+
Python 3.10+
|
|
36
|
+
|
|
37
|
+
Clipboard Manager: xclip (X11) or wl-clipboard (Wayland) must be installed.
|
|
38
|
+
|
|
39
|
+
Anki Desktop: Must be installed and running in the background.
|
|
40
|
+
|
|
41
|
+
AnkiConnect: You must install the AnkiConnect add-on to allow Wordflow to communicate with Anki.
|
|
42
|
+
|
|
43
|
+
# Installing AnkiConnect
|
|
44
|
+
|
|
45
|
+
Open Anki.
|
|
46
|
+
|
|
47
|
+
Go to Tools -> Add-ons -> Get Add-ons...
|
|
48
|
+
|
|
49
|
+
Paste the AnkiConnect code: 2055492159
|
|
50
|
+
|
|
51
|
+
Restart Anki.
|
|
52
|
+
|
|
53
|
+
# 🚀 Installation
|
|
54
|
+
## 1. Via pipx (Recommended)
|
|
55
|
+
### a) Install directly from pipx
|
|
56
|
+
pipx install wordflow-cli
|
|
57
|
+
### b) Clone and install locally
|
|
58
|
+
git clone [https://github.com/matheoTR/Wordflow.git](https://github.com/matheoTR/Wordflow.git)
|
|
59
|
+
cd Wordflow
|
|
60
|
+
pipx install .
|
|
61
|
+
## 2. Via git and makepkg (Arch build)
|
|
62
|
+
If you prefer building from the versioned source using a PKGBUILD, you can clone the repository and run makepkg. It will then be managed by pacman.
|
|
63
|
+
|
|
64
|
+
git clone https://github.com/matheoTR/Wordflow.git
|
|
65
|
+
cd Wordflow
|
|
66
|
+
makepkg -si
|
|
67
|
+
|
|
68
|
+
## 3. Via Package Managers (apt, pacman, dnf)
|
|
69
|
+
Not yet available.
|
|
70
|
+
|
|
71
|
+
# ⚙️ Configuration
|
|
72
|
+
Run the initialization wizard to generate your default configuration:
|
|
73
|
+
|
|
74
|
+
wordflow --wizard
|
|
75
|
+
|
|
76
|
+
This guides you through setting up your default Anki deck and creates your configuration file at ~/.config/wordflow/config.toml.
|
|
77
|
+
## Field Mappings & Placeholders
|
|
78
|
+
|
|
79
|
+
Wordflow's true power lies in its dynamic field mappings. In your config.toml, you map Anki note fields (left) to Wordflow's data placeholders (right). You can combine multiple placeholders and inject custom HTML. Missing or empty data is gracefully ignored by Anki.
|
|
80
|
+
|
|
81
|
+
### Available Placeholders:
|
|
82
|
+
|
|
83
|
+
{cloze} - The sentence with the {{c1::word}} deletion and optional dictionary hyperlink.
|
|
84
|
+
|
|
85
|
+
{translation} - The translation of the full sentence.
|
|
86
|
+
|
|
87
|
+
{source_word} - The isolated highlighted word.
|
|
88
|
+
|
|
89
|
+
{word_audio} - Audio play button for the isolated word.
|
|
90
|
+
|
|
91
|
+
{sentence_audio} - Audio play button for the full sentence.
|
|
92
|
+
|
|
93
|
+
{sentence_phonetic} - Phonetics/Romanization of the sentence.
|
|
94
|
+
|
|
95
|
+
{word_phonetic} - Phonetics/Romanization of the word.
|
|
96
|
+
|
|
97
|
+
{alternates} - Alternative translation variations.
|
|
98
|
+
|
|
99
|
+
{definitions} - Monolingual dictionary definitions.
|
|
100
|
+
|
|
101
|
+
{synonyms} - Synonyms of the target word.
|
|
102
|
+
|
|
103
|
+
{examples} - Example sentences using the word.
|
|
104
|
+
|
|
105
|
+
### Configuration Example
|
|
106
|
+
Ini, TOML
|
|
107
|
+
|
|
108
|
+
[anki.default.fields]
|
|
109
|
+
"Front" = "{cloze}"
|
|
110
|
+
"Back" = "{translation}"
|
|
111
|
+
"Audio" = "{word_audio} {sentence_audio}"
|
|
112
|
+
"Phonetics" = "{word_phonetic} {sentence_phonetic}"
|
|
113
|
+
"Definitions" = "{definitions}"
|
|
114
|
+
"Synonyms" = "{synonyms}"
|
|
115
|
+
"Alternates" = "{alternates}"
|
|
116
|
+
"Examples" = "{examples}"
|
|
117
|
+
|
|
118
|
+
## Language-Specific Overrides
|
|
119
|
+
|
|
120
|
+
You can manually edit config.toml to route different languages to different Anki decks, models, and dictionaries. Wordflow automatically detects the language of your highlighted text and applies the correct settings.
|
|
121
|
+
|
|
122
|
+
Override for Chinese (-l zh-cn)
|
|
123
|
+
[anki.zh-cn]
|
|
124
|
+
deck = "Languages::Chinese"
|
|
125
|
+
card_model = "Chinese Hanzi Cloze"
|
|
126
|
+
dict_url = "https://www.mdbg.net/chinese/dictionary?page=worddict&wdrst=0&wdqb={word}"
|
|
127
|
+
|
|
128
|
+
[anki.zh-cn.fields]
|
|
129
|
+
"Hanzi" = "{cloze}"
|
|
130
|
+
"Translation" = "{translation}"
|
|
131
|
+
"Pinyin" = "{word_phonetic} {sentence_phonetic}"
|
|
132
|
+
|
|
133
|
+
## Text-To-Speech Accents
|
|
134
|
+
|
|
135
|
+
Wordflow automatically routes audio to native speakers of the detected language. You can customize the accent for pluricentric languages (like English or Spanish) by changing the optional audio_accent setting to match a regional Top-Level Domain (TLD). This setting does not work for all languages.
|
|
136
|
+
### example
|
|
137
|
+
[anki.es]
|
|
138
|
+
# Generates Mexican Spanish audio instead of Castilian Spanish
|
|
139
|
+
audio_accent = "com.mx"
|
|
140
|
+
|
|
141
|
+
# 🖱️ Usage
|
|
142
|
+
## Instant Translation (-t)
|
|
143
|
+
|
|
144
|
+
Highlight any text on your screen and trigger the wordflow --translate command. Wordflow detects the language, translates it, and sends a desktop notification. Clicking the notification copies the translation to your clipboard.
|
|
145
|
+
## Cloze Card Creation (-c)
|
|
146
|
+
|
|
147
|
+
To create a flashcard, highlight the target word/sentence and trigger wordflow --cloze. Wordflow will parse all dictionary data, build the card according to your TOML layout, and push it directly to Anki.
|
|
148
|
+
|
|
149
|
+
Use wordflow --help to list all command-line arguments.
|
|
150
|
+
|
|
151
|
+
# ⌨️ Creating Shortcuts
|
|
152
|
+
|
|
153
|
+
Wordflow is designed to be bound to your window manager's shortcuts, allowing you to seamlessly translate and capture vocabulary without losing focus on your current task.
|
|
154
|
+
## Hyprland Example (Submap)
|
|
155
|
+
hl.bind(mod .. " + C", hl.dsp.submap("wordflow")) -- wordflow
|
|
156
|
+
|
|
157
|
+
hl.define_submap("wordflow", function()
|
|
158
|
+
--t : Translate
|
|
159
|
+
hl.bind("T", function()
|
|
160
|
+
hl.dispatch(hl.dsp.submap("reset"))
|
|
161
|
+
hl.dispatch(hl.dsp.exec_cmd("wordflow -t"))
|
|
162
|
+
end)
|
|
163
|
+
--c : Cloze
|
|
164
|
+
hl.bind("C", function()
|
|
165
|
+
hl.dispatch(hl.dsp.submap("reset"))
|
|
166
|
+
hl.dispatch(hl.dsp.exec_cmd("wordflow -c"))
|
|
167
|
+
end)
|
|
168
|
+
|
|
169
|
+
hl.bind("catchall", hl.dsp.submap("reset"))
|
|
170
|
+
end)
|
|
171
|
+
|
|
172
|
+
## Sway / i3 Example
|
|
173
|
+
bindsym Mod4+t exec "wordflow -t"
|
|
174
|
+
bindsym Mod4+c exec "wordflow -c"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "wordflow-cli"
|
|
7
|
+
version = "0.1.4"
|
|
8
|
+
description = "Automate Anki flashcard creation and text translation directly from your clipboard."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = { text = "MIT" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Mathéo Tritschler", email = "tritschler.matheo@gmail.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = ["anki", "translation", "flashcards", "cli", "linux", "language", "automated flashcards", "automated translation"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 3 - Alpha",
|
|
18
|
+
"Intended Audience :: End Users/Desktop",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3.11",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Operating System :: POSIX :: Linux",
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
dependencies = [
|
|
27
|
+
"requests>=2.28.0",
|
|
28
|
+
"tomli-w>=1.0.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.scripts]
|
|
32
|
+
wordflow = "wordflow.cli:main"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.packages.find]
|
|
35
|
+
where = ["src"]
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.package-data]
|
|
38
|
+
wordflow = ["data/*.toml", "data/*.txt", "data/*.md"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Makes the folder an importable package
|