Giter VIP home page Giter VIP logo

greek-transliteration's Introduction

greek-transliteration

A JavaScript package for creating custom transliterations of Greek.

install

npm

npm i greek-transliteration

local

Download or clone this repository.

cd greek-transliteration
npm install
npm run build

example

const grc = require("greek-transliteration");
grc.transliterate("θεός");
// "theos"

DOCS

transliterate()

Takes string and optionally a Schema or Partial<Schema>.

grc.transliterate("υἱοῦ θεοῦ");
// "huiou theou"

If no Schema is passed, then the package defaults to SBL's academic style.

You can pass in a Partial<Schema> that will modify SBL's academic style:

grc.transliterate("θεος", { SMALL_THETA: "þ" });
// "þeous"

If you need a fully customized transliteration, it is best to use the Schema constructor:

const schema = new grc.Schema({
  SMALL_EPSILON: "3",
  SMALL_THETA: "þ",
  SMALL_OMICRON: "ø",
  SMALL_FINAL_SIGMA: "ß",
  ...
}) // truncated for brevity

grc.transliterate("θεος", schema);
// "þ3øß"

Schema

A Schema is used to define a schema for transliteration. See the Schema source for all available properties.

The Schema can be divided into a few categories.

small

Small characters are required and represent the basic Greek lowercase characters — αβγδεζηθικλμνξοπρστυφχψω.

They are all prefixed with SMALL_.

grc.transliterate("α", { SMALL_ALPHA: "a" });
// "a"

capital

Uppercase characters are not required and represent the basic Greek uppercase characters — ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ.

They are all prefixed with CAPITAL_.

If no transliteration is provided, the schema defaults to calling .toUpperCase() on the small form. This is true of any property with CAPITAL_.

const schema = new grc.Schema({
  SMALL_ALPHA: "a",
  CAPITAL_DELTA: "D"
  ...
}) // truncated for brevity
grc.transliterate("AΔ", schema);
// "AD"

orthographies

gamma nasal

The SMALL_GAMMA_NASAL and CAPITAL_GAMMA_NASAL represent a gamma any time it is followed by a gamma, kappa, xi, or chi (e.g. γγ, γκ, γξ, γχ).

grc.transliterate("ἄγγελος", { SMALL_GAMMA_NASAL: "n" });
// "angelos"
double rho

The SMALL_DOUBLE_RHO and CAPITAL_DOUBLE_RHO represent any two rhos together (e.g. ρρ).

grc.transliterate("Πύρρος", { SMALL_DOUBLE_RHO: "rrh" });
// "Pyrrhos"
upsilon dipthong

The SMALL_UPSILON_DIPTHONG and CAPITAL_UPSILON_DIPTHONG represent anytime when a upsilon is used in a diphthong (e.g. αυ, ευ, ηυ, ου, υι)

grc.transliterate("αυτου", { SMALL_UPSILON_DIPTHONG: "u" });
// "autou"

// BUT, if a DIAERESIS is separating the diphthong
transliterate("πραϋσμός", { SMALL_UPSILON_DIPTHONG: "u" });
// "praysmos"
rough breathing mark

The ROUGH_BREATHING_MARK represents the DASIA character, used over vowels and rho.

grc.transliterate("ὕμνος", { ROUGH_BREATHING_MARK: "h" });
// "hymnos"

functionality

There is one property for functionality called preserveCapitals.

If preserveCapitals is false, then all capital Greek characters are converted to their small (i.e. lowercase) forms.

grc.transliterate("Αα", { preserveCapitals: false });
// "aa"

License

MIT

Live

Use it live at charlesLoder.github.io/greekTransliteration

Contributing

Please feel free to Fork, create Pull Requests, or submit issues.

greek-transliteration's People

Contributors

charlesloder avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

greek-transliteration's Issues

Thank you

I just want to say, thank you!

I literally asked people three days ago

Does anyone know of a library that transliterates Greek according to SBL? (js would be preferable, python will do but anything is better than nothing)

My initial attempts were both slower and less effective than your library. This is great! And I see you have a Hebrew one which I'll need soon too... Thanks :)

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.