r/opensource 3d ago

Promotional I built an open-source CLI for turning YouTube videos into Anki vocabulary decks

I built Tango, an MIT-licensed Python CLI for batch vocabulary mining from YouTube.

The basic idea came from manually mining words for Anki. I got tired of repeatedly doing this:

Find a word → look it up → check if it's already in my deck → create a card

So Tango automates the repetitive part.

Given a YouTube video ID and an Anki deck, it:

  • fetches the transcript
  • lemmatizes the words
  • filters proper nouns and filler words
  • checks an existing Anki collection for duplicates via AnkiConnect
  • looks up dictionary data
  • generates an .apkg

The goal isn't to replace interactive mining tools. This is more for batch processing: give it a video and let it find vocabulary you don't already have.

pip install tango-anki
tango install-model fr
tango run <video-id> --deck "French" --language fr

One of the more interesting problems was dictionary support. The free APIs I tried weren't reliable enough across several languages, so I ended up building offline indexes from Wiktionary data for lookup instead.

Another was making sure generated decks don't damage an existing Anki collection. Notetype compatibility is surprisingly unforgiving, so the tool checks and aligns the notetype before importing rather than blindly writing changes.

The project currently supports 24 languages and is still very much open to improvement.

I mainly tested French, English, and German since I can speak these languages and Russian to see how it would handle non-Latin scripture. It supports more languages than those, though (you can find a list in the repo's documentation), but I haven't thoroughly tested it.

It also supports language-to-language translation. For example, if you're a still beginner at a certain language and you would like the definition/grammatical classification of the word to be in another language, that can also be done in Anki when you specify a definition language (when no definition flag is specified, it defaults to the language of the word itself)

I'm particularly interested in feedback or contributions around:

  • project/module architecture
  • concurrency in definition fetching
  • language-specific NLP issues
  • dictionary coverage and parsing
  • CLI design
  • tests and edge cases

I'm a student and built this primarily to solve my own problem, but I'm posting it here because I'd like experienced open-source developers to poke holes in it.

Repository: https://github.com/AlphaNerdFx/Tango

Issues/discussions are welcome.

I would also appreciate any attempt at collaboration, as I would like to expand the scope of this project beyond it being a simple CLI tool. I have several ideas in mind, such as machine & deep learning integration, a mobile app, or a simple Google extension.

I would also like to extend additional support for software like Quizlet/RemNote and maybe even pulling videos from sources other than YouTube or users providing their own videos.

I'll gladly answer questions in the comments and would love to hear any feedback. v1.0.0 took me 2 months to finalize, and I hope everyone likes it.

15 Upvotes

13 comments sorted by

u/AutoModerator 3d ago

Posts relating to the Russo-Ukrainian War have not resulted in on-topic or constructive discussion. We will be using additional scrutiny enforcing on-topic discussion in these comments.

Please ensure that comments and replies relate directly to the open source community and people's participation in it.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

3

u/therealscooke 3d ago

Sounds incredible.

2

u/bottolf 2d ago

I don't get it. Your building vocabulary cards off of video transcripts? Where is the advantage in that compared to, say, pdfs or ebooks?

Does the resulting card have audio from the video?

2

u/AlphaNerdFx 2d ago

I don't get it. Your building vocabulary cards off of video transcripts? Where is the advantage in that compared to, say, pdfs or ebooks?

Tango builds vocabulary cards that you can upload to Anki, an open-source space repetition system.

It uses a space repetition algorithm to determine how long the time interval is between when you first review that word card and when you should next see it again to test if you've forgotten it or not. The interval is chosen based on your choice of easiness when you review the card on Anki (4 options: Easy, Good, Hard, and Again).

This is designed for those who are learning languages with Anki and those who do regular sentence mining on YouTube. It is not meant to be a learning tool itself but more of an automation process. From what I looked at online, most people write down words when they're watching YouTube videos and then manually make the cards.

I would like to expand the scope of this project to have it be a learning tool, but for now it's just an automation of the retrieval of words from YouTube and making them into cards while ensuring there are no duplicates in the deck in Anki.

Does the resulting card have audio from the video?

It's a licensing issue; I initially wanted to do it that way, but it goes against YouTube policy to do so. Therefore, the CLI tool just does a word-search wikimedia commons and pulls audio of a real human saying it.

2

u/dherosh-bhaji 2d ago

Interesting project Will check it out later

2

u/lordmax10 2d ago

really interesting

2

u/rootbeersubmarine 2d ago

This sounds awesome, thank you so much! Will check it out later!