Coder Social home page Coder Social logo

50languages2anki's Introduction

50Langs2Anki

A Python script to extract sentences, audio, and translations from 50Languages and generate Anki flashcards from them for language learning.

Usage

  • Install dependencies: pip install -r requirements.txt
  • Run the script using something like: python 50langs2anki.py --src en --dest tr --start 5 --end 10
  • You should see a deck package named 50Languages_en-tr_5-10.apkg in the current working directory (You can also provide a different output file using the --out option).

The --src and --dest flags take codes of two languages. These are languages you choose in 50Languages's interface and are shown in the URL of each lesson.

The --start and --end flags specify the range of lessons to download. By default, all lessons will be downloaded (from 1 to 100).

The generated Anki notes use a notetype consisting of front-back and back-front card types. More options to customize this may be added in the future.

Generating Updated Decks

If you want to generate an updated deck and import it again to Anki, the notes should have notetypes with the same ID for the deck to be imported without creating duplicates. This script generates a random notetype ID for each run, which is undesirable in this situation. The solution is to use the --model-id option in the second run, passing it the same ID of the notes generated in the first run. After importing a deck generated by this script to Anki, you can find the notetype ID of the notes by running the following code in the Debug Console:

pp(mw.col.models.by_name("50Languages_en-tr_1-100")['id'])

(Change "50Languages_en-tr_1-100" to the name of your notetype.)

This will give you the ID, which you can pass to the script like:

python fiftylangs2anki.py --src en --dest tr --model-id 1409094762

Caching

All materials downloaded from 50Languages are cached under the cache directory for re-use in subsequent invocations of the script that involve the same source or destination language.

Credit

50Languages's content is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 3.0 license (CC BY-NC-ND 3.0). See https://www.50languages.com/licence.php

50languages2anki's People

Contributors

gabriele77s2 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.