word-transformer
v1.0.0
Published
Solution to word transformation problem. Given a dictionary of words, transform one word to another with each transformation being a word in given dictionary
Downloads
8
Maintainers
Readme
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
- Facade classes that can create transformer instance from other data formats (in-memory Array, json file)
- tests