Coder Social home page Coder Social logo

eddieantonio / cree-sro-syllabics.js Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.3 MB

Convert Western Cree SRO to Syllabics (ᒐᐦᑭᐯᐦᐃᑲᓇ)

License: MIT License

JavaScript 75.17% Python 24.83%
cree syllabics sro nehiyawewin nehinawewin converter transliterator nihithawewin hacktoberfest

cree-sro-syllabics.js's Introduction

Cree SRO/Syllabics

Unit test status codecov npm version calver YYYY.MM.DD

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.

Install

Browser

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>

NodeJS

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 ᑖᓂᓯ

Usage

There are two primary functions: sro2syllabics() and syllabics2sro(). There is also the version constant.

sro2syllabics()

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:

options.hyphens

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')

ᑳ ᒪᐦᐃᐦᑲᓂ ᐱᒧᐦᑌᐟ

options.finalHK

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()

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:

options.longAccents

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

version

The module's current version, as a string.

License

Copyright © 2018–2021 National Research Council Canada.

Licensed under the MIT license.

cree-sro-syllabics.js's People

Contributors

dependabot[bot] avatar eddieantonio avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

cree-sro-syllabics.js's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.