autoanki
Tool for generating Chinese flashcards for Anki
About
When learning Chinese, some common 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 selectively add words to an Anki file to continue progressing with your lanuage learning skills.
Usage
To get started, run
pip install autoanki
Create an autoanki instance with the 2-letter code of the language you want to use
from autoanki import AutoAnki
if not AutoAnki.is_database("AutoAnki.db"):
AutoAnki.create_database("AutoAnki.db")
aa = AutoAnki('zh', database_filepath="AutoAnki.db")
# Add whatever books you want in your deck. These can be a single file, or a string
aa.add_book_from_string("...", 'My first book🍎')
aa.add_book_from_string('short-story.txt', '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")
The .apkg extension will be added, which Anki uses.
Import this file into Anki, and you're all set.
Other commands
If you want to see the information of a database, use:
aa.print_database_info()
If you would like to create and use your own dictionary, you can pass it in:
aa = AutoAnki(db_path, dictionary=CustomDictionary())
This dictionary must implement functions from the abstract class autoanki/Dictionary.py
Some settings can be set regarding how cards will be formatted, and what will be shown. They can be set here:
aa.deck_settings(
include_traditional=True,
include_part_of_speech=True,
word_frequency_filter=1e-05 # Filters using this library: https://pypi.org/project/wordfreq/
)
The filter is the percentage of words less frequent: 的 shows up 6% of the time in text, so putting a value of 7 will omit it
How it works
AutoAnki interfaces has 4 components on the back end:
- 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:
dictionarycontains a information about each word, including the pinyin, traditional characters, and a definitionbook_listcontains the book name, table name, and language for each book addedbookcontains the book table id, dictionary word id, and the number of appearances for each word in the book
Dictionary
This is an abstract class that can be implemented with the following methods
__init__(debug_level)find_word(word)- Returns None, or a list of paramaters that match the input of DatabaseManager.update_definition()size()- Number of entries in the dictionary
There is one dictionary included as the default: an endpoint to CC-CEDICT. I have local versions of other dictionaries with copyrighted data, which I can not upload.
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.
Metadata
Release files for autoanki 1.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autoanki-1.2.2.tar.gz | 3.9 MB | Without provenance | Details for autoanki-1.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autoanki-1.2.2-py3-none-any.whl | Python 3 | none | any | Details for autoanki-1.2.2-py3-none-any.whl |
Total release size: 7.8 MB
Release files / autoanki-1.2.2.tar.gz
| Download URL | autoanki-1.2.2.tar.gz |
|---|---|
| Size | 3.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1828f3515a2eae594fdbbc5520ad1e692c7129a251327a524fc6f07b79e634f7
|
|
BLAKE2b-256 checksum How to use checksums |
9596dd50dc16f7437807298bb4cc0139044173e6f65ac1d686b7a1a181ad4a19
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Release files / autoanki-1.2.2-py3-none-any.whl
| Download URL | autoanki-1.2.2-py3-none-any.whl |
|---|---|
| Size | 3.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c32b5620ea7b47d9e7d8f99532b9ce4de0854640876c31ed3de7d0a94ea8335e
|
|
BLAKE2b-256 checksum How to use checksums |
7c92be5eabfda9767c0273719d56d3bdac4b243cbdd21393da2491c3b8b4ae0b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.1
|
Security for autoanki 1.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.