Skip to content

paulfitz/smalldata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status npm version

Guess data transformations. Just a toy as yet. See tests for transformations implemented.

From commandline:

$ ./bin/smalldata space:[SPACE] monkey:[MONKEY] dream: frog:
dream:[DREAM]
frog:[FROG]
var smalldata = require("smalldata");
var transform = new smalldata.Transform([
      [" jane tzu", "Jane Tzu!"],
      ["tom smith ", "Tom Smith!"],
      ["mr pickle", "Mr Pickle!"],
    ]);
console.log(transform.apply(["  jeff thing ", "garden hose"]));
// shows "Jeff Thing!", "Garden Hose!"

Extensible. You can add your own theories that will be used when data justifies them. They will combine with existing theories.

import {addTheory, Transform} from 'smalldata';

function zipifyUnitedStates(x: any) {
  const s = String(x);
  return "00000".substr(0, 5 - s.length) + s;
}
addTheory(() => new SimpleTheory(zipifyUnitedStates, 'zip-us'));

const tr = new Transform([
 ["02139", "zipcode 02139"],
 [2138, "zipcode 02138"],
 ["29123", "zipcode 29123"],
 ["10000", "zipcode 10000"],
]);
const result = tr.apply([7149]);
assert.deepEqual(["zipcode 07149"], result);

About

guess transformations for tiny data

Resources

Stars

Watchers

Forks

Packages

No packages published