Public
Edited
Nov 13, 2024
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
<style>
* {
box-sizing: border-box;
}
.item {
display: flex;
background: #eee;
font-family: "Roboto Condensed";
font-size: 6em;
width: 100%;
padding: 2em 1em 2em;
}
.item span {
width: 1.5em;
height: 1.5em;
text-align: center;
margin: 0.1em;
padding: 0em 0.1em;
background: #000;
border-radius: 0.1em;
color: #fff;
font-variant-numeric: tabular-nums;
}
.item span:nth-child(1) {
width: 2em;
font-weight: 100;
background: #003;
color: #ddf;
opacity: 1;
}
</style>
Insert cell
uniqueItems = [...new Set(items.map((d) => d.join("")))].map((d, i) => ({
index: i + 1,
word: d,
pronounceable: pronounceable(d),
kana: pronounceable(d) ? convertRomanToKana(d) : ""
}))
Insert cell
uniqueItems
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
items = permutator(strs.sort())
Insert cell
strs = "GAKKOU".split("")
Insert cell
pronounceable("KKOKKOA")
Insert cell
pronounceable = (str) => {
// const regex = new RegExp("^([GK]*[AUO])|([AUO][GK]{2}){1,6}$", "i");
// return str.match(regex) !== null;
const cv = [...str].map((d) => (vowels.includes(d) ? "_" : d)).join("");
const patterns = [
"_G_KK_",
"_KK_G_",
"G_KK__",
"G_K_K_",
"G__KK_",
"K_G_K_",
"K_K_G_",
];
return patterns.includes(cv);
}
Insert cell
consonants = "GK".split("")
Insert cell
vowels = "AUO".split("")
Insert cell
//https://stackoverflow.com/questions/9960908/permutations-in-javascript
permutator = (inputArr) => {
let result = [];

const permute = (arr, m = []) => {
if (arr.length === 0) {
result.push(m);
} else {
for (let i = 0; i < arr.length; i++) {
let curr = arr.slice();
let next = curr.splice(i, 1);
permute(curr.slice(), m.concat(next));
}
}
};

permute(inputArr);

return result;
}
Insert cell
Insert cell
import { Scrubber } from "@mbostock/scrubber"
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