Skip to main content

Buca

Buca is a small Python script to blank some words in a text. I feed it with lyrics and it gives me a text with blanks I can then fill when listening to the song. It’s very helpful for vocabulary when learning a new language.

Install

pip3 install buca

Usage

buca [--ratio RATIO] [--fixed-size] [--numbers] [--max-count COUNT] [<file>]
  • --ratio RATIO: change the default blank-to-word ratio. The default is 0.12, i.e. about 12% of the words are removed.
  • --fixed-size: by default, missing words are replaced with a sequence of _ of the length of the word. Using this option changes that to a fixed length that doesn’t depend on the word.
  • --numbers: prefix blanks with an index, starting at 1. If you don’t want to print the text, you can report those numbers on a piece of paper.
  • --max-count COUNT: limit the blanked words count.

If <file> is not provided or if it’s -, the script reads on STDIN.

Because it relies on randomness, each invocation of the script on the same text should have different results. The number of blanked words may also change.

Note that a word is defined as a sequence of two or more alphanumerical characters.

Examples

Raw text:

Le cose che abbiamo in comune sono 4850
le conto da sempre, da quando mi hai detto
"ma dai, pure tu sei degli anno '60?"
abbiamo due braccia, due mani
due gambe, due piedi
due orecchie ed un solo cervello

Default parameters

$ buca example.txt
Le cose che abbiamo in comune sono 4850
le conto da sempre, da ______ __ hai detto
"ma dai, pure tu sei degli anno '__?"
abbiamo due braccia, due mani
___ gambe, due piedi
due orecchie ed un solo cervello

Increased ratio

$ buca --ratio 0.2 example.txt
Le cose che abbiamo __ comune sono ____
le conto da sempre, da quando __ hai detto
"ma dai, pure tu sei degli ____ '60?"
_______ due braccia, ___ ____
due gambe, due piedi
due ________ __ un solo cervello

Fixed-size

$ buca --fixed-size example.txt
Le cose che abbiamo in comune sono 4850
_____ conto da sempre, da quando mi hai _____
"ma dai, pure tu sei degli anno '60?"
abbiamo due braccia, due _____
due gambe, due piedi
due orecchie ed un solo cervello

With numbers

$ buca --numbers example.txt
Le (1) ____ che abbiamo in comune sono (2) ____
le conto da sempre, da quando mi hai detto
"ma dai, pure tu sei degli anno '60?"
abbiamo due braccia, due mani
(3) ___ gambe, due piedi
due orecchie (4) __ un solo cervello

Metadata

Release files for buca 0.0.2

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

Source distribution (sdist)

Source distribution for buca 0.0.2
File Size Uploaded
buca-0.0.2.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for buca 0.0.2
File Interpreter ABI Platform
buca-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / buca-0.0.2.tar.gz

Download URL buca-0.0.2.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
849cf0b8044123141b04a80bef23b8086bea8a67b9cee3b043725d1b5b88aa0c
BLAKE2b-256 checksum
How to use checksums
b24a626fe68c5964ed1eb5a83b11a13e4908b01db30aee5bd897717d77f4a711
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.4

Release files / buca-0.0.2-py3-none-any.whl

Download URL buca-0.0.2-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
be6ae002e3f1e7dd042e7cecc8341f6aedad048010fa544fd6514c89a5839a8f
BLAKE2b-256 checksum
How to use checksums
fce2659881ab3bf7c78a5b85e26d99661023feac0902c1c197c2b09b92303104
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.7.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

1 release file

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