This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A simple version of the transliterate method which makes replacements | |
// but does not handle common edge cases. | |
const simpleTransliterate = (string = '', substitutions = {}) => { | |
// save the string to a new variable for readability | |
let str = string; | |
// get the list of substitutions | |
Object.entries(substitutions) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// An intermediate transliteration function that handles substrings | |
// but does not handle other edge cases | |
const sortedTransliterate = (string = '', substitutions = {}) => { | |
// save the string to a new variable for readability | |
let str = string; | |
// get the list of substitutions | |
Object.entries(substitutions) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* A unidirectional transliteration algorithm which makes a set of substitutions on a string, and handles common edge cases. | |
* @param {String} [string=''] The String to transliterate | |
* @param {Object} [substitutions={}] The set of substitutions to make on the String. Each key should be the character(s) to replace, and its value should be the character(s) to replace it with. | |
* @return {String} Returns a new String with the substitutions made | |
*/ | |
const transliterate = (string = '', substitutions = {}) => { | |
// save the string to a new variable for readability | |
let str = string; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class=igl> | |
<p class=ex-header>Chitimacha (isolate)</p> | |
<p class=txn>siksi<em>nk</em> his heːčtiʔi</p> | |
<ol class=words> | |
<li class=word> | |
<p class=word-m>siksi‑<em>nk</em></p> |