An ArchChinese scraper for Anki
Project description
AnkiChinese
Asynchronousy scrape the ArchChinese dictionary to generate Anki flashcards with:
- Pinyin & Audio
- Definitions
- Example words
- Formation/Origin
- Stroke order diagrams
- HSK level
Installation
pip install ankichinese
Usage
ankichinese
-h, --help Show help message and exit
-csv Output to CSV instead of Anki deck
--input, -i INPUT Input file with characters to scrape (default: input.txt)
--output, -o OUTPUT Name of output file (do not include extension)
(default: ankichinese_output)
--defs, -d NUM Number of definitions to scrape per character (default: 5)
--examples, -e NUM Number of example words to scrape per character (default: 3)
Generate New AnkiChinese Deck
How to create an entirely new Anki deck with the name ankichinese_output.apkg
in the current directory using custom AnkiChinese styling.
- Create
input.txt
with the characters you want to scrape (avoid non-Chinese characters). - Run
ankichinese
. - Open Anki and import
ankichinese_output.apkg
.
Updating is Easy!
Just run ankichinese
again with new characters in input.txt
and import the new ankichinese_output.apkg
file into Anki. Anki will automatically update the existing deck without losing progress.
Update Existing (Non-AnkiChinese) Deck Without Losing Progress
- Prepare current deck for export
- Decide what information you would like to add from the AnkiChinese deck.
- Create empty fields in your deck for the information you want to add.
- Export the deck you want to update from Anki using
Notes in Plain Text (.txt)
format. Check theInclude unique identifier
box. - Open your deck in Excel or Google Sheets
- Excel
- Go to the
Data
->From Text/CSV
and import the exported deck file. - Set
File Origin
to65001: Unicode (UTF-8)
andDelimiter
toTab
and clickLoad
.
- Go to the
- Google Sheets
- Go to
File
->Import
->Upload
and select the exported deck file. - Set separator type to
Tab
and clickImport data
.
- Go to
- Copy the entire column of Chinese characters into
input.txt
.
- Excel
- Run
ankichinese -csv
- Open your exported deck and the
ankichinese_output.csv
file in Excel or Google Sheets. (Use the same method as before) - Sort both tables by the column containing Chinese characters.
- Copy your desired information from the
ankichinese_output.csv
table into your exported deck table. Do not add/delete columns or modify the GUID column of your deck. - Save the file as a .csv file and import into Anki.
Tools Used
- Asyncio: https://docs.python.org/3/library/asyncio.html
- Playwright: https://playwright.dev/python/
- Aiometer: https://github.com/florimondmanca/aiometer
- Genanki: https://github.com/kerrickstaley/genanki
- tqdm: https://github.com/tqdm/tqdm
- Beautiful Soup: https://www.crummy.com/software/BeautifulSoup/
- Pandas: https://pandas.pydata.org/
Credits
Stroke order diagrams:
- Online stroke order diagrams: https://hanziwriter.org/
- Offline stroke order font: https://rtega.be/chmn/index.php?subpage=68
Chinese audio:
- https://yoyochinese.com/chinese-learning-tools/Mandarin-Chinese-pronunciation-lesson/pinyin-chart-table
- Neutral tones: https://www.purpleculture.net/chinese_pinyin_chart/ MIT License
Copyright (c) 2023 Luke Tao
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for AnkiChinese-1.3.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d35b9ac867a052b701f7fd4fb9db64fddb3bb5cd5bddcb6d3183f15402abe218 |
|
MD5 | 4b27d71be7766cecb09ba10801a82f48 |
|
BLAKE2b-256 | a7dda975db7072d26e64b932c5d7b5cf8127f2ea25415cf2c3df4425bc154ed1 |