Public
Edited
Nov 29, 2023
Insert cell
Insert cell
Insert cell
fixedTextData = textData.replace(/"""(.*?)"(.*?)"(.*?)"""/g, "\"$1\\\"$2\\\"$3\"")
Insert cell
data = JSON.parse(fixedTextData)
Insert cell
Insert cell
normalizeTitle = title => {
return title
.toLowerCase()
.replace(/ü/g,"u")
.replace(/í/g,"i")
.replace(/á/g,"a")
.replace(/ö/g,"o")
.replace(/ä/g,"a")
.replace(/é/g,"e")
.replace(/iy/,"y")
.replace(/&/g,"and")
.replace(/world health organization/g, "who")
.replace(/of/g,"in")
.replace(/der/g,"")
.replace(/ph/g,"f")
.replace(/[.(), '[\]/]/g,"")
}
Insert cell
areTitlesSimilarEnoughOld = (title1, title2) => {
let nt1 = normalizeTitle(title1)
let nt2 = normalizeTitle(title2)
return nt1 === nt2 || nt1.indexOf(nt2) > -1 || nt2.indexOf(nt1) > -1
}
Insert cell
areTitlesSimilarEnough = (title1, title2, similarity) => {
let matchCount = 0
let shortestText = normalizeTitle(title1.length < title2.length ? title1 : title2)
let longestText = normalizeTitle(title1.length < title2.length ? title2 : title1)
let lastIndex = 0
for (const c of shortestText) {
let newIndex = longestText.substring(lastIndex).indexOf(c)
if (newIndex > -1) {
matchCount += 1
lastIndex = newIndex
}
}
let similiarityPercent = matchCount / shortestText.length
console.log(similiarityPercent)
return similiarityPercent >= similarity
}
Insert cell
areTitlesSimilarEnough("Mappemonde", "M@ppemonde", 0.9)
Insert cell
items08 = items.filter(x => !areTitlesSimilarEnough(x.data.scopus["dc:title"],x.data.research.Title, 0.0))
Insert cell
items09 = items.filter(x => !areTitlesSimilarEnough(x.data.scopus["dc:title"],x.data.research.Title, 0.2))
Insert cell
Insert cell
md`${itemsWithDifferentTitles.map(x => "1: " + x.data.scopus["dc:title"] + "\n\n2: " + x.data.research.Title + "\n\n\n\n")}`
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