Skip to content

Commit

Permalink
Add Dieghv
Browse files Browse the repository at this point in the history
  • Loading branch information
kbseah committed Dec 17, 2024
1 parent 9cddb4f commit 7e5ebf4
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 3 deletions.
35 changes: 32 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
alert("Copied to clipboard!");
}
</script>

<style>
body {
font-size: 14pt;
Expand All @@ -33,6 +34,12 @@
font-size: 18pt;
margin: auto;
}
legend {
font-size: 20pt;
}
label {
font-size: 20pt;
}
.padbox-lightblue {
margin: 1em;
padding: 1em;
Expand All @@ -45,21 +52,35 @@
}
</style>
</head>

<body>

<h1>Teochew Romanization Converter</h1>
<p>Converts between the <a href="https://en.wikipedia.org/wiki/Peng%27im">Guangdong Pêng'im (GDPI)</a> and <a href="https://en.wikipedia.org/wiki/Teochew_Romanization">Pe̍h-ūe-jī (PUJ)</a> romanization systems for <a href="https://en.wikipedia.org/wiki/Teochew_Min">Teochew</a>. <a href="https://github.com/learn-teochew/pengim-js">GitHub repository</a>.</p>
<p><strong>NB: Still in beta testing!</strong></p>

<p>Converts between different romanization systems for the <a href="https://en.wikipedia.org/wiki/Teochew_Min">Teochew</a> language. Currently supported:</p>
<ul>
<li><a href="https://en.wikipedia.org/wiki/Teochew_Romanization">Pe̍h-ūe-jī (PUJ)</a></li>
<li><a href="https://en.wikipedia.org/wiki/Peng%27im">Guangdong Pêng'im (GDPI)</a></li>
<li><a href="https://docs.google.com/document/d/187VokH_NLN4H_fZntbEfFFMdiqZKhZBQUEhI9y7-8vo/mobilebasic">Gaginang Peng'im (GGN)</a></li>
<li><a href="https://github.com/kahaani/dieghv">Dieghv</a></li>
</ul>

<p><strong>NB: Still in beta testing!</strong> <a href="https://github.com/learn-teochew/pengim-js">GitHub repository</a> for this Javascript project. For another implementation in Python, try our <a href="https://github.com/learn-teochew/parsetc">parsetc</a> library.</p>

<p>Requirements for input:</p>

<ul>
<li>No uppercase</li>
<li>All syllables separated by spaces</li>
<li>Punctuation will be ignored</li>
<li>Tones must be marked either by numbers (GDPI) or diacritics (PUJ) on each syllable</li>
</ul>

<div class="padbox-lightblue">
<h2>Input</h2>
<textarea id="input" name="input" rows="4">le2 gai5 ka1 cng1 zing1 dua7</textarea>
</div>

<div class="padbox-lightblue">
<fieldset><legend>Scheme to convert to/from</legend>
<div>
Expand All @@ -70,18 +91,26 @@ <h2>Input</h2>
<input type="radio" id="ggn" name="system" value="ggn" />
<label for="ggn">Gaginang Peng'im</label>
</div>
<div>
<input type="radio" id="dieghv" name="system" value="dieghv" />
<label for="dieghv">Dieghv</label>
</div>
</fieldset>
</div>

<div class="padbox-lightblue">
<button id="topuj_button">Convert to Pe̍h-ūe-jī</button>
<button id="frompuj_button">Convert from Pe̍h-ūe-jī</button>
<button onclick="copyToClipboard()">Copy output to Clipboard</button>

</div>

<div class="padbox-lightpink">
<h2>Output</h2>
<textarea id="output" name="output" rows="4"></textarea>
</div>

<p>Made by <a href="https://learnteochew.com/">LearnTeochew.com</a>; visit our main site to learn more about the Teochew language.</p>

</body>

</html>
125 changes: 125 additions & 0 deletions src/data-dieghv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
export const syllableRe = /^([^aveiou\d]*)([aveiou]*)([hpkmng]*)([012345678]*)$/;

