Skip to main content

lingua-loop

Train your listening skills by transcribing real speech from YouTube videos.

LinguaLoop is a single-page web application designed to improve language listening skills through active transcription. It is based on a transcription-first learning approach where users repeatedly listen to short audio segments and attempt to write down what they've heard.

To run the web application on your computer, you need Python version 3.12 or higher installed. Then you can do the following (in a virtual environment if you want) in a terminal:

pip install git+https://github.com/jfdev001/lingua-loop.git

You can launch the app, which will automatically open a web browser, by doing the following in a terminal:

lingua-loop

Here's how you use the app:

  1. Select the target language you want to study.
  2. Copy and paste a YouTube video URL corresponding to that target language. Ideally, the video should have official transcripts since those will be used as the reference for scoring your transcription attempt.
  3. Listen to short segments of the video (e.g., 10 seconds) and type what you hear. You may replay each segment as many times as needed.
  4. Once you have made an honest attempt, you can submit your transcription attempt and will receive a score from 0 to 1. A score of 1 indicates a perfect transcription and a score of 0 indicates a complete mismatch.
  5. Repeat as long as desired.

The scoring algorithm uses Gestalt pattern matching, which compares your input to the reference transcript by finding the longest common subsequences of characters. For example, if you type

$$ \text{wikim}\textcolor{red}{an}\text{ia} $$

but the official transcript has

$$ \text{wikim}\textcolor{red}{ed}\text{ia} $$

you would receive a score of 0.70 because, despite the error, there are common characters that you correctly typed.

Note that this package is an alpha state and subject to breaking changes and bug fixes. Please open a GitHub issue if you encounter problems!

Future Work

Some possible extension ideas:

  1. Significantly improve the styling.
  2. Integrate Anki-style flash cards for selected words. A word should be added to a flash card deck in addition to the context in which it occurred (e.g., sentence or phrase). The user should write additional context to keep them actively engaged in the learning process.
  3. Support more languages. Currently only Indo-European languages are supported, though support for languages such as Mandarin would be extremely valuable. For Mandarin, I think text normalization would require pinyin.
  4. More sophisticated scoring algorithms.
  5. Integrate an AI chat bot that is given the full transcript as context and subsequently asks the user comprehension questions or engages in conversation about the video topic. Could be executed using local models or combined with API keys.

Developers

The directory structure is inspired by a number of projects, so it is intended to be as standard and intuitive as possible:

lingua-loop
├── src
│   └── lingua_loop
│       ├── api
│       │   └── routers
│       │       └── transcript.py
│       ├── constants.py
│       ├── db
│       │   ├── models.py
│       │   ├── session.py
│       │   └── transcript.py
│       ├── exceptions.py
│       ├── integrations
│       │   └── youtube
│       │       ├── types.py
│       │       └── wrapper.py
│       ├── main.py
│       ├── schemas
│       │   └── transcript.py
│       ├── scripts
│       │   └── run.py
│       ├── services
│       │   ├── text_normalization.py
│       │   └── transcript.py
│       ├── static
│       │   ├── app.js
│       │   └── style.css
│       └── templates
│           └── index.html
└── tests
    ├── boundary
    │   ├── conftest.py
    │   └── test_youtube_transcript_api.py
    ├── conftest.py
    ├── constants.py
    ├── integration
    │   └── test_integration.py
    └── unit
        ├── api
        │   └── test_api.py
        ├── db
        │   └── test_db.py
        └── services
            └── test_services.py

The fast package manger uv was used in the development of this project. You can install lingua-loop in development mode by doing the following:

git clone git@github.com:jfdev001/lingua-loop.git
cd lingua-loop
uv sync

As a sanity check, you should verify the FastAPI backend tests pass:

pytest -v tests/

There are tests to verify the outputs of the youtube_transcript_api dependency, however, these make requests to YouTube, and are therefore not run by default. You can run those tests if you want by including the --slow flag like:

pytest -v --slow tests/

You should also make sure that your files are formatted according to the conventions defined in .pre-commit-config.yaml. To that end, use the fast git hook runner framework prek:

prek install

If you'd like to contribute, consider opening an issue first and/or addressing one of the issues already available. AI contributions will not be accepted. You should fork the project first before contributing. Pull requests should come from branches with the following structure:

<name>/<issue-number-if-applicable>-<feature-description>

The frontend is vanilla JS/HTML/CSS, so using npm is not strictly necessary, but if you'd like type hints for the Youtube iframe API, you can install the frontend dependencies with:

npm install

References

Below are a series of references, in no particular order, that I used to gain the necessary background knowledge for the project:

[1] Python FastAPI Tutorial (Part 1): Getting Started - Web App + REST API

[2] Learn Fast API With This ONE Project

[3] Anatomy of a Scalable Python Project (FastAPI)

[4] Developing and Testing an Asynchronous API with FastAPI and Pytest & github.com/fastapi-crud-async

[5] Netflix/dispatch

[6] polarsource/polar

[7] FastAPI: Modern Web Development (Lubanovic 2024)

[8] ecmwf/forecast-in-a-box

[9] fastapi-docs: Testing Dependencies

[10] Build Advanced Youtube Player UI -- Video and Build Advanced Youtube Player UI -- Source Code

Metadata

Release files for lingua-loop 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lingua-loop 0.1.4
File Size Uploaded Provenance Actions
lingua_loop-0.1.4.tar.gz 25.8 kB Without provenance Details for lingua_loop-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lingua-loop 0.1.4
File Interpreter ABI Platform Actions
lingua_loop-0.1.4-py3-none-any.whl Python 3 none any Details for lingua_loop-0.1.4-py3-none-any.whl

Total release size: 52.6 kB

Release files / lingua_loop-0.1.4.tar.gz

Download URL lingua_loop-0.1.4.tar.gz
Size 25.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f06f15d513f37ae91cdaac20468ac448d95a977bc65df1fe075a32c308757339
BLAKE2b-256 checksum
How to use checksums
1a92919672edbc25ddabb9f9183bf3557e7f6197c7380b3bc12c81dcb8174336
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Release files / lingua_loop-0.1.4-py3-none-any.whl

Download URL lingua_loop-0.1.4-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4d70a3c9d29b5ef6f46de8b5e40a75bc32e50064330ee6343397c901c529644c
BLAKE2b-256 checksum
How to use checksums
0cb151cdd8261d7d5696b144deb559e6c400fe244726b162d048933d352228aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.4

Security for lingua-loop 0.1.4

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.

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page