Howdy y’all!
Digging into Observable for the first time. Spent the morning trying to reproduce the Introduction to text analysis with TF-IDF tutorial by @kerryrodden. I’m trying to use this to analyze a collection of Church documents over time and consistently getting hung trying to fetch the text of each document.
I initially named the folder “documents”, but since “document” is reserved I switched it to “writings”. No matter what I try I’m getting these errors.
Does anyone know what I’m doing wrong?
1 Like
Hi @jameshahn2! Here’s a quick way for you to see what’s happening:
Promise.all(files.map(async f => [f, await d3.text(f).catch(error => error)]))
Or, to just show the broken URLs:
{
const errors = [];
for (const f of files) {
try {
await d3.text(f);
} catch (error) {
errors.push(f);
yield errors;
}
}
}
For me this yields two broken links:
https://raw.githubusercontent.com/jameshahn2/synod-documents/master/writings/Justicia_in_Mundo_SYNOD.txt
https://raw.githubusercontent.com/jameshahn2/synod-documents/master/writings/Africa_Munus_SYNOD.txt
The first appears intended to refer to
https://raw.githubusercontent.com/jameshahn2/synod-documents/master/writings/Justicia-in-Mundo_SYNOD.txt
But the second referenced file doesn’t appear to exist in the repository.
If you want to ignore any failing files, you can do this:
writings = Promise
.all(files.map(d => d3.text(d).catch(() => null)))
.then(texts => texts.filter(t => t !== null))
Here is a suggestion you can merge with this change:
3 Likes
Awesome! I’ll get to the bottom of this.
Thank you, sir!!