export const initialFromPuj = {
"" : "" ,
"p" : "b" ,
"ph" : "p" ,
"b" : "bh",
"m" : "m" ,
"t" : "d" ,
"th" : "t" ,
"n" : "n" ,
"l" : "l" ,
"ts" : "z" ,
"ch" : "z" ,
"tsh" : "c" ,
"chh" : "c" ,
"s" : "s" ,
"z" : "r" ,
"j" : "r" ,
"dz" : "r" ,
"k" : "g" ,
"kh" : "k" ,
"g" : "gh",
"ng" : "ng",
"h" : "h"
}

export const medialFromPuj = {
"" : "" ,
"a" : "a" ,
"o" : "o" ,
"e" : "e" ,
"ṳ" : "v" ,
"ai" : "ai" ,
"oi" : "oi" ,
"ei" : "ei" ,
"au" : "au" ,
"ou" : "ou" ,
"i" : "i" ,
"ia" : "ia" ,
"io" : "io" ,
"ie" : "ie" ,
"iou" : "iou",
"ieu" : "ieu",
"iau" : "iau",
"iu" : "iu" ,
"u" : "u" ,
"ua" : "ua" ,
"ue" : "ue" ,
"uai" : "uai",
"uei" : "uei",
"ui" : "ui"
}

export const codaFromPuj = {
"" : "" ,
"h" : "h" ,
"p" : "p" ,
"m" : "m" ,
"n" : "ng",
"ng" : "ng",
"t" : "k" ,
"k" : "k" ,
"ⁿ" : "n" ,
"ⁿh" : "nh"
}

export const initialToPuj = {
"" : "" ,
"b" : "p" ,
"p" : "ph" ,
"bh": "b" ,
"m" : "m" ,
"d" : "t" ,
"t" : "th" ,
"n" : "n" ,
"l" : "l" ,
"z" : "ts" ,
"c" : "tsh" ,
"s" : "s" ,
"r" : "j" ,
"g" : "k" ,
"k" : "kh" ,
"gh": "g" ,
"ng": "ng" ,
"h" : "h"
}

export const medialToPuj = {
"" : "" ,
"a" : "a" ,
"o" : "o" ,
"e" : "e" ,
"v" : "ṳ" ,
"ai" : "ai" ,
"oi" : "oi" ,
"ei" : "ei" ,
"au" : "au" ,
"ou" : "ou" ,
"i" : "i" ,
"ia" : "ia" ,
"io" : "io" ,
"ie" : "ie" ,
"iou": "iou" ,
"ieu": "ieu" ,
"iau": "iau" ,
"iu" : "iu" ,
"u" : "u" ,
"ua" : "ua" ,
"ue" : "ue" ,
"uai": "uai" ,
"uei": "uei" ,
"ui" : "ui"
}

export const codaToPuj = {
"" : "" ,
"h" : "h" ,
"p" : "p" ,
"m" : "m" ,
"ng": "ng" ,
"k" : "k" ,
"n" : "ⁿ" ,
"nh": "ⁿh"
}
5 changes: 5 additions & 0 deletions src/pengim.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import * as gdpi from "./data-gdpi.js";
import * as ggn from "./data-ggn.js";
import * as dieghv from "./data-dieghv.js";
import * as tones from "./data-tones.js";

// Functions ------------------------------------------------------------------
Expand Down Expand Up @@ -154,12 +155,16 @@ function convertWord(word, direction="fromPuj", system="gdpi") {
return gdpiLikeToPuj(word, gdpi);
} else if (system == "ggn") {
return gdpiLikeToPuj(word, ggn);
} else if (system == "dieghv") {
return gdpiLikeToPuj(word, dieghv);
}
} else if (direction == "fromPuj") {
if (system == "gdpi") {
return pujToGdpiLike(word, gdpi);
} else if (system == "ggn") {
return pujToGdpiLike(word, ggn);
} else if (system == "dieghv") {
return pujToGdpiLike(word, dieghv);
}
}
}
Expand Down

0 comments on commit 7e5ebf4

Please sign in to comment.