A deephaven.ui element that reads text to you one word at a time — rapid serial visual presentation (RSVP), the technique behind Spritz-style readers.
Because the words appear in a fixed position, your eyes never move between them. The highlighted pivot letter marks the optimal recognition point, the spot the eye naturally focuses on, and it stays put no matter how long the word is.
pip install deephaven-plugin-speed-readerRestart the Deephaven server so it picks up the plugin.
speed_reader takes a string and returns an element. There is no hook to call and nothing to
mount.
from deephaven import ui
from deephaven_plugin_speed_reader import speed_reader
@ui.component
def my_panel():
return speed_reader("The quick brown fox jumps over the lazy dog", default_wpm=400)
my_reader = my_panel()text is the single positional argument; everything else is optional.
| Option | Type | Default | Notes |
|---|---|---|---|
text |
str |
— | The text to read out, split on whitespace. |
wpm |
int |
unset | Words per minute, for controlled use. When set, this wins over the slider. |
default_wpm |
int |
300 |
Starting words per minute, for uncontrolled use. |
on_wpm_change |
Callable[[int]] |
— | Called with the new value whenever the speed control is adjusted. |
auto_start |
bool |
True |
Begin reading as soon as the component renders. |
loop |
bool |
False |
Restart from the first word after the last. |
show_controls |
bool |
True |
Show the play/pause, restart and speed controls. |
on_complete |
Callable[[]] |
— | Called when the last word has been shown; with loop, once per pass. |
Speed is clamped to 60–1200 wpm.
Follows the same convention as other deephaven.ui inputs.
Uncontrolled — the component owns the speed. Simplest, and the slider works on its own:
speed_reader(passage, default_wpm=350)Controlled — Python owns the speed, so anything can drive it. Pass wpm and update it from
on_wpm_change, or the slider will appear stuck:
@ui.component
def my_panel():
wpm, set_wpm = ui.use_state(300)
return ui.flex(
speed_reader(passage, wpm=wpm, on_wpm_change=set_wpm),
ui.button("Speed read", on_press=lambda _e: set_wpm(800)),
direction="column",
)speed_reader takes a plain string, so any source works — including a table cell:
@ui.component
def article_reader():
body, set_body = ui.use_state("Click a row to start reading.")
return ui.flex(
ui.table(articles, on_row_press=lambda row: set_body(row["Body"]["value"])),
speed_reader(body, default_wpm=400),
)New text resets the reader to the first word.
See examples/ for complete, runnable panels.
See AGENTS.md for the dev loop, project layout, and how to build, test, and lint.
Apache-2.0
