Public
Edited
May 31, 2023
1 fork
12 stars
Insert cell
Insert cell
Insert cell
neighbors(word)
Insert cell
Insert cell
words = fetch(
"https://raw.githubusercontent.com/joisino/wordtour/main/wordtour.txt"
)
.then((d) => d.text())
.then((d) => d.trim().split("\n"))
Insert cell
indexed = new Map(words.map((d, i) => [d, i]))
Insert cell
function neighbors(word, k = 5) {
const i = indexed.get(word);
if (i === undefined) throw new Error(`Unknown word ${word}`);
return d3.range(-k, k + 1).map((j) => words.at(i + j));
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more