<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://yezur.xyz/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AAuphen%2Fsandbox%2Fframe</id>
	<title>Module:Auphen/sandbox/frame - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://yezur.xyz/w/index.php?action=history&amp;feed=atom&amp;title=Module%3AAuphen%2Fsandbox%2Fframe"/>
	<link rel="alternate" type="text/html" href="https://yezur.xyz/w/index.php?title=Module:Auphen/sandbox/frame&amp;action=history"/>
	<updated>2026-08-28T19:38:39Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://yezur.xyz/w/index.php?title=Module:Auphen/sandbox/frame&amp;diff=9965&amp;oldid=prev</id>
		<title>Thiorosan: test rig: Auphen/frame pointed at the sandbox engine</title>
		<link rel="alternate" type="text/html" href="https://yezur.xyz/w/index.php?title=Module:Auphen/sandbox/frame&amp;diff=9965&amp;oldid=prev"/>
		<updated>2026-08-26T12:37:36Z</updated>

		<summary type="html">&lt;p&gt;test rig: Auphen/frame pointed at the sandbox engine&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Module:Auphen/sandbox/frame -- test rig: [[Module:Auphen/frame]] pointed at&lt;br /&gt;
-- [[Module:Auphen/sandbox]], so a candidate engine can be run side by side with&lt;br /&gt;
-- the live one before it is promoted. Keep in step with the real frame.&lt;br /&gt;
-- Backs {{auphen}}: with no ruleset it estimates pronunciation; with a named&lt;br /&gt;
-- ruleset it runs that derivation. p.auphen formats the result (/.../ for an&lt;br /&gt;
-- estimate); p.raw returns the bare engine output (used by the testcases page).&lt;br /&gt;
local Auphen = require(&amp;#039;Module:Auphen/sandbox&amp;#039;)&lt;br /&gt;
&lt;br /&gt;
local p = {}&lt;br /&gt;
&lt;br /&gt;
-- Copy an mw.loadData category proxy into plain Lua tables for the engine.&lt;br /&gt;
local function plain_cats(src)&lt;br /&gt;
	if type(src) ~= &amp;#039;table&amp;#039; then return nil end&lt;br /&gt;
	local out = {}&lt;br /&gt;
	for name, members in pairs(src) do&lt;br /&gt;
		local m = {}&lt;br /&gt;
		for i = 1, #members do m[i] = members[i] end&lt;br /&gt;
		out[name] = m&lt;br /&gt;
	end&lt;br /&gt;
	return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- Core: returns (output, isEstimation, errMessage). errMessage ~= nil on error.&lt;br /&gt;
local function run_core(a)&lt;br /&gt;
	local word = mw.text.trim(a[1] or &amp;#039;&amp;#039;)&lt;br /&gt;
	local code = mw.text.trim(a[2] or &amp;#039;&amp;#039;)&lt;br /&gt;
	local rs   = mw.text.trim(a[3] or &amp;#039;&amp;#039;)&lt;br /&gt;
	if word == &amp;#039;&amp;#039; then return nil, nil, &amp;#039;no word given&amp;#039; end&lt;br /&gt;
	if code == &amp;#039;&amp;#039; then return nil, nil, &amp;#039;no language code given&amp;#039; end&lt;br /&gt;
&lt;br /&gt;
	-- require (not mw.loadData): loadData&amp;#039;s read-only proxy does not enumerate&lt;br /&gt;
	-- nested tables under pairs() in Lua 5.1, which would hide the categories.&lt;br /&gt;
	local ok, data = pcall(require, &amp;#039;Module:Auphen/&amp;#039; .. code:upper())&lt;br /&gt;
	if not ok or type(data) ~= &amp;#039;table&amp;#039; then&lt;br /&gt;
		return nil, nil, &amp;#039;no sound data for code &amp;quot;&amp;#039; .. code .. &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
	end&lt;br /&gt;
&lt;br /&gt;
	if rs == &amp;#039;&amp;#039; then&lt;br /&gt;
		local eng = Auphen.new(plain_cats(data.ipacats or data.cats), data.ipa_rules)&lt;br /&gt;
		return eng:run(data.pronounce or &amp;#039;&amp;#039;, word, true), true, nil&lt;br /&gt;
	else&lt;br /&gt;
		local ruleset = (type(data.sets) == &amp;#039;table&amp;#039;) and data.sets[rs] or nil&lt;br /&gt;
		if ruleset == nil then&lt;br /&gt;
			return nil, nil, &amp;#039;unknown ruleset &amp;quot;&amp;#039; .. rs .. &amp;#039;&amp;quot; for code &amp;quot;&amp;#039; .. code .. &amp;#039;&amp;quot;&amp;#039;&lt;br /&gt;
		end&lt;br /&gt;
		local eng = Auphen.new(plain_cats(data.cats or data.ipacats))&lt;br /&gt;
		return eng:run(ruleset, word, false), false, nil&lt;br /&gt;
	end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
local function err(msg)&lt;br /&gt;
	return &amp;#039;&amp;lt;strong class=&amp;quot;error&amp;quot;&amp;gt;Auphen: &amp;#039; .. mw.text.nowiki(msg) ..&lt;br /&gt;
		&amp;#039;&amp;lt;/strong&amp;gt;[[Category:Auphen errors]]&amp;#039;&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- {{#invoke:Auphen/frame|auphen | word | code | ruleset }}  (via {{auphen}})&lt;br /&gt;
function p.auphen(frame)&lt;br /&gt;
	local out, est, e = run_core(frame.args)&lt;br /&gt;
	if e then return err(e) end&lt;br /&gt;
	if est then return &amp;#039;&amp;lt;span class=&amp;quot;IPA&amp;quot;&amp;gt;/&amp;#039; .. out .. &amp;#039;/&amp;lt;/span&amp;gt;&amp;#039; end&lt;br /&gt;
	return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
-- {{#invoke:Auphen/frame|raw | word | code | ruleset }} -- bare output, no&lt;br /&gt;
-- formatting (for the testcases page and callers that want the phonemes only).&lt;br /&gt;
function p.raw(frame)&lt;br /&gt;
	local out, _, e = run_core(frame.args)&lt;br /&gt;
	if e then return &amp;#039;ERROR: &amp;#039; .. e end&lt;br /&gt;
	return out&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Thiorosan</name></author>
	</entry>
</feed>