Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/components/MapCatalogue.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<script setup lang="ts">
/**
* MapCatalogue — searchable, filterable browser for all 287 maps.
* MapCatalogue — searchable, filterable browser for the whole map corpus.
*
* Visual metaphor: library card catalogue. Each map is a card with an
* authority "stamp", script flow (source → destination), and a sample
Expand All @@ -14,7 +14,6 @@ import { ref, computed, defineProps } from "vue"
interface Invertibility {
verdict: string
pairs: number
context_rules?: number
many_to_one: number
one_to_many: number
}
Expand All @@ -26,7 +25,6 @@ interface CatalogueEntry {
sourceScript: string
destinationScript: string
year: string
language?: string
description?: string
invertibility?: Invertibility | null
hasTest: boolean
Expand Down
44 changes: 26 additions & 18 deletions src/pages/maps/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -91,24 +91,32 @@ const liveDemoable = entries.filter((e) => bundledCodes.has(e.code)).length
<section class="container catalogue-section">
<MapCatalogue
client:load
entries={entries.map((e) => ({
code: e.code,
authority: e.data.authority_id,
name: e.data.name,
sourceScript: e.data.source_script,
sourceScriptName: scriptName(e.data.source_script),
destinationScript: e.data.destination_script,
destinationScriptName: scriptName(e.data.destination_script),
year: e.data.creation_date ?? e.data.id,
language: e.data.language,
description: e.data.description,
invertibility:
(e as unknown as { invertibility?: Invertibility }).invertibility ?? null,
hasTest: Boolean(e.test && e.test[0]),
testInput: e.test?.[0] ?? null,
testExpected: e.test?.[1] ?? null,
liveDemoable: bundledCodes.has(e.code),
}))}
entries={entries.map((e) => {
const inv = (e as unknown as { invertibility?: Invertibility }).invertibility
// Hydration pays for this payload twice (SSR markup + serialized
// props), so pass only the fields MapCatalogue actually renders.
return {
code: e.code,
authority: e.data.authority_id,
name: e.data.name,
sourceScript: e.data.source_script,
destinationScript: e.data.destination_script,
year: e.data.creation_date ?? e.data.id,
description: e.data.description,
invertibility: inv
? {
verdict: inv.verdict,
pairs: inv.pairs,
many_to_one: inv.many_to_one,
one_to_many: inv.one_to_many,
}
: null,
hasTest: Boolean(e.test && e.test[0]),
testInput: e.test?.[0] ?? null,
testExpected: e.test?.[1] ?? null,
liveDemoable: bundledCodes.has(e.code),
}
})}
authorities={authorities}
sourceScripts={sourceScripts}
destinationScripts={destinationScripts}
Expand Down
43 changes: 30 additions & 13 deletions src/pages/playground.astro
Original file line number Diff line number Diff line change
@@ -1,18 +1,30 @@
---
// Playground: the full two-layer stack in the browser — pick any of the
// 289 authority systems, optionally vocalize Arabic through the neural
// Playground: the full two-layer stack in the browser — pick any
// authority system, optionally vocalize Arabic through the neural
// layer first, transliterate off-main-thread, share the state by URL,
// and copy the exact TS that does the same thing.
import Base from "../layouts/Base.astro"
import catalogue from "../data/maps-catalogue.json"

import catalogue from "../data/maps-catalogue.json" with { type: "json" }

// Importing the whole catalogue from the client script used to bundle
// ~450 KB of map metadata the page never renders. The playground only
// needs {code, name}, so trim it at build time and inject it as
// data; counts read the same source, so prose and placeholder cannot
// drift stale.
interface CatalogueEntry {
data: { name: string }
}
const systems = Object.entries(catalogue as Record<string, CatalogueEntry>).map(
([code, m]) => ({ code, name: m.data.name }),
)
const systemCount = systems.length
---

<Base title="Playground">
<section class="page-narrow">
<section class="page-narrow" id="playground" data-systems={JSON.stringify(systems)}>
<h1>Playground</h1>
<p>
Runs entirely in your browser: {289} authority systems and the neural
Runs entirely in your browser: {systemCount} authority systems and the neural
models for text that has no published system. No text is sent to a
server.
</p>
Expand All @@ -30,7 +42,11 @@ import catalogue from "../data/maps-catalogue.json"
</select>

<label for="filter">System</label>
<input id="filter" type="search" placeholder="Filter 289 systems — try “BGN”, “Thai”, “ISO 9”…" />
<input
id="filter"
type="search"
placeholder={`Filter ${systemCount} systems — try “BGN”, “Thai”, “ISO 9”…`}
/>
<select id="system"></select>

<button id="run" class="btn">Transliterate</button>
Expand Down Expand Up @@ -109,16 +125,17 @@ import catalogue from "../data/maps-catalogue.json"
<script>
import { createWorkerClient } from "../scripts/worker-client"
import { imf } from "interscript/ml"
import catalogue from "../data/maps-catalogue.json"

const ASSET_INDEX = "https://api.interscript.org/v1/assets/index-v5/models-index.yaml"

type Sys = { code: string; name: string; lang: string }
const systems: Sys[] = Object.entries(
catalogue as Record<string, { data: { name: string; language: string } }>,
// System list is trimmed at build time and injected on #playground
// (see frontmatter) — importing the catalogue here would bundle it.
const root = document.getElementById("playground")
if (!root) throw new Error("playground root missing")
type Sys = { code: string; name: string }
const systems: Sys[] = (JSON.parse(root.dataset.systems ?? "[]") as Sys[]).sort((a, b) =>
a.name.localeCompare(b.name),
)
.map(([code, m]) => ({ code, name: m.data.name, lang: m.data.language }))
.sort((a, b) => a.name.localeCompare(b.name))

const $ = (id: string) => document.getElementById(id)!
const worker = createWorkerClient()
Expand Down
5 changes: 3 additions & 2 deletions src/pages/status.astro
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,10 @@ const lastSyncDate = new Date(newest.mtime).toISOString().slice(0, 10)
const corpusSizeMb = (totalSizeBytes / 1024 / 1024).toFixed(1)

// Ruby parity — comes from the parity suite in interscript-ts.
// Update via: cd ../interscript-ts && npx tsx scripts/full-parity.ts
// Counts mirror interscript-ts/test/fixtures/full-parity.json; regenerate
// via: cd ../interscript-ts && npx tsx scripts/full-parity.ts
const parityPercent = "100.0%"
const paritySampleCount = 7502
const paritySampleCount = 7544
const parityMapCount = 271
---

Expand Down