Skip to main content

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.

Text to Anki

Motivation

When learning Chinese, usually the advice given 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 distrobution 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

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.

How it works

AutoAnki interfaces has 4 components on the back end:

  1. BookCleaner: Cleans the input coming in from files that the user supplies
  2. DatabaseManager: Takes the cleaned input and puts it into the database
  3. Dictionary: Finds definitions for words in the database
  4. DeckManager: Creates Decks

Database:

There are 3 different types of tables in the DB,

  1. dictionary, which holds all the definitions and other information
  2. book_list, which holds the titles of the books in the database
  3. 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

Dictionary table Dictionary table

book_list:

  • book_name
  • book_table_name
  • language

Book list table Book list table

book

  • book_table_word_id
  • dictionary_word_id
  • number_of_appearances

Book table Book table

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autoanki-1.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

autoanki-1.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file autoanki-1.1.0.tar.gz.

File metadata

  • Download URL: autoanki-1.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for autoanki-1.1.0.tar.gz
Algorithm Hash digest
SHA256 413fec90e57d482f4c778b4d10af5a0b416aeda911d39eb333ea9dc96a9d33af
MD5 b094ec6ba951e1cf4efb306ec97e7851
BLAKE2b-256 646a2cb1098526a735a214d682651435a5e64a4e2fd19b2f94f0983babace1fa

See more details on using hashes here.

File details

Details for the file autoanki-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: autoanki-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for autoanki-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33a54e12324bad92e75704cff93bbe073c265ba322ab51abb2f0edfa1067a51a
MD5 8a605775f574cc226fb411d9c020add0
BLAKE2b-256 0533e275c710890d475515b1b219fd2996ec88f9f0e911537147d065c147a95e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page