Git Product home page Git Product logo

dogedc's Introduction

Doge Decimal Classification

Such classification. Many library. So fun. No Dewey. Wow.

Installation

npm i dogedc

CLI

Doge Decimal Classification now comes with a command-line interface! Amaze.

$ dogedc 123
So determinism. Many indeterminism.
$ dogedc # random class
Very international. Many law. Wow.

You'll need to install it globally (npm i dogedc -g) to get the CLI on your path.

API Usage

dogedc(classNumber, callback) — convert class from boring old Dewey Decimal Classification to exciting new Doge Decimal Classification. The callback function is passed any error as its first argument & an object as its second argument, that object has form:

{
    'classNumber': '020',
    'className': 'Library & information sciences',
    'dogeClassName': 'Many library. Such information. Very sciences.'
}

If classNumber is falsey or not present, dogedc will pick a random class number & pass that to the callback.

var dogedc = require('dogedc');

// get random Doge Decimal class
dogedc(function(err, ddc) {
    console.log('Class number:', ddc.classNumber);
    console.log('Doge class name:', ddc.dogeClassName);
});

// look up 020's class name
dogedc('020', function(err, ddc) {
    console.log('020', ddc.dogeClassName);
});

The dogedc node module also exposes a toDoge function for converting tepid plain human speak into awesome beautiful doge speak. It was written specifically for this module, so as a general-purpose doge-ifier your mileage may vary, but it's there.

var toDoge = require('dogedc').toDoge;

console.log(toDoge('Hello World'));
// logs "Many hello. Much world." or some such

Notes

The number argument passed to dogedc can be an integer or a string. It's safer to always pass strings because numbers with leading 0s are treated as base 8 in JavaScript (e.g. 020 === 16);

Right now, only top-level, 3-digit classes work.

I culled the list of Dewey Decimal Classes from the University of Illinois at Urbana-Champaign's list. If there are any errors, blame them ;)

Doge Decimal Classification is the first stochastic classification system.* Class names are randomly generated based on the corresponding Dewey Decimal Classification & well-recognized dogespeak constructions. For this module's users, that means that the resulting dogeClassName of any given class number may differ each time the module is executed.

I tried using fs.createReadStream & JSONStream to parse the Dewey JSON file but it turned out to be almost twice as slow as simply using fs.readFile. That work is on the stream branch & the testing script is at test/bench.

*…that I'm aware of.

License

dogedc's People

Contributors

phette23 avatar

Watchers

 avatar  avatar  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.