word-transformer

1.0.0 • Public • Published

Transformer

Given a dictionary, a source word and destination word, find a path from source to destination that goes through word transformations. The transformation of a word defined as follows.

  • Word in dictionary that can be generated by removing one letter from given word
  • Word in dictionary that can be generated by replacing one letter with another
  • Word in dictionary that can be generated by adding one letter at any place

Requirements

nodejs, https://nodejs.org

Installation

npm install word-transformer

Testing

See file client.js

node ./client.js

API

var TransFormer = require('word-transformer');
var transformer = new Transformer('/usr/share/dict/cracklib-small'); // This might take a while, it creates the dictionary graph

transformer.transform('cap', ate) // -> [ 'cap', 'cape', 'ape', 'ate' ]

TODO

  1. Facade classes that can create transformer instance from other data formats (in-memory Array, json file)
  2. tests

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i word-transformer

    Weekly Downloads

    7

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • juzerali