Skip to main content

Toisto is a command-line app to practice languages.

Project description

Toisto

Command-line app to practice languages. Toisto is Finnish and means reiteration, playback, repetition, reproduction.

Toisto is alpha software at the moment. It comes with a limited set of words and phrases in Dutch, English, and Finnish.

User guide

How to install

Make sure you have these prequisities installed:

Install Toisto as follows:

$ pipx install Toisto

How to use

Start Toisto as follows, giving the language you want to practice and your language as arguments:

$ toisto fi en

To practice a specific topic, pass it as follows:

$ toisto fi en --topic colors

Add --help or -h to get help information:

$ toisto --help

Example session

$ toisto fi nl
👋 Welcome to Toisto v0.0.6!

Practice as many words and phrases as you like, for as long as you like.
Hit Ctrl-C or Ctrl-D to quit.

Toisto tracks how many times you correctly translate words and phrases.
When you correctly translate a word or phrase multiple times in a row,
Toisto will not quiz you on it for a while. The more correct translations
in a row, the longer words and phrases are silenced.

Translate into Dutch:
Punainen
> rood
✅ Correct.

Translate into Dutch:
Harmaa
> bruin
⚠️ Incorrect. Please try again.
> grijs
✅ Correct.

Translate into Finnish:
Paars
> violetti
✅ Correct.

Translate into Finnish:
Groen
> virea
⚠️ Incorrect. Please try again.
> vihrea
❌ Incorrect. The correct answer is "Vihreä".

How it works

Toisto presents words and phrases for you to translate. For each word or phrase, Toisto counts how often you translate it correctly in a row. So each word or phrase has its own streak. When you translate a word or phrase correctly, increasing its streak, Toisto will silence the word for a while. The longer the streak, the longer a word or phrase is silenced.

When you stop the program (hit Ctrl-C or Ctrl-D), progress is saved in a file named .toisto-progress.json in your home folder.

Developer guide

The information below is aimed at people who (want to help) develop Toisto.

How to prepare

Clone the repository:

$ git clone https://github.com/fniessink/toisto.git

Create a virtual environment, activate it, install the dependencies and install Toisto in development mode:

$ cd toisto
$ python3 -m venv venv
$ . venv/bin/activate
$ pip install -r requirements-dev.txt
$ pip install -e .

How to test

Run the unit tests as follows:

$ green
.................

Ran 17 tests in 0.305s using 8 processes

OK (passes=17)

To run the unit tests and get a coverage report, use:

$ green -r

How to check quality

Run mypy to check for typing issues:

$ mpypy src tests
Success: no issues found in 12 source files

Run Pylint to check for linting issues:

$ pylint src tests

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

How to release

Update the version number in pyproject.toml.

Create the distribution files by running:

$ python -m build

Upload the distribution files to PyPI by running:

$ twine upload dist/*

Tag the commit and push it:

$ git tag vX.Y.Z
$ git push --tags

Software documentation

Topics

Topics are located in src/toisto/topics in the form of JSON files. The format of the JSON files is as follows:

[
    {"fi": "Viikonpäivät", "nl": "De dagen van de week"},
    {"fi": ["Mikä päivä tänään on?", "Mikä päivä on tänään?"], "nl": "Welke dag is het vandaag?"}
    {"singular": {"fi": "Päivä", "nl": "De dag"}, "plural": {"fi": "Päivät", "nl": "De dagen"}},
]

Each topic is a list of entries. There are two types of entries:

  1. A translation entry. Translation entries are mappings with exactly two language key-value pairs. The key is a language identifier. Currently "en" for English, "fi" for Finnish, and "nl" for Dutch are supported. Each language identifier has a value that is either a string or a list of strings. The values are words, phrases, or sentences in the language indicated by the key.
  2. A noun entry. The entry is a mapping with singular and plural as keys and translation entries as values. It represents a noun with singular and plural versions in English, Finnish, and Dutch.

Toisto uses the entries to generate quizzes. Currently, two types of quizzes are generated:

  1. Quizzes to translate a phrase from one language to another and vice versa. Toisto quizzes the user in both directions. If the language value is a list, Toisto uses all items as question and as answer. So both "Mikä päivä tänään on?" and "Mikä päivä on tänään?" are asked as question and both are accepted as correct answer for the quiz "Welke dag is het vandaag?"
  2. Quizzes to singularize a plural noun or pluralize a singular noun. Users are only asked to singularize and pluralize nouns in their practice language, not their own language.

Spaced repetition

Toisto uses a very simple implementation of a spaced repetition algorithm. Toisto does not make assumptions about how many words the user wants to practice per session or per day. It only keeps track of how many times in a row a specific word or phrases is translated correctly. When a word or phrases is translated correctly twice or more in a row, the word is silenced for a while. The longer the streak, the longer the word is silenced. The exact amount is determined by a S-curve with a maximum value of 90 days. Whenever the user makes a mistake the streak is reset to 0.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

Toisto-0.0.6.tar.gz (20.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

Toisto-0.0.6-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file Toisto-0.0.6.tar.gz.

File metadata

  • Download URL: Toisto-0.0.6.tar.gz
  • Upload date:
  • Size: 20.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for Toisto-0.0.6.tar.gz
Algorithm Hash digest
SHA256 7fcb4047d574c3e6c9adfbf83ed9491bde8a56699677984f6ac1fad75515f4c9
MD5 8e258d2f4ccc2956dcbc29e246a336ec
BLAKE2b-256 0d290279f6fec952d37b71f21c2b9dba1dec650716c8000395fb2b094895ffe2

See more details on using hashes here.

File details

Details for the file Toisto-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: Toisto-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.0

File hashes

Hashes for Toisto-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 78e11378c80d54e05676f033c53861f82eb50d7403a62b47abbacd58950177e9
MD5 18ec70a871019b3a67ccc1061a924925
BLAKE2b-256 a0443d4c8704ec5a32f9213e48f6a209c0472384b8cf1755b59ae8ae874a8a47

See more details on using hashes here.

Supported by

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