Automatically make Anki Decks for Chinese text
Project description
❗️
Pull requests welcome! If you think you can improve AA in any way, open a PR!
autoanki
Tool for generating Anki flashcards to learn Chinese.
Motivation
When learning Chinese, advice is to learn the top X most common words. This is good advice, as you can get pretty far with this, however it's not perfect.
For example, Harry Potter. This book will have normal distribution for most words, however there will be a heavy emphasis on a specialized subset of words such as Wand, Robe, Wizard, Broomstick etc. These words will show up a lot more than they would otherwise.
The intention of this package was to allow Chinese learners to move from beginner books to more advanced material. I found there was a gap in knowledge going from beginner learning books (where there is little specalized terminology), to teen novels, where each novel will generally have its own specialized terminology, making the transition tedious. This is solved by automatically making Anki decks that have this specialized terminology, so that you are able to memorize these words while continuing to make progress
With autoanki, you selectivley add words to an Anki file to continue progressing with your lanuage learning skills.
Usage
autoanki is both a library and a command-line tool.
To get started, run
pip install autoanki
This should install all the requirements. Then, in a Python file, do from autoanki import AutoAnki
To get started, first, create a database for autoanki to use
db_path = "AutoAnki.db"
if not AutoAnki.is_database(db_path):
AutoAnki.create_autoanki_db(db_path)
Then create an instance of autoanki using the database
aa = AutoAnki(db_path)
Add whatever books you want in your deck. These can be a single file, or a folder
bookpath = 'short-story.txt'
aa.add_book(bookpath, 'My first book🍎')
Once all of your books are added, the definitions need to be found, and then you can create a deck!
aa.complete_unfinished_definitions()
aa.create_deck("AutoAnki Deck", "output")
This will automatically have the .apkg extension, which Anki uses. Import this file into Anki, and you're all set.
Other commands
If you want to see the status of the database, use:
aa.print_database_info()
How it works
AutoAnki interfaces has 4 components on the back end:
- BookCleaner: Cleans the input coming in from files that the user supplies
- DatabaseManager: Takes the cleaned input and puts it into the database
- Dictionary: Finds definitions for words in the database
- DeckManager: Creates Decks
Database:
There are 3 different types of tables in the DB,
- dictionary, which holds all the definitions and other information
- book_list, which holds the titles of the books in the database
- book, based off of the name of the book, and holds the words in the book to find in the dictionary
dictionary:
- word_id
- word
- word_traditional
- word_type (noun, verb, etc.)
- pinyin
- pinyin_numbers
- number_of_strokes
- sub_components
- frequency
- hsk_level
- top_level
- audio_path
- image_path
- definition
book_list:
- book_name
- book_table_name
- language
book
- book_table_word_id
- dictionary_word_id
- number_of_appearances
Planned features
- See ROADMAP.md
Other Info
If you would like to get involved, or learn more information, reading Anki documentation is really important, especially the Getting Started
To get definitions, this autoanki uses the CC-CEDICT under the creative commons licence.
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
File details
Details for the file autoanki-1.1.6.tar.gz
.
File metadata
- Download URL: autoanki-1.1.6.tar.gz
- Upload date:
- Size: 18.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03e8871548a75193f21694892eae2cf3007367bc7b1139939006d8844a98673 |
|
MD5 | e0f6a7678d70dd84259d600be3d4dc95 |
|
BLAKE2b-256 | e3d551a69dbc6b1d778ccd962fa9788f6ebec9371b7a70a624784aa774ddfe0f |
File details
Details for the file autoanki-1.1.6-py3-none-any.whl
.
File metadata
- Download URL: autoanki-1.1.6-py3-none-any.whl
- Upload date:
- Size: 20.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d86f03131aa6ae0df78fc39062f5e500214f31396a39df436558bcb70b4358d0 |
|
MD5 | 16ef7e18536b3ca4447f7ab47e507045 |
|
BLAKE2b-256 | 4b141e2e1f2a895e8e3b0daae9d74b5837431c8dc6a102ed594a460da13596bf |