-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetect-chain.ts
More file actions
23 lines (19 loc) · 854 Bytes
/
Copy pathdetect-chain.ts
File metadata and controls
23 lines (19 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* Composition: detect which loaded system best explains an input/output
* pair, then transliterate through the winner.
*/
import { detect, loadMapAsync, transliterateAsync } from "../src/index.js"
import { configureSharedStack } from "./_lib/stack.js"
export const title = "Detect the system, then convert"
export const summary =
"Rank the loaded maps by how well they explain a source/target pair, and use the best hit."
export const expected = "Anton Olehovych"
const CANDIDATES = ["bgnpcgn-ukr-Cyrl-Latn-2019", "un-tam-Taml-Latn-1972"] as const
export async function run(): Promise<string> {
configureSharedStack()
for (const system of CANDIDATES) {
await loadMapAsync(system)
}
const [best] = detect("Антон Олегович", "Anton Olehovych")
return transliterateAsync(best.mapName, "Антон Олегович")
}