Convert between Western Cree standard Roman orthography (SRO) and syllabics!
This is a port of the Python library of the same name. For more complete documentation, see the Python version's documentation.
Copy cree-sro-syllabics.js
to wherever is most convenient. Then,
include it in your HTML like this:
<script src="/path/to/cree-sro-syllabics.js" charset="UTF-8"></script>
Make sure to provide charset="UTF-8"
! The browser may attempt to
read the file in an alternate encoding, and the converter will no longer
work as expected.
When loaded in the browser, you can access all functions using the
CreeSROSyllabics
global:
<script src="/path/to/cree-sro-syllabics.js" charset="UTF-8"></script>
<script>
console.log(CreeSROSyllabics.sro2syllabics("tân'si")) // logs "ᑕᓂᓯ"
</script>
Install using npm:
npm install cree-sro-syllabics --save
Then require()
it into your code:
var CreeSROSyllabics = require('cree-sro-syllabics')
console.log(CreeSROSyllabics.sro2syllabics("tân'si")) // logs ᑖᓂᓯ
There are two primary functions: sro2syllabics()
and
syllabics2sro()
. There is also the version
constant.
sro2Syllabics(sroString: string, options = {}): string
Convert text in SRO to syllabics.
CreeSROSyllabics.sro2syllabics("tân'si")
// returns "ᑕᓂᓯ"
options
, if supplied, is an object containing the following options:
What character to use as hyphens. Defaults to U+202F NARROW NO-BREAK SPACE
—a space that is narrower than a word separating space; line
breaks are not permitted at this space.
Using a normal space character:
CreeSROSyllabics.sro2syllabics('kâ-mahihkani-pimohtêt', { hyphens: ' ' })
ᑳ ᒪᐦᐃᐦᑲᓂ ᐱᒧᐦᑌᐟ
Using the default:
CreeSROSyllabics.sro2syllabics('kâ-mahihkani-pimohtêt')
ᑳ ᒪᐦᐃᐦᑲᓂ ᐱᒧᐦᑌᐟ
What character use as the word-final “hk” (e.g., in locatives and
certain conjunct mode verb forms). Use either "x"
(default) or "hk"
.
The default is to use the «ᕽ» syllabic:
CreeSROSyllabics.sro2syllabics('sâwanohk')
ᓵᐘᓄᕽ
This is equivalent to providing { finalHK: "x" }
:
CreeSROSyllabics.sro2syllabics('sâwanohk', { finalHK: "x" })
ᓵᐘᓄᕽ
However, some communities (like Maskwacîs) do not use the «ᕽ» syllabic,
instead using «ᐦᐠ». You can specify { finalHK: "hk" }
to get this
behaviour instead:
CreeSROSyllabics.sro2syllabics('sâwanohk', { finalHK: "hk" })
ᓵᐘᓄᐦᐠ
syllabics2sro(syllabicsString: string, options = {}): string
Convert text in syllabics to SRO.
CreeSROSyllabics.syllabics2sro('ᑖᓂᓯ')
// returns "tân'si"
options
, if supplied, is an object containing the following options:
Whether to produce circumflexes (âêîô) or macrons (āēīō) when transliterating long vowels.
Valid options:
'circumflexes'
(default)'macrons'
Specifying 'macrons'
:
CreeSROSyllabics.syllabics2sro("ᑖᓂᓯ", { longAccents: 'macrons' })
tānisi
Using the defaults (circumflexes):
CreeSROSyllabics.syllabics2sro("ᑖᓂᓯ")
tânisi
The module's current version, as a string.
Copyright © 2018–2021 National Research Council Canada.
Licensed under the MIT license.