Giter VIP home page Giter VIP logo

node-pronounceable's Introduction

pronounceable Build Status

This is an alphabetic encoding for numbers using "pronouncable" syllables (consonant/vowel pairs)

Using a combination of 20 consonants (excluding C) and 5 vowels each syllable encodes the same number of bits as two base 10 digits, so encoded length is roughly the same as pure numeric digits (there will be one extra character if the numeric length is odd).

This encoding may not have any practical purpose, the original use was for a simple way of generating nonsense words, but let me know if you come up with one.

Note, some time after developing this I discovered a couple similar efforts.

  • jmettraux's rufus-mnemo (ruby) also is designed to encode integers and gives similar sounding results to Pronounceable but uses an explicit list of Japanese syllables (including some 3 character ones)
  • Antti Huima's Bubble Babble is similar in spirit but takes (hex) strings rather than numbers as input. I'm not aware of any JavaScript implmentations but CPAN has one (perl).

Install

git clone http://github.com/femto113/node-pronounceable.git
cd node-pronounceable
npm link

Example

var p = require("pronounceable");

var a = p.encode(9787);
// a == "zixi"

// can change case and/or add spaces or non-alphabetic characters without problem
var b = [
  "ZIXI", // upper case
  "Zixi"  // mixed case
  "zi-xi" // injected hyphen
  "zixi " // trailing space
].map(function (s) { return p.decode(s); });
// b == [9787, 9787, 9787]

// drop a character or slip in a C and you get NaN
var c = [
  "zix"
  , "cixi"
].map(function (s) { return p.decode(s); });
// c == [NaN, NaN]

console.log(a, b, c);

TODO

  • publish to npm, update install section

node-pronounceable's People

Contributors

femto113 avatar

Stargazers

 avatar Pantelis Koukousoulas avatar Ilya Tikhonov avatar mscdex avatar  avatar

Watchers

James Cloos avatar

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.