Skip to content

JS - Generates permutations of all sentences, using list of words 🎉

License

Notifications You must be signed in to change notification settings

arshadkazmi42/ak-phrase.js

Repository files navigation

ak-phrase

Build NPM Version NPM Downloads Github Repo Size LICENSE Contributors Commit

This library generates all the permutations of sentences using the words supplied in a 2D array.

It follows the word's order in a sentence, which is the same as the word's column order in an array.

Install

npm install ak-phrase

or

yarn add ak-phrase

Usage

const generateSentences = require('ak-phrase');

const wordArray = [
    ['eat'], 
    ['code', 'commit'], 
    ['sleep']
];

const sentences = generateSentences(wordArray);
console.log(sentences);

// Output:
// [ 'eat code sleep', 'eat commit sleep' ]

Contributing

Interested in contributing to this project? You can log any issues or suggestion related to this library here.

Read our contributing guide to get started with contributing to the codebase.

Contributors

Thank you to all the contributors who have helped us in making this project better 🙌