Public
Edited
Jul 22, 2021
2 stars
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
phonemeIntersection = function(twoWords) {
let firstPhonemes = (RiTa.phones(twoWords[0])).split("-");
let secondPhonemes = (RiTa.phones(twoWords[1])).split("-");
let intersectSounds = intersect(firstPhonemes, secondPhonemes);
let possibleWords = RiTa.search();
let intersectWords = [];
for (let i=0; i < possibleWords.length; i++) {
let phones = (RiTa.phones(possibleWords[i])).split("-");
if (containedIn(phones, intersectSounds)) {
intersectWords.push(possibleWords[i]);
}
}
return intersectWords;
}
Insert cell
Insert cell
phonemeDifference = function(twoWords) {
let firstPhonemes = (RiTa.phones(twoWords[0])).split("-");
let secondPhonemes = (RiTa.phones(twoWords[1])).split("-");
let differenceSounds = difference(firstPhonemes, secondPhonemes);
let possibleWords = RiTa.search();
let differenceWords = [];
for (let i=0; i < possibleWords.length; i++) {
let phones = (RiTa.phones(possibleWords[i])).split("-");
if (containedIn(phones, differenceSounds)) {
differenceWords.push(possibleWords[i]);
}
}
return differenceWords;
}
Insert cell
Insert cell
phonemeUnion = function(twoWords) {
let firstPhonemes = (RiTa.phones(twoWords[0])).split("-");
let secondPhonemes = (RiTa.phones(twoWords[1])).split("-");
let unionSounds = union(firstPhonemes, secondPhonemes);
let possibleWords = RiTa.search();
let unionWords = [];
for (let i=0; i < possibleWords.length; i++) {
let phones = (RiTa.phones(possibleWords[i])).split("-");
if (containedIn(phones, unionSounds)) {
unionWords.push(possibleWords[i]);
}
}
return unionWords;
}
Insert cell
Insert cell
wordsList = function(wordsInput) {
return [wordsInput.elements.item(0).value, wordsInput.elements.item(1).value];
}
Insert cell
containedIn = function(list1, list2) {
for (let i=0; i < list1.length; i++){
if (list2.indexOf(list1[i]) < 0) {
return false;
}
}
return true;
}
Insert cell
intersect = function (a, b) {
var setB = new Set(b);
return [...new Set(a)].filter(x => setB.has(x));
}
Insert cell
difference = function (a, b) {
var setB = new Set(b);
return [...new Set(a)].filter(x => !setB.has(x));
}
Insert cell
union = function (a, b) {
var comb = a.concat(b);
return [...new Set(comb)];
}
Insert cell
listDisplay = function(list) {
let output = "<b>";
for (let i=0; i < list.length; i++) {
output += list[i].toString() + "<br>";
}
return output + "</b>";
}
Insert cell
Insert cell
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