Rand Stats

App::ByWord

zef:FCO

Actions Status

NAME

App::ByWord — Rapid serial word presentation in the terminal

SYNOPSIS

use App::ByWord;

my $s = supply {
    .emit for "This is an accelerated reading example.".words;
    done;
}

by-word $s, :wpm(400), :border, :line-no(12), :to-left(5);

DESCRIPTION

App::ByWord renders one word at a time centered in the terminal, highlighting the letter at the Optimal Recognition Point (ORP) in red. This follows the RSVP (Rapid Serial Visual Presentation) approach to minimize eye movement and speed up reading. The pace is controlled via words per minute (WPM). The terminal screen is saved/restored and the cursor is hidden while rendering; pressing Ctrl‑C (SIGINT) stops playback and restores the terminal state.

INTERFACE

sub by-word

sub by-word(
    Supply() $supply,
    Int  :$wpm     = 300,
    Bool :$border  = True,
    Int  :$line-no = 11,
    Int  :$to-left = 5,
) is export

ORP (Optimal Recognition Point)

The ORP index is computed as:

min(4, max(1, floor($word.chars div 3)))

This picks an internal index (1..4) for the character to highlight in each word, aiding faster recognition.

EXAMPLES

    by-word $*IN.Supply;
    by-word Supply.merge(|@files.map(*.IO.open.Supply));

Or use the CLI script in bin/by-word.raku:

    by-word --wpm=450 --no-border text.txt

SIGNALS

DEPENDENCIES

SEE ALSO

Terminal::Width, Terminal::ANSI

AUTHOR

Fernando Correa de Oliveira fco@cpan.org

COPYRIGHT AND LICENSE

Copyright 2026 Fernando Correa de Oliveira

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.