Published unlisted
Edited
Nov 6, 2019
Insert cell
Insert cell
Insert cell
tfidf = import("tiny-tfidf")
Insert cell
Insert cell
Insert cell
Insert cell
metadata = d3.csv(
"https://raw.githubusercontent.com/jameshahn2/synod-documents/master/index.csv"
)
Insert cell
Insert cell
popes = metadata.map(d => d.pope);
Insert cell
Insert cell
Changed in fork
-
files = metadata.map(d => "https://raw.githubusercontent.com/jameshahn2/synod-documents/master/writings/" + d.filename);
+
files = metadata.map(d => `https://raw.githubusercontent.com/jameshahn2/synod-documents/master/writings/${d.filename}`);
Insert cell
Changed in fork
-
writings = Promise.all(files.map(d => d3.text(d)))
+
writings = Promise .all(files.map(d => d3.text(d).catch(() => null))) .then(texts => texts.filter(t => t !== null))
Insert cell
Insert cell
corpus = new tfidf.Corpus(
popes,
writings,
useStopwords,
customStopwords,
K1,
b
)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
similarity = new tfidf.Similarity(corpus)
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell